mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2024-12-23 14:52:26 +00:00
3cb08209d2
this resolves problems of py2exe's modulefinder collection of sources from .zipped egg files, not by using easy_install to reach the --always-unzip option, but rather with a small tool which unpacks any zipped egg files found in misc/dependencies. this fixes the py2exe build given rollback of the easy_install stuff which had broken the unix builds. misc/hatch-eggs.py performs the honours. this also includes a misc/sub-ver.py tool which substitutes elements of the verion number for the current code base (by importing allmydata.__version__ hence make-version should be run first, and the python path carefully managed) into template files using python's string interpolation of named args from a dict as the templating syntax. i.e. %(major)d %(minor)d %(point)d %(nano)d each expand to the individual components of the version number as codified by the pyutil.version_class.Version class. there is also a %(build)s tag which expands to the string form of the whole version number. This tool is used to interpolate the automatically generated version information into the innosetup source file in a form consistent with innosetup/windows' restrictions
42 lines
1.2 KiB
Python
42 lines
1.2 KiB
Python
#! /usr/bin/python
|
|
|
|
import os.path
|
|
import sys
|
|
import zipfile
|
|
|
|
path = []
|
|
if sys.platform == 'win32':
|
|
support_lib = "support/Lib/site-packages"
|
|
else:
|
|
pyver = "python%d.%d" % (sys.version_info[:2])
|
|
support_lib = "support/lib/%s/site-packages" % pyver
|
|
|
|
if os.path.exists(support_lib):
|
|
for fn in os.listdir(support_lib):
|
|
if fn.endswith(".egg"):
|
|
path.append(os.path.abspath(os.path.join(support_lib, fn)))
|
|
|
|
# We also need to include .egg's in the CWD, because if there is an .egg there
|
|
# then "make build-deps" will take that as satisfying its requirements.
|
|
for fn in os.listdir("."):
|
|
if fn.endswith(".egg"):
|
|
path.append(os.path.abspath(os.path.join(os.getcwd(), fn)))
|
|
|
|
for eggpath in path:
|
|
if os.path.isfile(eggpath):
|
|
bak = eggpath + '.bak'
|
|
os.rename(eggpath, bak)
|
|
os.mkdir(eggpath)
|
|
zf = zipfile.ZipFile(bak, 'r')
|
|
print bak
|
|
for name in zf.namelist():
|
|
dirname = os.path.join(eggpath, os.path.dirname(name))
|
|
if not os.path.isdir(dirname):
|
|
print 'creating', dirname
|
|
os.makedirs(dirname)
|
|
print name
|
|
f = file(os.path.join(eggpath, name), 'wb')
|
|
f.write(zf.read(name))
|
|
f.close()
|
|
|