~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to setup.py

  • Committer: Jelmer Vernooij
  • Date: 2011-05-03 13:53:46 UTC
  • mto: This revision was merged to the branch mainline in revision 5826.
  • Revision ID: jelmer@samba.org-20110503135346-l2f6xnenzn3320gv
Kill annotate_file_revision_tree() in favor annotate_file_tree().

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