~phw/picard/external-fingerprinting

« back to all changes in this revision

Viewing changes to setup.py

  • Committer: Philipp
  • Date: 2009-06-08 22:34:33 UTC
  • Revision ID: philipp@aineko-20090608223433-xon7o2pqoyf076zz
* Properly include PyQt4's image plugins for the win32 installer
* Only include locales specified in const.py
* Some fixes for building the win32 installer

Show diffs side-by-side

added added

removed removed

Lines of Context:
8
8
from ConfigParser import RawConfigParser
9
9
from picard import __version__
10
10
 
 
11
# Install gettext "noop" function.
 
12
import __builtin__
 
13
__builtin__.__dict__['N_'] = lambda a: a
 
14
from picard.const import UI_LANGUAGES
 
15
 
11
16
 
12
17
if sys.version_info < (2, 5):
13
18
    print "*** You need Python 2.5 or higher to use Picard."
449
454
                 'picard.plugins', 'picard.formats',
450
455
                 'picard.formats.mutagenext', 'picard.ui',
451
456
                 'picard.ui.options', 'picard.util'),
452
 
    'locales': [('picard', os.path.split(po)[1][:-3], po) for po in glob.glob('po/*.po')],
 
457
    'locales': [('picard', lang[0], os.path.join('po', lang[0]+".po")) for lang in UI_LANGUAGES],
453
458
    'ext_modules': ext_modules,
454
459
    'data_files': [],
455
460
    'cmdclass': {
484
489
            generate_file('scripts/picard.py2exe.in', 'scripts/picard', {})
485
490
            self.distribution.data_files.append(
486
491
                ("", ["discid.dll", "libfftw3-3.dll", "libofa.dll",
487
 
                      "msvcp71.dll"]))
 
492
                      ]))
 
493
            #          "msvcp71.dll"]))
488
494
            for locale in self.distribution.locales:
489
495
                self.distribution.data_files.append(
490
496
                    ("locale/" + locale[1] + "/LC_MESSAGES",
491
497
                     ["build/locale/" + locale[1] + "/LC_MESSAGES/" + locale[0] + ".mo"]))
492
 
            #self.distribution.data_files.append(
493
 
            #    ("imageformats", ["C:\\Qt\\4.2.3\\plugins\\imageformats\\qjpeg1.dll"]))
 
498
            self.distribution.data_files.append(
 
499
                ("imageformats", [find_file_in_path("PyQt4/plugins/imageformats/qgif4.dll"),
 
500
                                  find_file_in_path("PyQt4/plugins/imageformats/qjpeg4.dll"),
 
501
                                  find_file_in_path("PyQt4/plugins/imageformats/qtiff4.dll")]))
494
502
 
495
503
            py2exe.run(self)
496
504
            print "*** creating the NSIS setup script ***"
497
 
            pathname = "installer/picard-setup.nsi"
 
505
            pathname = "installer\picard-setup.nsi"
498
506
            generate_file(pathname + ".in", pathname, 
499
507
                          {'name': 'MusicBrainz Picard',
500
508
                           'version': __version__})
501
509
            print "*** compiling the NSIS setup script ***"
502
510
            from ctypes import windll
503
 
            res = windll.shell32.ShellExecuteA(0, "compile", pathname, None, None, 0)
 
511
            operation = 'compile'
 
512
            res = windll.shell32.ShellExecuteA(0, operation, pathname, None, None, 0)
504
513
            if res < 32:
505
 
                raise RuntimeError, "ShellExecute failed, error %d" % res
 
514
                raise RuntimeError, 'ShellExecute failed executing "%s %s", error %d' % (
 
515
                    operation, pathname, res)
506
516
 
507
517
    args['cmdclass']['bdist_nsis'] = bdist_nsis
508
518
    args['windows'] = [{
511
521
    }]
512
522
    args['options'] = {
513
523
        'bdist_nsis': {
514
 
            'includes': ['sip', 'PyQt4._qt'] + [e.name for e in ext_modules],
 
524
            'includes': ['sip'] + [e.name for e in ext_modules],
515
525
            'excludes': ['ssl', 'socket', 'bz2'],
516
526
            'optimize': 2,
517
527
        },
519
529
except ImportError:
520
530
    py2exe = None
521
531
 
 
532
def find_file_in_path(filename):
 
533
    for include_path in sys.path:
 
534
        file_path = os.path.join(include_path, filename)
 
535
        if os.path.exists(file_path):
 
536
            return file_path
 
537
 
522
538
if do_py2app:
523
539
    class BuildAPP(py2app):
524
540
        def run(self):