~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to setup.py

  • Committer: INADA Naoki
  • Date: 2011-05-05 09:15:34 UTC
  • mto: (5830.3.3 i18n-msgfmt)
  • mto: This revision was merged to the branch mainline in revision 5873.
  • Revision ID: songofacandy@gmail.com-20110505091534-7sv835xpofwrmpt4
Add update-pot command to Makefile and tools/bzrgettext script that
extracts help text from bzr commands.

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
import sys
12
12
import copy
13
13
 
14
 
if sys.version_info < (2, 6):
15
 
    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")
16
16
    sys.exit(1)
17
17
 
18
18
# NOTE: The directory containing setup.py, whether run by 'python setup.py' or
69
69
                                        'tests/ssl_certs/ca.crt',
70
70
                                        'tests/ssl_certs/server_without_pass.key',
71
71
                                        'tests/ssl_certs/server_with_pass.key',
72
 
                                        'tests/ssl_certs/server.crt',
73
 
                                        'locale/*/LC_MESSAGES/*.mo',
 
72
                                        'tests/ssl_certs/server.crt'
74
73
                                       ]},
75
74
           }
76
75
 
153
152
    Generate bzr.1.
154
153
    """
155
154
 
156
 
    sub_commands = build.sub_commands + [
157
 
            ('build_mo', lambda _: True),
158
 
            ]
159
 
 
160
155
    def run(self):
161
156
        build.run(self)
162
157
 
168
163
## Setup
169
164
########################
170
165
 
171
 
from tools.build_mo import build_mo
172
 
 
173
166
command_classes = {'install_scripts': my_install_scripts,
174
 
                   'build': bzr_build,
175
 
                   'build_mo': build_mo,
176
 
                   }
 
167
                   'build': bzr_build}
177
168
from distutils import log
178
169
from distutils.errors import CCompilerError, DistutilsPlatformError
179
170
from distutils.extension import Extension
180
171
ext_modules = []
181
172
try:
182
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...")
183
178
        from Cython.Distutils import build_ext
184
179
        from Cython.Compiler.Version import version as pyrex_version
185
 
    except ImportError:
186
 
        print("No Cython, trying Pyrex...")
187
 
        from Pyrex.Distutils import build_ext
188
 
        from Pyrex.Compiler.Version import version as pyrex_version
189
180
except ImportError:
190
181
    have_pyrex = False
191
182
    # try to build the extension from the prior generated source.
478
469
    packages.append('sqlite3')
479
470
 
480
471
 
481
 
def get_fastimport_py2exe_info(includes, excludes, packages):
482
 
    # This is the python-fastimport package, not to be confused with the
483
 
    # bzr-fastimport plugin.
484
 
    packages.append('fastimport')
485
 
 
486
 
 
487
472
if 'bdist_wininst' in sys.argv:
488
473
    def find_docs():
489
474
        docs = []
508
493
            # help pages
509
494
            'data_files': find_docs(),
510
495
            # for building pyrex extensions
511
 
            'cmdclass': command_classes,
 
496
            'cmdclass': {'build_ext': build_ext_if_possible},
512
497
           }
513
498
 
514
499
    ARGS.update(META_INFO)
515
500
    ARGS.update(BZRLIB)
516
501
    ARGS.update(PKG_DATA)
517
 
 
 
502
    
518
503
    setup(**ARGS)
519
504
 
520
505
elif 'py2exe' in sys.argv:
676
661
    if 'svn' in plugins:
677
662
        get_svn_py2exe_info(includes, excludes, packages)
678
663
 
679
 
    if 'fastimport' in plugins:
680
 
        get_fastimport_py2exe_info(includes, excludes, packages)
681
 
 
682
664
    if "TBZR" in os.environ:
683
665
        # TORTOISE_OVERLAYS_MSI_WIN32 must be set to the location of the
684
666
        # TortoiseOverlays MSI installer file. It is in the TSVN svn repo and
734
716
            self.optimize = 2
735
717
 
736
718
    if __name__ == '__main__':
737
 
        command_classes['install_data'] = install_data_with_bytecompile
738
 
        command_classes['py2exe'] = py2exe_no_oo_exe
739
719
        setup(options=options_list,
740
720
              console=console_targets,
741
721
              windows=gui_targets,
742
722
              zipfile='lib/library.zip',
743
723
              data_files=data_files,
744
 
              cmdclass=command_classes,
 
724
              cmdclass={'install_data': install_data_with_bytecompile,
 
725
                        'py2exe': py2exe_no_oo_exe},
745
726
              )
746
727
 
747
728
else: