~ubuntu-branches/ubuntu/trusty/python-distutils-extra/trusty-proposed

« back to all changes in this revision

Viewing changes to DistUtilsExtra/auto.py

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2011-02-11 10:39:50 UTC
  • mfrom: (18.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20110211103950-kseoijf2ilwdr3rr
Tags: 2.24-1
* auto.py: Fix the string comparison to not install *.notifyrc.in files
  twice. Thanks Éric Araujo for spotting this!
* DistUtilsExtra/auto.py, __provides(): Do not accidentally clobber
  "py_modules" with "packages", by using a proper copy of the list. Remove
  error filter workaround from test/auto.py.
* Rename "check" command to "pylint", to avoid clobbering distutils' own
  check command in 2.7/3.x. (LP: #714655)
* DistUtilsExtra/auto.py, DistUtilsExtra/command/__init__.py: Actually
  expose the pylint command as a setup.py command.
* Remove pykdeuic4 integration, it's been a continuous source of build
  failures and bugs. Using uic.loadUi() is much more robust.
  Instead, install Qt *.ui files into /usr/share/projectname/ just like the
  GtkBuilder *.ui files.
* debian/compat, debian/control: Bump to dh 7 compatibility, as we are using
  dh_auto_* magic.

Show diffs side-by-side

added added

removed removed

Lines of Context:
10
10
 * Python modules (./*.py, only in root directory)
11
11
 * Python packages (all directories with __init__.py)
12
12
 * Docbook-XML GNOME help files (help/<language>/{*.xml,*.omf,figures})
13
 
 * GtkBuilder (*.ui) [installed into prefix/share/<projectname>/]
14
 
 * Qt4 user interfaces (*.ui) [compiled with pykdeuic into Python modules]
 
13
 * GtkBuilder and Qt4 user interfaces (*.ui) [installed into
 
14
   prefix/share/<projectname>/]
15
15
 * D-Bus (*.conf and *.service)
16
16
 * PolicyKit (*.policy.in)
17
17
 * Desktop files (*.desktop.in) [into prefix/share/applications, or
88
88
    __data(attrs, src)
89
89
    __scripts(attrs, src)
90
90
    __stdfiles(attrs, src)
91
 
    __gtkbuilder(attrs, src)
 
91
    __ui(attrs, src)
92
92
    __manpages(attrs, src)
93
93
 
94
94
    if 'clean' not in sys.argv:
123
123
    v.setdefault('build_help', build_help_auto)
124
124
    v.setdefault('build_i18n', build_i18n_auto)
125
125
    v.setdefault('build_icons', build_icons.build_icons)
126
 
    v.setdefault('build_kdeui', build_kdeui_auto)
127
126
    v.setdefault('install', install_auto)
128
127
    v.setdefault('clean', clean_build_tree)
129
128
    v.setdefault('sdist', sdist_auto)
 
129
    v.setdefault('pylint', pylint.pylint)
130
130
 
131
131
def __modules(attrs, src):
132
132
    '''Default modules'''
222
222
    data_files = []
223
223
    for f in src.copy():
224
224
        if f.startswith('data/') and not f.startswith('data/icons/') and \
225
 
                not f.endswith('.desktop.in') and not f.endswith('*.notifyrc.in'):
 
225
                not f.endswith('.desktop.in') and not f.endswith('.notifyrc.in'):
226
226
            if not os.path.islink(f):
227
227
                # symlinks are handled in install_auto
228
228
                v.append((os.path.join('share', attrs['name'], os.path.dirname(f[5:])), [f]))
276
276
        attrs.setdefault('data_files', []).append((os.path.join('share', 'doc',
277
277
            attrs['name']), readme))
278
278
 
279
 
def __gtkbuilder(attrs, src):
280
 
    '''Install GtkBuilder *.ui files'''
 
279
def __ui(attrs, src):
 
280
    '''Install GtkBuilder/Qt *.ui files'''
281
281
 
282
282
    ui = []
283
283
    for f in src_fileglob(src, '*.ui'):
284
 
        contents = open(f).read()
285
 
        if ('<interface>\n' in contents or '<interface ' in contents) and 'class="Gtk' in contents:
 
284
        fd = open(f)
 
285
        firstlines = fd.readline()
 
286
        firstlines += '\n' + fd.readline()
 
287
        fd.close()
 
288
        if '<interface' in firstlines or '<ui version=' in firstlines:
286
289
            src_mark(src, f)
287
290
            ui.append(f)
288
291
    if ui:
402
405
    if 'provides' in attrs:
403
406
        return
404
407
 
405
 
    provides = attrs.get('py_modules', [])
 
408
    provides = list(attrs.get('py_modules', [])) # we need a copy here
406
409
    for p in attrs.get('packages', []):
407
410
        provides.append(p.replace(os.path.sep, '.'))
408
411
    attrs['provides'] = __filter_namespace(provides)
594
597
            except:
595
598
                pass
596
599
 
597
 
class build_kdeui_auto(build_kdeui.build_kdeui):
598
 
    def finalize_options(self):
599
 
        global src
600
 
 
601
 
        # add *.ui files which belong to KDE4
602
 
        kdeui_files = []
603
 
        for f in src_fileglob(src, '*.ui'):
604
 
            fd = open(f)
605
 
            # might be on the first or second line
606
 
            if fd.readline().startswith('<ui version="') or \
607
 
               fd.readline().startswith('<ui version="'):
608
 
                src_mark(src, f)
609
 
                kdeui_files.append(f)
610
 
            fd.close()
611
 
        if kdeui_files:
612
 
            try:
613
 
                uf = eval(self.ui_files)
614
 
            except TypeError:
615
 
                uf = []
616
 
            uf += kdeui_files
617
 
            self.ui_files = repr(uf)
618
 
 
619
 
        build_kdeui.build_kdeui.finalize_options(self)
620
 
 
621
600
#
622
601
# Automatic sdist
623
602
#