13
if sys.version_info < (2, 4):
14
sys.stderr.write("[ERROR] Not a supported Python version. Need 2.4+\n")
13
17
# NOTE: The directory containing setup.py, whether run by 'python setup.py' or
14
18
# './setup.py' or the equivalent with another path, should always be at the
15
19
# start of the path, so this should find the right one...
67
######################################################################
68
# Reinvocation stolen from bzr, we need python2.4 by virtue of bzr_man
69
# including bzrlib.help
72
version_info = sys.version_info
73
except AttributeError:
74
version_info = 1, 5 # 1.5 or older
76
REINVOKE = "__BZR_REINVOKE"
78
KNOWN_PYTHONS = ('python2.4',)
80
if version_info < NEED_VERS:
81
if not os.environ.has_key(REINVOKE):
82
# mutating os.environ doesn't work in old Pythons
83
os.putenv(REINVOKE, "1")
84
for python in KNOWN_PYTHONS:
86
os.execvp(python, [python] + sys.argv)
89
sys.stderr.write("bzr: error: cannot find a suitable python interpreter\n")
90
sys.stderr.write(" (need %d.%d or later)" % NEED_VERS)
91
sys.stderr.write('\n')
93
if getattr(os, "unsetenv", None) is not None:
97
72
def get_bzrlib_packages():
98
73
"""Recurse through the bzrlib directory, and extract the package names"""
267
242
for root, dirs, files in os.walk('doc'):
270
if os.path.splitext(f)[1] in ('.html','.css','.png','.pdf'):
245
if (os.path.splitext(f)[1] in ('.html','.css','.png','.pdf')
246
or f == 'quick-start-summary.svg'):
271
247
r.append(os.path.join(root, f))
273
249
relative = root[4:]
321
298
comments = META_INFO['description'],
324
additional_packages = []
301
packages = BZRLIB['packages']
302
packages.remove('bzrlib')
303
packages = [i for i in packages if not i.startswith('bzrlib.plugins')]
305
for i in glob.glob('bzrlib\\*.py'):
306
module = i[:-3].replace('\\', '.')
307
if module.endswith('__init__'):
308
module = module[:-len('__init__')]
309
includes.append(module)
311
additional_packages = set()
325
312
if sys.version.startswith('2.4'):
326
313
# adding elementtree package
327
additional_packages.append('elementtree')
314
additional_packages.add('elementtree')
328
315
elif sys.version.startswith('2.5'):
329
additional_packages.append('xml.etree')
316
additional_packages.add('xml.etree')
332
319
warnings.warn('Unknown Python version.\n'
333
320
'Please check setup.py script for compatibility.')
334
321
# email package from std python library use lazy import,
335
322
# so we need to explicitly add all package
336
additional_packages.append('email')
323
additional_packages.add('email')
338
325
# text files for help topis
340
326
text_topics = glob.glob('bzrlib/help_topics/en/*.txt')
342
options_list = {"py2exe": {"packages": BZRLIB['packages'] +
327
topics_files = [('lib/help_topics/en', text_topics)]
331
for root, dirs, files in os.walk('bzrlib/plugins'):
334
if not i.endswith('.py'):
336
if i == '__init__.py' and root == 'bzrlib/plugins':
338
x.append(os.path.join(root, i))
340
target_dir = root[len('bzrlib/'):] # install to 'plugins/...'
341
plugins_files.append((target_dir, x))
342
# find modules for built-in plugins
343
import tools.package_mf
344
mf = tools.package_mf.CustomModuleFinder()
345
mf.run_package('bzrlib/plugins')
346
packs, mods = mf.get_result()
347
additional_packages.update(packs)
349
options_list = {"py2exe": {"packages": packages + list(additional_packages),
350
"includes": includes + mods,
344
351
"excludes": ["Tkinter", "medusa", "tools"],
345
352
"dist_dir": "win32_bzr.exe",