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:
|
except ImportError:
|
||||||
from PyInstaller.hooks.hookutils import collect_data_files
|
from PyInstaller.hooks.hookutils import collect_data_files
|
||||||
|
|
||||||
# Grab every .py file under src/mcedit2 and src/mceditlib because some modules are made
|
# Files under mcedit2.synth are used only by plugins and not internally. (just import them?)
|
||||||
# available for plugins and not directly used by MCEdit.
|
support_modules = []
|
||||||
everything = []
|
for root, dirnames, filenames in itertools.chain(os.walk(os.path.join('src', 'mcedit2', 'synth'))):
|
||||||
for root, dirnames, filenames in itertools.chain(os.walk(os.path.join('src', 'mcedit2')),
|
|
||||||
os.walk(os.path.join('src', 'mceditlib'))):
|
|
||||||
for filename in fnmatch.filter(filenames, '*.py'):
|
for filename in fnmatch.filter(filenames, '*.py'):
|
||||||
if filename == "__init__.py":
|
if filename == "__init__.py":
|
||||||
filepath = root
|
filepath = root
|
||||||
@ -30,14 +28,15 @@ for root, dirnames, filenames in itertools.chain(os.walk(os.path.join('src', 'mc
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
modulename = ".".join(components) # dotted modulename
|
modulename = ".".join(components) # dotted modulename
|
||||||
everything.append(modulename)
|
support_modules.append(modulename)
|
||||||
|
|
||||||
a = Analysis(['src/mcedit2/main.py'],
|
a = Analysis(['src/mcedit2/main.py'],
|
||||||
hiddenimports=['PySide.QtXml', 'zmq'] + everything,
|
hiddenimports=['PySide.QtXml'] + support_modules,
|
||||||
hookspath=['.'],
|
hookspath=['.'],
|
||||||
runtime_hooks=None,
|
runtime_hooks=None,
|
||||||
excludes=['Tkinter', 'Tcl', 'Tk', 'wx',
|
excludes=['Tkinter', 'Tcl', 'Tk', 'wx',
|
||||||
'IPython.sphinxext', 'IPython.nbconvert',
|
'IPython.sphinxext', 'IPython.nbconvert',
|
||||||
|
'IPython.nbformat',
|
||||||
'IPython.lib.editorhooks', 'IPython.core.tests',
|
'IPython.lib.editorhooks', 'IPython.core.tests',
|
||||||
'IPython.extensions.cythonmagic',
|
'IPython.extensions.cythonmagic',
|
||||||
'jinja2',
|
'jinja2',
|
||||||
@ -82,20 +81,35 @@ pyz = PYZ(a.pure)
|
|||||||
|
|
||||||
onefile = True
|
onefile = True
|
||||||
|
|
||||||
# Remove IPython html assets, saving 1.5MB.
|
def data_filter(filename):
|
||||||
# Disables using the embedded IPython for notebooks
|
|
||||||
# Anyone who wants this can run from source!
|
|
||||||
def ipy_filter(filename):
|
|
||||||
return not (
|
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\\html") or
|
||||||
filename.startswith("IPython\\nbconvert") or
|
filename.startswith("IPython\\nbconvert") or
|
||||||
filename.startswith("IPython\\nbformat") 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)
|
def apply_filter(toc):
|
||||||
for filename, path, filetype in a.datas
|
return [(filename, path, filetype)
|
||||||
if ipy_filter(filename)]
|
for filename, path, filetype in toc
|
||||||
|
if data_filter(filename)]
|
||||||
|
|
||||||
|
a.datas = apply_filter(a.datas)
|
||||||
|
a.binaries = apply_filter(a.binaries)
|
||||||
|
|
||||||
if onefile:
|
if onefile:
|
||||||
a.scripts += a.binaries + a.zipfiles + a.datas + a.zipped_data
|
a.scripts += a.binaries + a.zipfiles + a.datas + a.zipped_data
|
||||||
|
Reference in New Issue
Block a user