~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to setup.py

  • Committer: Tarmac
  • Author(s): Vincent Ladeuil
  • Date: 2017-01-30 14:42:05 UTC
  • mfrom: (6620.1.1 trunk)
  • Revision ID: tarmac-20170130144205-r8fh2xpmiuxyozpv
Merge  2.7 into trunk including fix for bug #1657238 [r=vila]

Show diffs side-by-side

added added

removed removed

Lines of Context:
10
10
import os.path
11
11
import sys
12
12
import copy
 
13
import glob
13
14
 
14
15
if sys.version_info < (2, 6):
15
16
    sys.stderr.write("[ERROR] Not a supported Python version. Need 2.6+\n")
70
71
                                        'tests/ssl_certs/server_without_pass.key',
71
72
                                        'tests/ssl_certs/server_with_pass.key',
72
73
                                        'tests/ssl_certs/server.crt',
73
 
                                        'locale/*/LC_MESSAGES/*.mo',
74
74
                                       ]},
75
75
           }
76
 
 
 
76
I18N_FILES = []
 
77
for filepath in glob.glob("bzrlib/locale/*/LC_MESSAGES/*.mo"):
 
78
    langfile = filepath[len("bzrlib/locale/"):]
 
79
    targetpath = os.path.dirname(os.path.join("share/locale", langfile))
 
80
    I18N_FILES.append((targetpath, [filepath]))
77
81
 
78
82
def get_bzrlib_packages():
79
83
    """Recurse through the bzrlib directory, and extract the package names"""
101
105
 
102
106
from distutils import log
103
107
from distutils.core import setup
 
108
from distutils.version import LooseVersion
104
109
from distutils.command.install_scripts import install_scripts
105
110
from distutils.command.install_data import install_data
106
111
from distutils.command.build import build
168
173
## Setup
169
174
########################
170
175
 
171
 
from tools.build_mo import build_mo
 
176
from bzrlib.bzr_distutils import build_mo
172
177
 
173
178
command_classes = {'install_scripts': my_install_scripts,
174
179
                   'build': bzr_build,
198
203
    from distutils.command.build_ext import build_ext
199
204
else:
200
205
    have_pyrex = True
201
 
    pyrex_version_info = tuple(map(int, pyrex_version.split('.')))
 
206
    pyrex_version_info = LooseVersion(pyrex_version)
202
207
 
203
208
 
204
209
class build_ext_if_possible(build_ext):
295
300
                        libraries=['Ws2_32'])
296
301
    add_pyrex_extension('bzrlib._walkdirs_win32')
297
302
else:
298
 
    if have_pyrex and pyrex_version_info[:3] == (0,9,4):
 
303
    if have_pyrex and pyrex_version_info == LooseVersion("0.9.4.1"):
299
304
        # Pyrex 0.9.4.1 fails to compile this extension correctly
300
305
        # The code it generates re-uses a "local" pointer and
301
306
        # calls "PY_DECREF" after having set it to NULL. (It mixes PY_XDECREF
313
318
add_pyrex_extension('bzrlib._chk_map_pyx')
314
319
ext_modules.append(Extension('bzrlib._patiencediff_c',
315
320
                             ['bzrlib/_patiencediff_c.c']))
316
 
if have_pyrex and pyrex_version_info < (0, 9, 6, 3):
 
321
if have_pyrex and pyrex_version_info < LooseVersion("0.9.6.3"):
317
322
    print("")
318
323
    print('Your Pyrex/Cython version %s is too old to build the simple_set' % (
319
324
        pyrex_version))
427
432
    # PyQt4 itself still escapes the plugin detection code for some reason...
428
433
    includes.append('PyQt4.QtCore')
429
434
    includes.append('PyQt4.QtGui')
 
435
    includes.append('PyQt4.QtTest')
430
436
    includes.append('sip') # extension module required for Qt.
431
437
    packages.append('pygments') # colorizer for qbzr
432
438
    packages.append('docutils') # html formatting
478
484
    packages.append('sqlite3')
479
485
 
480
486
 
 
487
def get_git_py2exe_info(includes, excludes, packages):
 
488
    packages.append('dulwich')
 
489
 
 
490
 
481
491
def get_fastimport_py2exe_info(includes, excludes, packages):
482
492
    # This is the python-fastimport package, not to be confused with the
483
493
    # bzr-fastimport plugin.
513
523
 
514
524
    ARGS.update(META_INFO)
515
525
    ARGS.update(BZRLIB)
 
526
    PKG_DATA['package_data']['bzrlib'].append('locale/*/LC_MESSAGES/*.mo')
516
527
    ARGS.update(PKG_DATA)
517
528
 
518
529
    setup(**ARGS)
519
530
 
520
531
elif 'py2exe' in sys.argv:
521
 
    import glob
522
532
    # py2exe setup
523
533
    import py2exe
524
534
 
668
678
                       'tools/win32/bzr_postinstall.py',
669
679
                       ]
670
680
    gui_targets = [gui_target]
671
 
    data_files = topics_files + plugins_files
 
681
    data_files = topics_files + plugins_files + I18N_FILES
672
682
 
673
683
    if 'qbzr' in plugins:
674
684
        get_qbzr_py2exe_info(includes, excludes, packages, data_files)
676
686
    if 'svn' in plugins:
677
687
        get_svn_py2exe_info(includes, excludes, packages)
678
688
 
 
689
    if 'git' in plugins:
 
690
        get_git_py2exe_info(includes, excludes, packages)
 
691
 
679
692
    if 'fastimport' in plugins:
680
693
        get_fastimport_py2exe_info(includes, excludes, packages)
681
694
 
752
765
        # easy_install one
753
766
        DATA_FILES = [('man/man1', ['bzr.1'])]
754
767
 
 
768
    DATA_FILES = DATA_FILES + I18N_FILES
755
769
    # std setup
756
770
    ARGS = {'scripts': ['bzr'],
757
771
            'data_files': DATA_FILES,