/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: John Arbash Meinel
  • Date: 2008-03-14 10:55:37 UTC
  • mfrom: (3275 +trunk)
  • mto: This revision was merged to the branch mainline in revision 3281.
  • Revision ID: john@arbash-meinel.com-20080314105537-v9h2ue0uxvs1dyn6
[merge] bzr.dev 3275

Show diffs side-by-side

added added

removed removed

Lines of Context:
9
9
import os
10
10
import sys
11
11
 
 
12
if sys.version_info < (2, 4):
 
13
    sys.stderr.write("[ERROR] Not a supported Python version. Need 2.4+\n")
 
14
    sys.exit(1)
 
15
 
12
16
import bzrlib
13
17
 
14
18
##
34
38
                                       ]},
35
39
           }
36
40
 
37
 
######################################################################
38
 
# Reinvocation stolen from bzr, we need python2.4 by virtue of bzr_man
39
 
# including bzrlib.help
40
 
 
41
 
try:
42
 
    version_info = sys.version_info
43
 
except AttributeError:
44
 
    version_info = 1, 5 # 1.5 or older
45
 
 
46
 
REINVOKE = "__BZR_REINVOKE"
47
 
NEED_VERS = (2, 4)
48
 
KNOWN_PYTHONS = ('python2.4',)
49
 
 
50
 
if version_info < NEED_VERS:
51
 
    if not os.environ.has_key(REINVOKE):
52
 
        # mutating os.environ doesn't work in old Pythons
53
 
        os.putenv(REINVOKE, "1")
54
 
        for python in KNOWN_PYTHONS:
55
 
            try:
56
 
                os.execvp(python, [python] + sys.argv)
57
 
            except OSError:
58
 
                pass
59
 
    sys.stderr.write("bzr: error: cannot find a suitable python interpreter\n")
60
 
    sys.stderr.write("  (need %d.%d or later)" % NEED_VERS)
61
 
    sys.stderr.write('\n')
62
 
    sys.exit(1)
63
 
if getattr(os, "unsetenv", None) is not None:
64
 
    os.unsetenv(REINVOKE)
65
 
 
66
41
 
67
42
def get_bzrlib_packages():
68
43
    """Recurse through the bzrlib directory, and extract the package names"""
265
240
    setup(**ARGS)
266
241
 
267
242
elif 'py2exe' in sys.argv:
 
243
    import glob
268
244
    # py2exe setup
269
245
    import py2exe
270
246
 
292
268
                                     comments = META_INFO['description'],
293
269
                                    )
294
270
 
295
 
    additional_packages =  []
 
271
    packages = BZRLIB['packages']
 
272
    packages.remove('bzrlib')
 
273
    packages = [i for i in packages if not i.startswith('bzrlib.plugins')]
 
274
    includes = []
 
275
    for i in glob.glob('bzrlib\\*.py'):
 
276
        module = i[:-3].replace('\\', '.')
 
277
        if module.endswith('__init__'):
 
278
            module = module[:-len('__init__')]
 
279
        includes.append(module)
 
280
 
 
281
    additional_packages = set()
296
282
    if sys.version.startswith('2.4'):
297
283
        # adding elementtree package
298
 
        additional_packages.append('elementtree')
 
284
        additional_packages.add('elementtree')
299
285
    elif sys.version.startswith('2.5'):
300
 
        additional_packages.append('xml.etree')
 
286
        additional_packages.add('xml.etree')
301
287
    else:
302
288
        import warnings
303
289
        warnings.warn('Unknown Python version.\n'
304
290
                      'Please check setup.py script for compatibility.')
305
291
    # email package from std python library use lazy import,
306
292
    # so we need to explicitly add all package
307
 
    additional_packages.append('email')
 
293
    additional_packages.add('email')
308
294
 
309
295
    # text files for help topis
310
 
    import glob
311
296
    text_topics = glob.glob('bzrlib/help_topics/en/*.txt')
312
 
 
313
 
    options_list = {"py2exe": {"packages": BZRLIB['packages'] +
314
 
                                           additional_packages,
 
297
    topics_files = [('lib/help_topics/en', text_topics)]
 
298
 
 
299
    # built-in plugins
 
300
    plugins_files = []
 
301
    for root, dirs, files in os.walk('bzrlib/plugins'):
 
302
        x = []
 
303
        for i in files:
 
304
            if not i.endswith('.py'):
 
305
                continue
 
306
            if i == '__init__.py' and root == 'bzrlib/plugins':
 
307
                continue
 
308
            x.append(os.path.join(root, i))
 
309
        if x:
 
310
            target_dir = root[len('bzrlib/'):]  # install to 'plugins/...'
 
311
            plugins_files.append((target_dir, x))
 
312
    # find modules for built-in plugins
 
313
    import tools.package_mf
 
314
    mf = tools.package_mf.CustomModuleFinder()
 
315
    mf.run_package('bzrlib/plugins')
 
316
    packs, mods = mf.get_result()
 
317
    additional_packages.update(packs)
 
318
 
 
319
    options_list = {"py2exe": {"packages": packages + list(additional_packages),
 
320
                               "includes": includes + mods,
315
321
                               "excludes": ["Tkinter", "medusa", "tools"],
316
322
                               "dist_dir": "win32_bzr.exe",
317
323
                              },
321
327
                   'tools/win32/bzr_postinstall.py',
322
328
                  ],
323
329
          zipfile='lib/library.zip',
324
 
          data_files=[('lib/help_topics/en', text_topics)],
 
330
          data_files=topics_files + plugins_files,
325
331
          )
326
332
 
327
333
else: