~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to setup.py

  • Committer: v.ladeuil+lp at free
  • Date: 2007-05-15 17:40:32 UTC
  • mto: (2485.8.44 bzr.connection.sharing)
  • mto: This revision was merged to the branch mainline in revision 2646.
  • Revision ID: v.ladeuil+lp@free.fr-20070515174032-qzdkangpv29l9e7g
Add a test that check that init connect only once. It fails.

* __init__.py:
(test_suite): Register the new test class.

* test_init.py: 
(InstrumentedTransport): A transport that can track connections.
(TransportHooks): Transport specific hooks.
(TestInit): Iniit command behavior tests.

* ftp.py:
(FtpTransport.__init__): Mark place that need fixing regarding
transport connection sharing

* builtins.py:
(cmd_init.run): Mark places that need fixing regarding transport
connection sharing.

Show diffs side-by-side

added added

removed removed

Lines of Context:
148
148
########################
149
149
 
150
150
command_classes = {'install_scripts': my_install_scripts,
151
 
                   'build': bzr_build}
152
 
from distutils.extension import Extension
 
151
                  'build': bzr_build}
153
152
ext_modules = []
154
153
try:
155
154
    from Pyrex.Distutils import build_ext
156
155
except ImportError:
157
 
    have_pyrex = False
158
156
    # try to build the extension from the prior generated source.
159
 
    print
160
 
    print ("The python package 'Pyrex' is not available."
161
 
           " If the .c files are available,")
162
 
    print ("they will be built,"
163
 
           " but modifying the .pyx files will not rebuild them.")
164
 
    print
 
157
    print ("Pyrex not available, while bzr will build, "
 
158
           "you cannot modify the C extensions.")
165
159
    from distutils.command.build_ext import build_ext
 
160
    from distutils.extension import Extension
 
161
    #ext_modules.append(
 
162
    #    Extension("bzrlib.modulename", ["bzrlib/foo.c"], libraries = []))
166
163
else:
167
 
    have_pyrex = True
168
 
# Override the build_ext if we have Pyrex available
 
164
    from distutils.extension import Extension
 
165
    #ext_modules.append(
 
166
    #    Extension("bzrlib.modulename", ["bzrlib/foo.pyx"], libraries = []))
169
167
command_classes['build_ext'] = build_ext
170
 
unavailable_files = []
171
 
 
172
 
 
173
 
def add_pyrex_extension(module_name, **kwargs):
174
 
    """Add a pyrex module to build.
175
 
 
176
 
    This will use Pyrex to auto-generate the .c file if it is available.
177
 
    Otherwise it will fall back on the .c file. If the .c file is not
178
 
    available, it will warn, and not add anything.
179
 
 
180
 
    You can pass any extra options to Extension through kwargs. One example is
181
 
    'libraries = []'.
182
 
 
183
 
    :param module_name: The python path to the module. This will be used to
184
 
        determine the .pyx and .c files to use.
185
 
    """
186
 
    path = module_name.replace('.', '/')
187
 
    pyrex_name = path + '.pyx'
188
 
    c_name = path + '.c'
189
 
    if have_pyrex:
190
 
        ext_modules.append(Extension(module_name, [pyrex_name]))
191
 
    else:
192
 
        if not os.path.isfile(c_name):
193
 
            unavailable_files.append(c_name)
194
 
        else:
195
 
            ext_modules.append(Extension(module_name, [c_name]))
196
 
 
197
 
 
198
 
add_pyrex_extension('bzrlib._dirstate_helpers_c')
199
 
add_pyrex_extension('bzrlib._knit_load_data_c')
200
 
 
201
 
 
202
 
if unavailable_files:
203
 
    print 'C extension(s) not found:'
204
 
    print '   %s' % ('\n  '.join(unavailable_files),)
205
 
    print 'The python versions will be used instead.'
206
 
    print
207
 
 
208
168
 
209
169
if 'bdist_wininst' in sys.argv:
210
170
    import glob
211
171
    # doc files
212
172
    docs = glob.glob('doc/*.htm') + ['doc/default.css']
213
 
    dev_docs = glob.glob('doc/developers/*.htm')
214
173
    # python's distutils-based win32 installer
215
174
    ARGS = {'scripts': ['bzr', 'tools/win32/bzr-win32-bdist-postinstall.py'],
216
 
            'ext_modules': ext_modules,
217
175
            # help pages
218
 
            'data_files': [('Doc/Bazaar', docs),
219
 
                           ('Doc/Bazaar/developers', dev_docs),
220
 
                          ],
221
 
            # for building pyrex extensions
222
 
            'cmdclass': {'build_ext': build_ext},
 
176
            'data_files': [('Doc/Bazaar', docs)],
223
177
           }
224
178
 
225
179
    ARGS.update(META_INFO)
266
220
        import warnings
267
221
        warnings.warn('Unknown Python version.\n'
268
222
                      'Please check setup.py script for compatibility.')
269
 
    # email package from std python library use lazy import,
270
 
    # so we need to explicitly add all package
271
 
    additional_packages.append('email')
272
223
 
273
224
    options_list = {"py2exe": {"packages": BZRLIB['packages'] +
274
225
                                           additional_packages,
275
 
                               "excludes": ["Tkinter", "medusa", "tools"],
 
226
                               "excludes": ["Tkinter", "medusa"],
276
227
                               "dist_dir": "win32_bzr.exe",
277
228
                              },
278
229
                   }