/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to setup.py

  • Committer: Vincent Ladeuil
  • Date: 2011-08-16 13:12:40 UTC
  • mfrom: (6071 +trunk)
  • mto: This revision was merged to the branch mainline in revision 6076.
  • Revision ID: v.ladeuil+lp@free.fr-20110816131240-gcyn9cik86dxwgz3
Merge into trunk

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