~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to setup.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2011-05-05 18:05:06 UTC
  • mfrom: (5802.4.1 rules)
  • Revision ID: pqm@pqm.ubuntu.com-20110505180506-ddz84ffyd1kzt6r1
(mbp) add RuleSearcher.get_single_value() (Martin Pool)

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 tools.build_mo 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
 
    import re
206
 
    _version = re.match("^[0-9.]+", pyrex_version).group(0)
207
 
    pyrex_version_info = tuple(map(int, _version.split('.')))
 
192
    pyrex_version_info = tuple(map(int, pyrex_version.split('.')))
208
193
 
209
194
 
210
195
class build_ext_if_possible(build_ext):
484
469
    packages.append('sqlite3')
485
470
 
486
471
 
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
 
 
493
472
if 'bdist_wininst' in sys.argv:
494
473
    def find_docs():
495
474
        docs = []
514
493
            # help pages
515
494
            'data_files': find_docs(),
516
495
            # for building pyrex extensions
517
 
            'cmdclass': command_classes,
 
496
            'cmdclass': {'build_ext': build_ext_if_possible},
518
497
           }
519
498
 
520
499
    ARGS.update(META_INFO)
521
500
    ARGS.update(BZRLIB)
522
 
    PKG_DATA['package_data']['bzrlib'].append('locale/*/LC_MESSAGES/*.mo')
523
501
    ARGS.update(PKG_DATA)
524
 
 
 
502
    
525
503
    setup(**ARGS)
526
504
 
527
505
elif 'py2exe' in sys.argv:
 
506
    import glob
528
507
    # py2exe setup
529
508
    import py2exe
530
509
 
674
653
                       'tools/win32/bzr_postinstall.py',
675
654
                       ]
676
655
    gui_targets = [gui_target]
677
 
    data_files = topics_files + plugins_files + I18N_FILES
 
656
    data_files = topics_files + plugins_files
678
657
 
679
658
    if 'qbzr' in plugins:
680
659
        get_qbzr_py2exe_info(includes, excludes, packages, data_files)
682
661
    if 'svn' in plugins:
683
662
        get_svn_py2exe_info(includes, excludes, packages)
684
663
 
685
 
    if 'fastimport' in plugins:
686
 
        get_fastimport_py2exe_info(includes, excludes, packages)
687
 
 
688
664
    if "TBZR" in os.environ:
689
665
        # TORTOISE_OVERLAYS_MSI_WIN32 must be set to the location of the
690
666
        # TortoiseOverlays MSI installer file. It is in the TSVN svn repo and
740
716
            self.optimize = 2
741
717
 
742
718
    if __name__ == '__main__':
743
 
        command_classes['install_data'] = install_data_with_bytecompile
744
 
        command_classes['py2exe'] = py2exe_no_oo_exe
745
719
        setup(options=options_list,
746
720
              console=console_targets,
747
721
              windows=gui_targets,
748
722
              zipfile='lib/library.zip',
749
723
              data_files=data_files,
750
 
              cmdclass=command_classes,
 
724
              cmdclass={'install_data': install_data_with_bytecompile,
 
725
                        'py2exe': py2exe_no_oo_exe},
751
726
              )
752
727
 
753
728
else:
758
733
        # easy_install one
759
734
        DATA_FILES = [('man/man1', ['bzr.1'])]
760
735
 
761
 
    DATA_FILES = DATA_FILES + I18N_FILES
762
736
    # std setup
763
737
    ARGS = {'scripts': ['bzr'],
764
738
            'data_files': DATA_FILES,