mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-01-19 03:06:33 +00:00
Merge PR482: fix PyInstaller generation
This commit is contained in:
commit
ba835b1414
@ -15,17 +15,6 @@ if not hasattr(sys, 'real_prefix'):
|
||||
sys.exit("Please run inside a virtualenv with Tahoe-LAFS installed.")
|
||||
|
||||
|
||||
# Ugly hack to disable the setuptools requirement asserted in '_auto_deps.py'.
|
||||
# Without patching out this requirement, frozen binaries will fail at runtime.
|
||||
autodeps_path = os.path.join(get_python_lib(), 'allmydata', '_auto_deps.py')
|
||||
print("Patching '{}' to remove setuptools check...".format(autodeps_path))
|
||||
autodeps_path_backup = autodeps_path + '.backup'
|
||||
shutil.copy2(autodeps_path, autodeps_path_backup)
|
||||
with open(autodeps_path_backup) as src, open(autodeps_path, 'w+') as dest:
|
||||
dest.write(src.read().replace('"setuptools >=', '#"setuptools >='))
|
||||
print("Done!")
|
||||
|
||||
|
||||
options = [('u', None, 'OPTION')] # Unbuffered stdio
|
||||
|
||||
added_files = [
|
||||
@ -37,12 +26,25 @@ added_files = [
|
||||
('src/allmydata/web/static/css/*', 'allmydata/web/static/css'),
|
||||
('src/allmydata/web/static/img/*.png', 'allmydata/web/static/img')]
|
||||
|
||||
hidden_imports = [
|
||||
'allmydata.client',
|
||||
'allmydata.introducer',
|
||||
'allmydata.stats',
|
||||
'cffi',
|
||||
'characteristic',
|
||||
'Crypto',
|
||||
'packaging.specifiers',
|
||||
'six.moves.html_parser',
|
||||
'yaml',
|
||||
'zfec'
|
||||
]
|
||||
|
||||
a = Analysis(
|
||||
['static/tahoe.py'],
|
||||
pathex=[],
|
||||
binaries=None,
|
||||
datas=added_files,
|
||||
hiddenimports=['characteristic', 'cffi'],
|
||||
hiddenimports=hidden_imports,
|
||||
hookspath=[],
|
||||
runtime_hooks=[],
|
||||
excludes=[],
|
||||
@ -76,10 +78,6 @@ coll = COLLECT(
|
||||
name='Tahoe-LAFS')
|
||||
|
||||
|
||||
# Revert the '_auto_deps.py' patch above
|
||||
shutil.move(autodeps_path_backup, autodeps_path)
|
||||
|
||||
|
||||
print("Creating archive...")
|
||||
platform_tag = platform.system().replace('Darwin', 'MacOS')
|
||||
bitness_tag = str(struct.calcsize('P') * 8) + 'bit'
|
||||
|
@ -123,6 +123,8 @@ package_imports = [
|
||||
('enum34', 'enum'),
|
||||
('pycparser', 'pycparser'),
|
||||
('PyYAML', 'yaml'),
|
||||
('magic-wormhole', 'wormhole'),
|
||||
('setuptools', 'setuptools')
|
||||
]
|
||||
|
||||
# Dependencies for which we don't know how to get a version number at run-time.
|
||||
@ -141,14 +143,6 @@ ignorable = [
|
||||
'twisted-conch',
|
||||
]
|
||||
|
||||
import sys
|
||||
|
||||
# Don't try to get the version number of setuptools in frozen builds, because
|
||||
# that triggers 'site' processing that causes failures. Note that frozen
|
||||
# builds still (unfortunately) import pkg_resources in .tac files, so the
|
||||
# entry for setuptools in install_requires above isn't conditional.
|
||||
if not hasattr(sys, 'frozen'):
|
||||
package_imports.append(('setuptools', 'setuptools'))
|
||||
|
||||
setup_requires = [
|
||||
'setuptools >= 28.8.0', # for PEP-440 style versions
|
||||
|
@ -104,7 +104,7 @@ def start(config):
|
||||
# "pretty fast" and with a zero return-code, or else something
|
||||
# Very Bad has happened.
|
||||
try:
|
||||
args = [sys.executable]
|
||||
args = [sys.executable] if not getattr(sys, 'frozen', False) else []
|
||||
for i, arg in enumerate(sys.argv):
|
||||
if arg in ['start', 'restart']:
|
||||
args.append('daemonize')
|
||||
|
7
tox.ini
7
tox.ini
@ -102,14 +102,9 @@ commands =
|
||||
sphinx-build -b html -d {toxinidir}/docs/_build/doctrees {toxinidir}/docs {toxinidir}/docs/_build/html
|
||||
|
||||
[testenv:pyinstaller]
|
||||
# Do not use the '--editable' flag for this testenv as the 'pyinstaller.spec'
|
||||
# script called below will need patch the source tree at build-time in order
|
||||
# to remove the setuptools requirement from '_auto_deps.py' (and we want to
|
||||
# avoid race-conditions when running tests in parallel, e.g., with "detox").
|
||||
usedevelop = False
|
||||
extras =
|
||||
deps =
|
||||
.
|
||||
packaging
|
||||
pyinstaller
|
||||
# Setting PYTHONHASHSEED to a known value assists with reproducible builds.
|
||||
# See https://pyinstaller.readthedocs.io/en/stable/advanced-topics.html#creating-a-reproducible-build
|
||||
|
Loading…
Reference in New Issue
Block a user