~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to setup.py

Abbreviate pack_stat struct format to '>6L'

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
 
if sys.version_info < (2, 4):
15
 
    sys.stderr.write("[ERROR] Not a supported Python version. Need 2.4+\n")
 
15
if sys.version_info < (2, 6):
 
16
    sys.stderr.write("[ERROR] Not a supported Python version. Need 2.6+\n")
16
17
    sys.exit(1)
17
18
 
18
19
# NOTE: The directory containing setup.py, whether run by 'python setup.py' or
69
70
                                        'tests/ssl_certs/ca.crt',
70
71
                                        'tests/ssl_certs/server_without_pass.key',
71
72
                                        'tests/ssl_certs/server_with_pass.key',
72
 
                                        'tests/ssl_certs/server.crt'
 
73
                                        'tests/ssl_certs/server.crt',
73
74
                                       ]},
74
75
           }
75
 
 
 
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]))
76
81
 
77
82
def get_bzrlib_packages():
78
83
    """Recurse through the bzrlib directory, and extract the package names"""
152
157
    Generate bzr.1.
153
158
    """
154
159
 
 
160
    sub_commands = build.sub_commands + [
 
161
            ('build_mo', lambda _: True),
 
162
            ]
 
163
 
155
164
    def run(self):
156
165
        build.run(self)
157
166
 
163
172
## Setup
164
173
########################
165
174
 
 
175
from tools.build_mo import build_mo
 
176
 
166
177
command_classes = {'install_scripts': my_install_scripts,
167
 
                   'build': bzr_build}
 
178
                   'build': bzr_build,
 
179
                   'build_mo': build_mo,
 
180
                   }
168
181
from distutils import log
169
182
from distutils.errors import CCompilerError, DistutilsPlatformError
170
183
from distutils.extension import Extension
171
184
ext_modules = []
172
185
try:
173
186
    try:
 
187
        from Cython.Distutils import build_ext
 
188
        from Cython.Compiler.Version import version as pyrex_version
 
189
    except ImportError:
 
190
        print("No Cython, trying Pyrex...")
174
191
        from Pyrex.Distutils import build_ext
175
192
        from Pyrex.Compiler.Version import version as pyrex_version
176
 
    except ImportError:
177
 
        print("No Pyrex, trying Cython...")
178
 
        from Cython.Distutils import build_ext
179
 
        from Cython.Compiler.Version import version as pyrex_version
180
193
except ImportError:
181
194
    have_pyrex = False
182
195
    # try to build the extension from the prior generated source.
189
202
    from distutils.command.build_ext import build_ext
190
203
else:
191
204
    have_pyrex = True
192
 
    pyrex_version_info = tuple(map(int, pyrex_version.split('.')))
 
205
    import re
 
206
    _version = re.match("^[0-9.]+", pyrex_version).group(0)
 
207
    pyrex_version_info = tuple(map(int, _version.split('.')))
193
208
 
194
209
 
195
210
class build_ext_if_possible(build_ext):
469
484
    packages.append('sqlite3')
470
485
 
471
486
 
 
487
def get_fastimport_py2exe_info(includes, excludes, packages):
 
488
    # This is the python-fastimport package, not to be confused with the
 
489
    # bzr-fastimport plugin.
 
490
    packages.append('fastimport')
 
491
 
 
492
 
472
493
if 'bdist_wininst' in sys.argv:
473
494
    def find_docs():
474
495
        docs = []
493
514
            # help pages
494
515
            'data_files': find_docs(),
495
516
            # for building pyrex extensions
496
 
            'cmdclass': {'build_ext': build_ext_if_possible},
 
517
            'cmdclass': command_classes,
497
518
           }
498
519
 
499
520
    ARGS.update(META_INFO)
500
521
    ARGS.update(BZRLIB)
 
522
    PKG_DATA['package_data']['bzrlib'].append('locale/*/LC_MESSAGES/*.mo')
501
523
    ARGS.update(PKG_DATA)
502
 
    
 
524
 
503
525
    setup(**ARGS)
504
526
 
505
527
elif 'py2exe' in sys.argv:
506
 
    import glob
507
528
    # py2exe setup
508
529
    import py2exe
509
530
 
653
674
                       'tools/win32/bzr_postinstall.py',
654
675
                       ]
655
676
    gui_targets = [gui_target]
656
 
    data_files = topics_files + plugins_files
 
677
    data_files = topics_files + plugins_files + I18N_FILES
657
678
 
658
679
    if 'qbzr' in plugins:
659
680
        get_qbzr_py2exe_info(includes, excludes, packages, data_files)
661
682
    if 'svn' in plugins:
662
683
        get_svn_py2exe_info(includes, excludes, packages)
663
684
 
 
685
    if 'fastimport' in plugins:
 
686
        get_fastimport_py2exe_info(includes, excludes, packages)
 
687
 
664
688
    if "TBZR" in os.environ:
665
689
        # TORTOISE_OVERLAYS_MSI_WIN32 must be set to the location of the
666
690
        # TortoiseOverlays MSI installer file. It is in the TSVN svn repo and
716
740
            self.optimize = 2
717
741
 
718
742
    if __name__ == '__main__':
 
743
        command_classes['install_data'] = install_data_with_bytecompile
 
744
        command_classes['py2exe'] = py2exe_no_oo_exe
719
745
        setup(options=options_list,
720
746
              console=console_targets,
721
747
              windows=gui_targets,
722
748
              zipfile='lib/library.zip',
723
749
              data_files=data_files,
724
 
              cmdclass={'install_data': install_data_with_bytecompile,
725
 
                        'py2exe': py2exe_no_oo_exe},
 
750
              cmdclass=command_classes,
726
751
              )
727
752
 
728
753
else:
733
758
        # easy_install one
734
759
        DATA_FILES = [('man/man1', ['bzr.1'])]
735
760
 
 
761
    DATA_FILES = DATA_FILES + I18N_FILES
736
762
    # std setup
737
763
    ARGS = {'scripts': ['bzr'],
738
764
            'data_files': DATA_FILES,