rearrange spec files
This commit is contained in:
@@ -43,7 +43,7 @@ a = Analysis([r'pyfa.py'],
|
|||||||
binaries=[],
|
binaries=[],
|
||||||
datas=added_files,
|
datas=added_files,
|
||||||
hiddenimports=import_these,
|
hiddenimports=import_these,
|
||||||
hookspath=[],
|
hookspath=['dist_assets/pyinstaller_hooks'],
|
||||||
runtime_hooks=[],
|
runtime_hooks=[],
|
||||||
excludes=[],
|
excludes=[],
|
||||||
win_no_prefer_redirects=False,
|
win_no_prefer_redirects=False,
|
||||||
78
dist_assets/pyinstaller_hooks/hook-matplotlib.backends.py
Normal file
78
dist_assets/pyinstaller_hooks/hook-matplotlib.backends.py
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
# This apes hook-matplotlib.backends.py, but REMOVES backends, all but
|
||||||
|
# the ones in the list below.
|
||||||
|
# Courtesy of https://github.com/bpteague/cytoflow/blob/70f9291/packaging/hook-matplotlib.backends.py
|
||||||
|
|
||||||
|
KEEP = ["WXAgg", "WX", "agg"]
|
||||||
|
|
||||||
|
from PyInstaller.compat import is_darwin
|
||||||
|
from PyInstaller.utils.hooks import (
|
||||||
|
eval_statement, exec_statement, logger)
|
||||||
|
|
||||||
|
|
||||||
|
def get_matplotlib_backend_module_names():
|
||||||
|
"""
|
||||||
|
List the names of all matplotlib backend modules importable under the
|
||||||
|
current Python installation.
|
||||||
|
Returns
|
||||||
|
----------
|
||||||
|
list
|
||||||
|
List of the fully-qualified names of all such modules.
|
||||||
|
"""
|
||||||
|
# Statement safely importing a single backend module.
|
||||||
|
import_statement = """
|
||||||
|
import os, sys
|
||||||
|
# Preserve stdout.
|
||||||
|
sys_stdout = sys.stdout
|
||||||
|
try:
|
||||||
|
# Redirect output printed by this importation to "/dev/null", preventing
|
||||||
|
# such output from being erroneously interpreted as an error.
|
||||||
|
with open(os.devnull, 'w') as dev_null:
|
||||||
|
sys.stdout = dev_null
|
||||||
|
__import__('%s')
|
||||||
|
# If this is an ImportError, print this exception's message without a traceback.
|
||||||
|
# ImportError messages are human-readable and require no additional context.
|
||||||
|
except ImportError as exc:
|
||||||
|
sys.stdout = sys_stdout
|
||||||
|
print(exc)
|
||||||
|
# Else, print this exception preceded by a traceback. traceback.print_exc()
|
||||||
|
# prints to stderr rather than stdout and must not be called here!
|
||||||
|
except Exception:
|
||||||
|
sys.stdout = sys_stdout
|
||||||
|
import traceback
|
||||||
|
print(traceback.format_exc())
|
||||||
|
"""
|
||||||
|
|
||||||
|
# List of the human-readable names of all available backends.
|
||||||
|
backend_names = eval_statement(
|
||||||
|
'import matplotlib; print(matplotlib.rcsetup.all_backends)')
|
||||||
|
|
||||||
|
# List of the fully-qualified names of all importable backend modules.
|
||||||
|
module_names = []
|
||||||
|
|
||||||
|
# If the current system is not OS X and the "CocoaAgg" backend is available,
|
||||||
|
# remove this backend from consideration. Attempting to import this backend
|
||||||
|
# on non-OS X systems halts the current subprocess without printing output
|
||||||
|
# or raising exceptions, preventing its reliable detection.
|
||||||
|
if not is_darwin and 'CocoaAgg' in backend_names:
|
||||||
|
backend_names.remove('CocoaAgg')
|
||||||
|
|
||||||
|
# For safety, attempt to import each backend in a unique subprocess.
|
||||||
|
for backend_name in backend_names:
|
||||||
|
if backend_name in KEEP:
|
||||||
|
continue
|
||||||
|
|
||||||
|
module_name = 'matplotlib.backends.backend_%s' % backend_name.lower()
|
||||||
|
stdout = exec_statement(import_statement % module_name)
|
||||||
|
|
||||||
|
# If no output was printed, this backend is importable.
|
||||||
|
if not stdout:
|
||||||
|
module_names.append(module_name)
|
||||||
|
logger.info(' Matplotlib backend "%s": removed' % backend_name)
|
||||||
|
|
||||||
|
return module_names
|
||||||
|
|
||||||
|
# Freeze all importable backends, as PyInstaller is unable to determine exactly
|
||||||
|
# which backends are required by the current program.
|
||||||
|
e=get_matplotlib_backend_module_names()
|
||||||
|
print(e)
|
||||||
|
excludedimports = e
|
||||||
@@ -1,35 +1,36 @@
|
|||||||
# -*- mode: python -*-
|
# -*- mode: python -*-
|
||||||
|
|
||||||
# Note: This script is provided AS-IS for those that may be interested.
|
|
||||||
# pyfa does not currently support pyInstaller (or any other build process) 100% at the moment
|
|
||||||
|
|
||||||
# Command line to build:
|
|
||||||
# (Run from directory where pyfa.py and pyfa.spec lives.)
|
|
||||||
# c:\Python27\scripts\pyinstaller.exe --clean --noconfirm --windowed --upx-dir=.\scripts\upx.exe pyfa.spec
|
|
||||||
|
|
||||||
# Don't forget to change the path to where your pyfa.py and pyfa.spec lives
|
|
||||||
# pathex=['C:\\Users\\Ebag333\\Documents\\GitHub\\Ebag333\\Pyfa'],
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
from itertools import chain
|
||||||
|
import subprocess
|
||||||
|
import requests.certs
|
||||||
|
|
||||||
|
label = subprocess.check_output([
|
||||||
|
"git", "describe", "--tags"]).strip()
|
||||||
|
|
||||||
|
with open('gitversion', 'w+') as f:
|
||||||
|
f.write(label.decode())
|
||||||
|
|
||||||
block_cipher = None
|
block_cipher = None
|
||||||
|
|
||||||
added_files = [
|
added_files = [
|
||||||
( 'imgs/gui/*.png', 'imgs/gui' ),
|
('../../imgs/gui/*.png', 'imgs/gui'),
|
||||||
( 'imgs/gui/*.gif', 'imgs/gui' ),
|
('../../imgs/gui/*.gif', 'imgs/gui'),
|
||||||
( 'imgs/icons/*.png', 'imgs/icons' ),
|
('../../imgs/icons/*.png', 'imgs/icons'),
|
||||||
( 'imgs/renders/*.png', 'imgs/renders' ),
|
('../../imgs/renders/*.png', 'imgs/renders'),
|
||||||
( 'dist_assets/win/pyfa.ico', '.' ),
|
('../../dist_assets/win/pyfa.ico', '.'),
|
||||||
( 'dist_assets/cacert.pem', '.' ),
|
(requests.certs.where(), '.'), # is this needed anymore?
|
||||||
( 'eve.db', '.' ),
|
('../../eve.db', '.'),
|
||||||
( 'README.md', '.' ),
|
('../../README.md', '.'),
|
||||||
( 'LICENSE', '.' ),
|
('../../LICENSE', '.'),
|
||||||
|
('../../gitversion', '.'),
|
||||||
]
|
]
|
||||||
|
|
||||||
import_these = []
|
import_these = []
|
||||||
|
|
||||||
# Walk eos.effects and add all effects so we can import them properly
|
# Walk directories that do dynamic importing
|
||||||
for root, folders, files in os.walk("eos/effects"):
|
paths = ('eos/effects', 'eos/db/migrations', 'service/conversions')
|
||||||
|
for root, folders, files in chain.from_iterable(os.walk(path) for path in paths):
|
||||||
for file_ in files:
|
for file_ in files:
|
||||||
if file_.endswith(".py") and not file_.startswith("_"):
|
if file_.endswith(".py") and not file_.startswith("_"):
|
||||||
mod_name = "{}.{}".format(
|
mod_name = "{}.{}".format(
|
||||||
@@ -38,36 +39,34 @@ for root, folders, files in os.walk("eos/effects"):
|
|||||||
)
|
)
|
||||||
import_these.append(mod_name)
|
import_these.append(mod_name)
|
||||||
|
|
||||||
a = Analysis(
|
a = Analysis(['../../pyfa.py'],
|
||||||
['pyfa.py'],
|
pathex=[
|
||||||
pathex=['C:\\projects\\pyfa\\'],
|
# Need this, see https://github.com/pyinstaller/pyinstaller/issues/1566
|
||||||
|
# To get this, download and install windows 10 SDK
|
||||||
|
# If not building on Windows 10, this might be optional
|
||||||
|
r'C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x86'],
|
||||||
binaries=[],
|
binaries=[],
|
||||||
datas=added_files,
|
datas=added_files,
|
||||||
hiddenimports=import_these,
|
hiddenimports=import_these,
|
||||||
hookspath=[],
|
hookspath=['dist_assets/pyinstaller_hooks'],
|
||||||
runtime_hooks=[],
|
runtime_hooks=[],
|
||||||
excludes=[],
|
excludes=['Tkinter'],
|
||||||
win_no_prefer_redirects=False,
|
win_no_prefer_redirects=False,
|
||||||
win_private_assemblies=False,
|
win_private_assemblies=False,
|
||||||
cipher=block_cipher,
|
cipher=block_cipher)
|
||||||
)
|
|
||||||
|
|
||||||
pyz = PYZ(
|
pyz = PYZ(a.pure, a.zipped_data,
|
||||||
a.pure,
|
cipher=block_cipher)
|
||||||
a.zipped_data,
|
|
||||||
cipher=block_cipher,
|
|
||||||
)
|
|
||||||
|
|
||||||
exe = EXE(pyz,
|
exe = EXE(pyz,
|
||||||
a.scripts,
|
a.scripts,
|
||||||
exclude_binaries=True,
|
exclude_binaries=True,
|
||||||
debug=False,
|
debug=False,
|
||||||
console=False,
|
console=True,
|
||||||
strip=False,
|
strip=False,
|
||||||
upx=True,
|
upx=True,
|
||||||
name='pyfa',
|
name='pyfa',
|
||||||
icon='dist_assets/win/pyfa.ico',
|
icon='dist_assets/win/pyfa.ico',
|
||||||
onefile=False,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
coll = COLLECT(
|
coll = COLLECT(
|
||||||
@@ -77,7 +76,6 @@ coll = COLLECT(
|
|||||||
a.datas,
|
a.datas,
|
||||||
strip=False,
|
strip=False,
|
||||||
upx=True,
|
upx=True,
|
||||||
onefile=False,
|
|
||||||
name='pyfa',
|
name='pyfa',
|
||||||
icon='dist_assets/win/pyfa.ico',
|
icon='dist_assets/win/pyfa.ico',
|
||||||
)
|
)
|
||||||
@@ -1,78 +0,0 @@
|
|||||||
# -*- mode: python -*-
|
|
||||||
|
|
||||||
import os
|
|
||||||
from itertools import chain
|
|
||||||
import subprocess
|
|
||||||
|
|
||||||
label = subprocess.check_output([
|
|
||||||
"git", "describe", "--tags"]).strip()
|
|
||||||
|
|
||||||
with open('gitversion', 'w+') as f:
|
|
||||||
f.write(label.decode())
|
|
||||||
|
|
||||||
block_cipher = None
|
|
||||||
|
|
||||||
added_files = [
|
|
||||||
( 'imgs/gui/*.png', 'imgs/gui' ),
|
|
||||||
( 'imgs/gui/*.gif', 'imgs/gui' ),
|
|
||||||
( 'imgs/icons/*.png', 'imgs/icons' ),
|
|
||||||
( 'imgs/renders/*.png', 'imgs/renders' ),
|
|
||||||
( 'dist_assets/win/pyfa.ico', '.' ),
|
|
||||||
( 'dist_assets/cacert.pem', '.' ),
|
|
||||||
( 'eve.db', '.' ),
|
|
||||||
( 'README.md', '.' ),
|
|
||||||
( 'LICENSE', '.' ),
|
|
||||||
( 'gitversion', '.' ),
|
|
||||||
]
|
|
||||||
|
|
||||||
import_these = []
|
|
||||||
|
|
||||||
# Walk directories that do dynamic importing
|
|
||||||
paths = ('eos/effects', 'eos/db/migrations', 'service/conversions')
|
|
||||||
for root, folders, files in chain.from_iterable(os.walk(path) for path in paths):
|
|
||||||
for file_ in files:
|
|
||||||
if file_.endswith(".py") and not file_.startswith("_"):
|
|
||||||
mod_name = "{}.{}".format(
|
|
||||||
root.replace("/", "."),
|
|
||||||
file_.split(".py")[0],
|
|
||||||
)
|
|
||||||
import_these.append(mod_name)
|
|
||||||
|
|
||||||
a = Analysis([r'C:\Users\Ryan\Sync\Git\blitzmann\Pyfa\pyfa.py'],
|
|
||||||
pathex=[
|
|
||||||
# Need this, see https://github.com/pyinstaller/pyinstaller/issues/1566
|
|
||||||
# To get this, download and install windows 10 SDK
|
|
||||||
# If not building on Windows 10, this might be optional
|
|
||||||
r'C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x86'],
|
|
||||||
binaries=[],
|
|
||||||
datas=added_files,
|
|
||||||
hiddenimports=import_these,
|
|
||||||
hookspath=[],
|
|
||||||
runtime_hooks=[],
|
|
||||||
excludes=[],
|
|
||||||
win_no_prefer_redirects=False,
|
|
||||||
win_private_assemblies=False,
|
|
||||||
cipher=block_cipher)
|
|
||||||
pyz = PYZ(a.pure, a.zipped_data,
|
|
||||||
cipher=block_cipher)
|
|
||||||
exe = EXE(pyz,
|
|
||||||
a.scripts,
|
|
||||||
exclude_binaries=True,
|
|
||||||
debug=False,
|
|
||||||
console=True,
|
|
||||||
strip=False,
|
|
||||||
upx=True,
|
|
||||||
name='pyfa',
|
|
||||||
icon='dist_assets/win/pyfa.ico',
|
|
||||||
)
|
|
||||||
|
|
||||||
coll = COLLECT(
|
|
||||||
exe,
|
|
||||||
a.binaries,
|
|
||||||
a.zipfiles,
|
|
||||||
a.datas,
|
|
||||||
strip=False,
|
|
||||||
upx=True,
|
|
||||||
name='pyfa',
|
|
||||||
icon='dist_assets/win/pyfa.ico',
|
|
||||||
)
|
|
||||||
Reference in New Issue
Block a user