Use a function for build_exe_options in freeze.py.
This commit is contained in:
parent
42b5ee831e
commit
894ec7d66a
@ -47,22 +47,31 @@ def get_egl_path():
|
|||||||
return os.path.join(distutils.sysconfig.get_python_lib(),
|
return os.path.join(distutils.sysconfig.get_python_lib(),
|
||||||
r'PyQt5\libEGL.dll')
|
r'PyQt5\libEGL.dll')
|
||||||
|
|
||||||
build_exe_options = {
|
|
||||||
'include_files': [
|
def get_build_exe_options(skip_html=False):
|
||||||
('qutebrowser/html', 'html'),
|
include_files = [
|
||||||
('qutebrowser/html/doc', 'html/doc'),
|
|
||||||
('qutebrowser/javascript', 'javascript'),
|
('qutebrowser/javascript', 'javascript'),
|
||||||
('qutebrowser/git-commit-id', 'git-commit-id'),
|
('qutebrowser/git-commit-id', 'git-commit-id'),
|
||||||
],
|
]
|
||||||
|
|
||||||
|
if not skip_html:
|
||||||
|
include_files += [
|
||||||
|
('qutebrowser/html', 'html'),
|
||||||
|
('qutebrowser/html/doc', 'html/doc'),
|
||||||
|
]
|
||||||
|
|
||||||
|
egl_path = get_egl_path()
|
||||||
|
if egl_path is not None:
|
||||||
|
include_files.append((egl_path, 'libEGL.dll'))
|
||||||
|
|
||||||
|
return {
|
||||||
|
'include_files': include_files,
|
||||||
'include_msvcr': True,
|
'include_msvcr': True,
|
||||||
'includes': [],
|
'includes': [],
|
||||||
'excludes': ['tkinter'],
|
'excludes': ['tkinter'],
|
||||||
'packages': ['pygments'],
|
'packages': ['pygments'],
|
||||||
}
|
}
|
||||||
|
|
||||||
egl_path = get_egl_path()
|
|
||||||
if egl_path is not None:
|
|
||||||
build_exe_options['include_files'].append((egl_path, 'libEGL.dll'))
|
|
||||||
|
|
||||||
bdist_msi_options = {
|
bdist_msi_options = {
|
||||||
# random GUID generated by uuid.uuid4()
|
# random GUID generated by uuid.uuid4()
|
||||||
@ -101,7 +110,7 @@ if __name__ == '__main__':
|
|||||||
cx.setup(
|
cx.setup(
|
||||||
executables=[executable],
|
executables=[executable],
|
||||||
options={
|
options={
|
||||||
'build_exe': build_exe_options,
|
'build_exe': get_build_exe_options(),
|
||||||
'bdist_msi': bdist_msi_options,
|
'bdist_msi': bdist_msi_options,
|
||||||
'bdist_mac': bdist_mac_options,
|
'bdist_mac': bdist_mac_options,
|
||||||
'bdist_dmg': bdist_dmg_options,
|
'bdist_dmg': bdist_dmg_options,
|
||||||
|
@ -31,8 +31,7 @@ import cx_Freeze as cx # pylint: disable=import-error
|
|||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
sys.path.insert(0, os.path.join(os.path.dirname(__file__), os.pardir))
|
sys.path.insert(0, os.path.join(os.path.dirname(__file__), os.pardir))
|
||||||
from scripts import setupcommon
|
from scripts import setupcommon, freeze
|
||||||
from scripts.freeze import build_exe_options as normal_build_exe_options
|
|
||||||
|
|
||||||
|
|
||||||
@contextlib.contextmanager
|
@contextlib.contextmanager
|
||||||
@ -49,21 +48,10 @@ def temp_git_commit_file():
|
|||||||
|
|
||||||
def get_build_exe_options():
|
def get_build_exe_options():
|
||||||
"""Get build_exe options with additional includes."""
|
"""Get build_exe options with additional includes."""
|
||||||
opts = dict(normal_build_exe_options)
|
opts = freeze.get_build_exe_options(skip_html=True)
|
||||||
# Remove documentation from include_files.
|
|
||||||
skipped_include_files = [
|
|
||||||
os.path.join('qutebrowser', 'html'),
|
|
||||||
os.path.join('qutebrowser', 'html', 'doc')
|
|
||||||
]
|
|
||||||
include_files = [e for e in normal_build_exe_options['include_files']
|
|
||||||
if e[0] not in skipped_include_files]
|
|
||||||
opts['include_files'] = include_files
|
|
||||||
|
|
||||||
opts['includes'] += pytest.freeze_includes() # pylint: disable=no-member
|
opts['includes'] += pytest.freeze_includes() # pylint: disable=no-member
|
||||||
opts['includes'] += ['unittest.mock', 'PyQt5.QtTest']
|
opts['includes'] += ['unittest.mock', 'PyQt5.QtTest']
|
||||||
|
|
||||||
opts['packages'].append('qutebrowser')
|
opts['packages'].append('qutebrowser')
|
||||||
|
|
||||||
return opts
|
return opts
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user