Add more excludes to specfile, don't mass-include all source files, only the ones that aren't imported internally
This commit is contained in:
parent
c7cfcd73b8
commit
e9feb01a43
44
mcedit2.spec
44
mcedit2.spec
@ -11,11 +11,9 @@ try:
|
||||
except ImportError:
|
||||
from PyInstaller.hooks.hookutils import collect_data_files
|
||||
|
||||
# Grab every .py file under src/mcedit2 and src/mceditlib because some modules are made
|
||||
# available for plugins and not directly used by MCEdit.
|
||||
everything = []
|
||||
for root, dirnames, filenames in itertools.chain(os.walk(os.path.join('src', 'mcedit2')),
|
||||
os.walk(os.path.join('src', 'mceditlib'))):
|
||||
# Files under mcedit2.synth are used only by plugins and not internally. (just import them?)
|
||||
support_modules = []
|
||||
for root, dirnames, filenames in itertools.chain(os.walk(os.path.join('src', 'mcedit2', 'synth'))):
|
||||
for filename in fnmatch.filter(filenames, '*.py'):
|
||||
if filename == "__init__.py":
|
||||
filepath = root
|
||||
@ -30,14 +28,15 @@ for root, dirnames, filenames in itertools.chain(os.walk(os.path.join('src', 'mc
|
||||
continue
|
||||
|
||||
modulename = ".".join(components) # dotted modulename
|
||||
everything.append(modulename)
|
||||
support_modules.append(modulename)
|
||||
|
||||
a = Analysis(['src/mcedit2/main.py'],
|
||||
hiddenimports=['PySide.QtXml', 'zmq'] + everything,
|
||||
hiddenimports=['PySide.QtXml'] + support_modules,
|
||||
hookspath=['.'],
|
||||
runtime_hooks=None,
|
||||
excludes=['Tkinter', 'Tcl', 'Tk', 'wx',
|
||||
'IPython.sphinxext', 'IPython.nbconvert',
|
||||
'IPython.nbformat',
|
||||
'IPython.lib.editorhooks', 'IPython.core.tests',
|
||||
'IPython.extensions.cythonmagic',
|
||||
'jinja2',
|
||||
@ -82,20 +81,35 @@ pyz = PYZ(a.pure)
|
||||
|
||||
onefile = True
|
||||
|
||||
# Remove IPython html assets, saving 1.5MB.
|
||||
# Disables using the embedded IPython for notebooks
|
||||
# Anyone who wants this can run from source!
|
||||
def ipy_filter(filename):
|
||||
def data_filter(filename):
|
||||
return not (
|
||||
# Remove IPython html assets, saving 1.5MB.
|
||||
# Disables using the embedded IPython for notebooks
|
||||
# Anyone who wants this can run from source!
|
||||
filename.startswith("IPython\\html") or
|
||||
filename.startswith("IPython\\nbconvert") or
|
||||
filename.startswith("IPython\\nbformat") or
|
||||
filename.startswith("IPython\\testing")
|
||||
filename.startswith("IPython\\testing") or
|
||||
# pywin32 manual (?)
|
||||
"win32com\\html" in filename or
|
||||
"win32com\\demos" in filename or
|
||||
"win32comext\\axscript\\demos" in filename or
|
||||
"pywin32.chm" in filename or
|
||||
# qt3 support
|
||||
"qt3support4.dll" in filename or
|
||||
# mcedit egg-infos
|
||||
"mcedit2.egg-info" in filename or
|
||||
"mceditlib.egg-info" in filename
|
||||
|
||||
)
|
||||
|
||||
a.datas = [(filename, path, filetype)
|
||||
for filename, path, filetype in a.datas
|
||||
if ipy_filter(filename)]
|
||||
def apply_filter(toc):
|
||||
return [(filename, path, filetype)
|
||||
for filename, path, filetype in toc
|
||||
if data_filter(filename)]
|
||||
|
||||
a.datas = apply_filter(a.datas)
|
||||
a.binaries = apply_filter(a.binaries)
|
||||
|
||||
if onefile:
|
||||
a.scripts += a.binaries + a.zipfiles + a.datas + a.zipped_data
|
||||
|
Reference in New Issue
Block a user