Remove legacy cx_Freeze code
This also removes frozen tests for now. They should be readded at some point...
This commit is contained in:
parent
e955540f71
commit
9898d80625
@ -6,10 +6,8 @@ build: off
|
||||
environment:
|
||||
PYTHONUNBUFFERED: 1
|
||||
matrix:
|
||||
- TESTENV: py34
|
||||
- TESTENV: py36-pyqt58
|
||||
PYTHON: C:\Python36\python.exe
|
||||
- TESTENV: unittests-frozen
|
||||
- TESTENV: pylint
|
||||
|
||||
install:
|
||||
|
@ -220,7 +220,7 @@ Documentation of used Python libraries:
|
||||
* http://pygments.org/docs/[pygments]
|
||||
* http://fdik.org/pyPEG/index.html[pyPEG2]
|
||||
* http://pythonhosted.org/setuptools/[setuptools]
|
||||
* http://cx-freeze.readthedocs.org/en/latest/overview.html[cx_Freeze]
|
||||
* http://www.pyinstaller.org/[PyInstaller]
|
||||
* https://pypi.python.org/pypi/colorama[colorama]
|
||||
|
||||
Related RFCs and standards:
|
||||
|
@ -1,3 +0,0 @@
|
||||
# This file is automatically generated by scripts/dev/recompile_requirements.py
|
||||
|
||||
cx-Freeze==4.3.4 # rq.filter: < 5.0.0
|
@ -1,5 +0,0 @@
|
||||
cx-Freeze < 5.0.0
|
||||
|
||||
# We'll probably switch to PyInstaller soon, and 5.x doesn't install without a
|
||||
# compiler?
|
||||
#@ filter: cx-Freeze < 5.0.0
|
@ -162,13 +162,7 @@ def debug_flag_error(flag):
|
||||
|
||||
def main():
|
||||
parser = get_argparser()
|
||||
if sys.platform == 'darwin' and getattr(sys, 'frozen', False):
|
||||
# Ignore Mac OS X' idiotic -psn_* argument...
|
||||
# http://stackoverflow.com/questions/19661298/
|
||||
# http://sourceforge.net/p/cx-freeze/mailman/message/31041783/
|
||||
argv = [arg for arg in sys.argv[1:] if not arg.startswith('-psn_0_')]
|
||||
else:
|
||||
argv = sys.argv[1:]
|
||||
argv = sys.argv[1:]
|
||||
args = parser.parse_args(argv)
|
||||
if args.json_args is not None:
|
||||
# Restoring after a restart.
|
||||
|
@ -134,7 +134,8 @@ def read_file(filename, binary=False):
|
||||
The file contents as string.
|
||||
"""
|
||||
if hasattr(sys, 'frozen'):
|
||||
# cx_Freeze doesn't support pkg_resources :(
|
||||
# PyInstaller doesn't support pkg_resources :(
|
||||
# https://github.com/pyinstaller/pyinstaller/wiki/FAQ#misc
|
||||
fn = os.path.join(os.path.dirname(sys.executable), filename)
|
||||
if binary:
|
||||
with open(fn, 'rb') as f:
|
||||
|
@ -28,16 +28,7 @@ CI machines.
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import os
|
||||
import time
|
||||
import subprocess
|
||||
import urllib
|
||||
|
||||
|
||||
def check_setup(executable):
|
||||
subprocess.check_call([executable, '-c', 'import PyQt5'])
|
||||
subprocess.check_call([executable, '-c', 'import sip'])
|
||||
subprocess.check_call([executable, '--version'])
|
||||
|
||||
|
||||
def pip_install(pkg):
|
||||
@ -48,28 +39,3 @@ def pip_install(pkg):
|
||||
print("Installing tox")
|
||||
pip_install('pip')
|
||||
pip_install(r'-rmisc\requirements\requirements-tox.txt')
|
||||
|
||||
print("Linking Python...")
|
||||
with open(r'C:\Windows\system32\python3.bat', 'w') as f:
|
||||
f.write(r'@C:\Python34\python %*')
|
||||
|
||||
|
||||
if '-pyqt' not in os.environ['TESTENV']:
|
||||
print("Getting PyQt5...")
|
||||
qt_version = '5.5.1'
|
||||
pyqt_version = '5.5.1'
|
||||
pyqt_url = ('https://www.qutebrowser.org/pyqt/'
|
||||
'PyQt5-{}-gpl-Py3.4-Qt{}-x32.exe'.format(
|
||||
pyqt_version, qt_version))
|
||||
|
||||
try:
|
||||
urllib.urlretrieve(pyqt_url, r'C:\install-PyQt5.exe')
|
||||
except (OSError, IOError):
|
||||
print("Downloading PyQt failed, trying again in 10 seconds...")
|
||||
time.sleep(10)
|
||||
urllib.urlretrieve(pyqt_url, r'C:\install-PyQt5.exe')
|
||||
|
||||
print("Installing PyQt5...")
|
||||
subprocess.check_call([r'C:\install-PyQt5.exe', '/S'])
|
||||
|
||||
check_setup(r'C:\Python34\python')
|
||||
|
@ -18,7 +18,7 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
"""Script to clean up the mess made by Python/setuptools/cx_Freeze."""
|
||||
"""Script to clean up the mess made by Python/setuptools/PyInstaller."""
|
||||
|
||||
import os
|
||||
import os.path
|
||||
|
@ -1,145 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
|
||||
|
||||
# Copyright 2014-2017 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
|
||||
#
|
||||
# This file is part of qutebrowser.
|
||||
#
|
||||
# qutebrowser is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# qutebrowser is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
"""cx_Freeze script for qutebrowser.
|
||||
|
||||
Builds a standalone executable.
|
||||
"""
|
||||
|
||||
|
||||
import os
|
||||
import os.path
|
||||
import sys
|
||||
import distutils
|
||||
|
||||
import cx_Freeze as cx # pylint: disable=import-error,useless-suppression
|
||||
# cx_Freeze is hard to install (needs C extensions) so we don't check for it.
|
||||
|
||||
sys.path.insert(0, os.path.join(os.path.dirname(__file__), os.pardir,
|
||||
os.pardir))
|
||||
from scripts import setupcommon
|
||||
|
||||
|
||||
BASEDIR = os.path.join(os.path.dirname(os.path.realpath(__file__)),
|
||||
os.path.pardir, os.path.pardir)
|
||||
|
||||
|
||||
def get_egl_path():
|
||||
"""Get the path for PyQt5's libEGL.dll."""
|
||||
if not sys.platform.startswith('win'):
|
||||
return None
|
||||
return os.path.join(distutils.sysconfig.get_python_lib(),
|
||||
r'PyQt5\libEGL.dll')
|
||||
|
||||
|
||||
def get_plugin_folders():
|
||||
"""Get the plugin folders to copy to the output."""
|
||||
if not sys.platform.startswith('win'):
|
||||
return []
|
||||
plugin_dir = os.path.join(distutils.sysconfig.get_python_lib(),
|
||||
'PyQt5', 'plugins')
|
||||
folders = ['audio', 'iconengines', 'mediaservice', 'printsupport']
|
||||
return [os.path.join(plugin_dir, folder) for folder in folders]
|
||||
|
||||
|
||||
def get_build_exe_options(skip_html=False):
|
||||
"""Get the options passed as build_exe_options to cx_Freeze.
|
||||
|
||||
If either skip_html or --qute-skip-html as argument is given, doesn't
|
||||
freeze the documentation.
|
||||
"""
|
||||
if '--qute-skip-html' in sys.argv:
|
||||
skip_html = True
|
||||
sys.argv.remove('--qute-skip-html')
|
||||
|
||||
include_files = [
|
||||
('qutebrowser/javascript', 'javascript'),
|
||||
('qutebrowser/img', 'img'),
|
||||
('qutebrowser/git-commit-id', 'git-commit-id'),
|
||||
('qutebrowser/utils/testfile', 'utils/testfile'),
|
||||
('qutebrowser/html', 'html'),
|
||||
]
|
||||
|
||||
if os.path.exists(os.path.join('qutebrowser', '3rdparty', 'pdfjs')):
|
||||
include_files.append(('qutebrowser/3rdparty/pdfjs', '3rdparty/pdfjs'))
|
||||
else:
|
||||
print("Warning: excluding pdfjs as it's not present!")
|
||||
|
||||
if not skip_html:
|
||||
include_files += [
|
||||
('qutebrowser/html/doc', 'html/doc'),
|
||||
]
|
||||
|
||||
egl_path = get_egl_path()
|
||||
if egl_path is not None:
|
||||
include_files.append((egl_path, 'libEGL.dll'))
|
||||
|
||||
include_files += get_plugin_folders()
|
||||
|
||||
return {
|
||||
'include_files': include_files,
|
||||
'include_msvcr': True,
|
||||
'includes': [],
|
||||
'excludes': ['tkinter'],
|
||||
'packages': ['pygments'],
|
||||
}
|
||||
|
||||
|
||||
def get_exe(base, target_name):
|
||||
"""Get the qutebrowser cx.Executable to build."""
|
||||
return cx.Executable('qutebrowser/__main__.py', base=base,
|
||||
targetName=target_name, shortcutName='qutebrowser',
|
||||
shortcutDir='ProgramMenuFolder',
|
||||
icon=os.path.join(BASEDIR, 'icons',
|
||||
'qutebrowser.ico'))
|
||||
|
||||
|
||||
def main():
|
||||
if sys.platform.startswith('win'):
|
||||
base = 'Win32GUI'
|
||||
target_name = 'qutebrowser.exe'
|
||||
else:
|
||||
base = None
|
||||
target_name = 'qutebrowser'
|
||||
|
||||
bdist_msi_options = {
|
||||
# random GUID generated by uuid.uuid4()
|
||||
'upgrade_code': '{a7119e75-4eb7-466c-ae0d-3c0eccb45196}',
|
||||
'add_to_path': False,
|
||||
}
|
||||
|
||||
try:
|
||||
setupcommon.write_git_file()
|
||||
cx.setup(
|
||||
executables=[get_exe(base, target_name)],
|
||||
options={
|
||||
'build_exe': get_build_exe_options(),
|
||||
'bdist_msi': bdist_msi_options,
|
||||
},
|
||||
**setupcommon.setupdata
|
||||
)
|
||||
finally:
|
||||
path = os.path.join(BASEDIR, 'qutebrowser', 'git-commit-id')
|
||||
if os.path.exists(path):
|
||||
os.remove(path)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
@ -1,87 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
|
||||
|
||||
# Copyright 2015-2017 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
|
||||
#
|
||||
# This file is part of qutebrowser.
|
||||
#
|
||||
# qutebrowser is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# qutebrowser is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
"""cx_Freeze script to freeze qutebrowser and its tests."""
|
||||
|
||||
|
||||
import os
|
||||
import os.path
|
||||
import sys
|
||||
import contextlib
|
||||
|
||||
import cx_Freeze as cx # pylint: disable=import-error,useless-suppression
|
||||
# cx_Freeze is hard to install (needs C extensions) so we don't check for it.
|
||||
import pytest
|
||||
|
||||
import httpbin
|
||||
|
||||
sys.path.insert(0, os.path.join(os.path.dirname(__file__), os.pardir,
|
||||
os.pardir))
|
||||
from scripts import setupcommon
|
||||
from scripts.dev import freeze
|
||||
|
||||
|
||||
@contextlib.contextmanager
|
||||
def temp_git_commit_file():
|
||||
"""Context manager to temporarily create a fake git-commit-id file."""
|
||||
basedir = os.path.join(os.path.dirname(os.path.realpath(__file__)),
|
||||
os.path.pardir, os.pardir)
|
||||
path = os.path.join(basedir, 'qutebrowser', 'git-commit-id')
|
||||
with open(path, 'wb') as f:
|
||||
f.write(b'fake-frozen-git-commit')
|
||||
yield
|
||||
os.remove(path)
|
||||
|
||||
|
||||
def get_build_exe_options():
|
||||
"""Get build_exe options with additional includes."""
|
||||
opts = freeze.get_build_exe_options(skip_html=True)
|
||||
opts['includes'] += pytest.freeze_includes()
|
||||
opts['includes'] += ['unittest.mock', 'PyQt5.QtTest', 'hypothesis', 'bs4',
|
||||
'httpbin', 'jinja2.ext', 'cheroot', 'pstats', 'queue']
|
||||
|
||||
httpbin_dir = os.path.dirname(httpbin.__file__)
|
||||
opts['include_files'] += [
|
||||
('tests/end2end/data', 'end2end/data'),
|
||||
(os.path.join(httpbin_dir, 'templates'), 'end2end/templates'),
|
||||
]
|
||||
|
||||
opts['packages'].append('qutebrowser')
|
||||
return opts
|
||||
|
||||
|
||||
def main():
|
||||
base = 'Win32GUI' if sys.platform.startswith('win') else None
|
||||
with temp_git_commit_file():
|
||||
cx.setup(
|
||||
executables=[
|
||||
cx.Executable('scripts/dev/run_frozen_tests.py',
|
||||
targetName='run-frozen-tests'),
|
||||
cx.Executable('tests/end2end/fixtures/webserver_sub.py',
|
||||
targetName='webserver_sub'),
|
||||
freeze.get_exe(base, target_name='qutebrowser')
|
||||
],
|
||||
options={'build_exe': get_build_exe_options()},
|
||||
**setupcommon.setupdata
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
@ -112,11 +112,7 @@ def get_all_names():
|
||||
"""Get all requirement names based on filenames."""
|
||||
for filename in glob.glob(os.path.join(REQ_DIR, 'requirements-*.txt-raw')):
|
||||
basename = os.path.basename(filename)
|
||||
name = basename[len('requirements-'):-len('.txt-raw')]
|
||||
if name == 'cxfreeze' and sys.hexversion >= 0x030600:
|
||||
print("Warning: Skipping cxfreeze")
|
||||
else:
|
||||
yield name
|
||||
yield basename[len('requirements-'):-len('.txt-raw')]
|
||||
yield 'pip'
|
||||
|
||||
|
||||
|
@ -1,40 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
|
||||
|
||||
# Copyright 2015-2017 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
|
||||
#
|
||||
# This file is part of qutebrowser.
|
||||
#
|
||||
# qutebrowser is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# qutebrowser is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
"""cx_Freeze script to run qutebrowser tests on the frozen executable."""
|
||||
|
||||
import sys
|
||||
|
||||
import pytest
|
||||
import pytestqt.plugin
|
||||
import pytest_mock
|
||||
import pytest_catchlog
|
||||
import pytest_instafail
|
||||
import pytest_faulthandler
|
||||
import pytest_xvfb
|
||||
import pytest_rerunfailures
|
||||
import pytest_warnings
|
||||
import pytest_benchmark.plugin
|
||||
|
||||
sys.exit(pytest.main(plugins=[pytestqt.plugin, pytest_mock,
|
||||
pytest_catchlog, pytest_instafail,
|
||||
pytest_faulthandler, pytest_xvfb,
|
||||
pytest_rerunfailures, pytest_warnings,
|
||||
pytest_benchmark.plugin]))
|
24
tox.ini
24
tox.ini
@ -158,18 +158,6 @@ deps =
|
||||
-r{toxinidir}/requirements.txt
|
||||
-r{toxinidir}/misc/requirements/requirements-pyqt.txt
|
||||
|
||||
[testenv:unittests-frozen]
|
||||
# cx_Freeze doesn't support Python 3.5 yet
|
||||
basepython = python3.4
|
||||
passenv = {[testenv]passenv}
|
||||
deps =
|
||||
{[testenv]deps}
|
||||
-r{toxinidir}/misc/requirements/requirements-cxfreeze.txt
|
||||
commands =
|
||||
{envpython} scripts/link_pyqt.py --tox {envdir}
|
||||
{envpython} scripts/dev/freeze_tests.py build_exe -b {envdir}/build
|
||||
{envdir}/build/run-frozen-tests {posargs}
|
||||
|
||||
[testenv:misc]
|
||||
ignore_errors = true
|
||||
basepython = python3
|
||||
@ -251,18 +239,6 @@ commands =
|
||||
{envpython} scripts/dev/check_doc_changes.py {posargs}
|
||||
{envpython} scripts/asciidoc2html.py {posargs}
|
||||
|
||||
[testenv:cxfreeze-windows]
|
||||
# PYTHON is actually required when using this env, but the entire tox.ini would
|
||||
# fail if we didn't have a fallback defined.
|
||||
basepython = {env:PYTHON:}/python.exe
|
||||
deps =
|
||||
-r{toxinidir}/requirements.txt
|
||||
-r{toxinidir}/misc/requirements/requirements-cxfreeze.txt
|
||||
commands =
|
||||
{envpython} -m pip install -U setuptools
|
||||
{envpython} scripts/link_pyqt.py --tox {envdir}
|
||||
{envpython} scripts/dev/freeze.py {posargs}
|
||||
|
||||
[testenv:pyinstaller]
|
||||
# WORKAROUND for https://github.com/tox-dev/tox/issues/503
|
||||
install_command = pip install --exists-action w {opts} {packages}
|
||||
|
Loading…
Reference in New Issue
Block a user