diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9445823..e219a99 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,7 +13,7 @@ env: jobs: build: - name: Build ${{ matrix.os.name }} Qt ${{ matrix.qt.qt_version }}-${{ matrix.bitness.name }} + name: Build ${{ matrix.os.name }} Qt ${{ matrix.qt.name }}-${{ matrix.bitness.name }} runs-on: ${{ matrix.os.runs-on }} container: ${{ format(matrix.os.container, matrix.python.docker) }} strategy: @@ -37,12 +37,54 @@ jobs: action: 3.8 docker: 3.8 qt: - - qt_version: 5.14.0 - - qt_version: 5.14.1 - - qt_version: 5.14.2 - - qt_version: 5.15.0 - - qt_version: 5.15.1 - - qt_version: 5.15.2 + - name: 5.14.0 + env: 5.14.0 + matrix: 5.14.0 + major: 5 + - name: 5.14.1 + env: 5.14.1 + matrix: 5.14.1 + major: 5 + - name: 5.14.2 + env: 5.14.2 + matrix: 5.14.2 + major: 5 + - name: 5.15.0 + env: 5.15.0 + matrix: 5.15.0 + major: 5 + - name: 5.15.1 + env: 5.15.1 + matrix: 5.15.1 + major: 5 + - name: 5.15.2 + env: 5.15.2 + matrix: 5.15.2 + major: 5 + - name: 6.0.0 + env: 6.0.0 + matrix: 6.0.0 + major: 6 + - name: 6.0.1 + env: 6.0.1 + matrix: 6.0.1 + major: 6 + - name: 6.0.2 + env: 6.0.2 + matrix: 6.0.2 + major: 6 + - name: 6.0.3 + env: 6.0.3 + matrix: 6.0.3 + major: 6 + - name: 6.0.4 + env: 6.0.4 + matrix: 6.0.4 + major: 6 + - name: 6.1.0 + env: 6.1.0 + matrix: 6.1.0 + major: 6 bitness: - name: x32 action: x86 @@ -60,15 +102,21 @@ jobs: os: name: macOS - qt: - qt_version: 5.14.0 + matrix: 5.14.0 os: name: macOS - qt: - qt_version: 5.14.1 + matrix: 5.14.1 os: name: macOS + - bitness: + name: x32 + os: + name: Windows + qt: + major: 6 env: - QT_VERSION: ${{ matrix.qt.qt_version }} + QT_VERSION: ${{ matrix.qt.env }} steps: - name: Checkout @@ -124,7 +172,7 @@ jobs: - name: Archive individual wheel uses: actions/upload-artifact@v1 with: - name: ${{ matrix.os.name }} Qt ${{ matrix.qt.qt_version }}-${{ matrix.bitness.name }} + name: ${{ matrix.os.name }} Qt ${{ matrix.qt.name }}-${{ matrix.bitness.name }} path: dist/ - name: Archive all wheels uses: actions/upload-artifact@v1 @@ -132,7 +180,7 @@ jobs: name: all_wheels path: dist/ test: - name: Test ${{ matrix.os.name }} ${{ matrix.python.name }}-${{ matrix.bitness.name }} ${{ matrix.qt.qt_version }} + name: Test ${{ matrix.os.name }} ${{ matrix.python.name }}-${{ matrix.bitness.name }} ${{ matrix.qt.name }} runs-on: ${{ matrix.os.runs-on }} container: ${{ format(matrix.os.container, matrix.python.docker) }} needs: @@ -174,12 +222,66 @@ jobs: action: 3.9 docker: 3.9 qt: - - qt_version: 5.14.0 - - qt_version: 5.14.1 - - qt_version: 5.14.2 - - qt_version: 5.15.0 - - qt_version: 5.15.1 - - qt_version: 5.15.2 + - name: 5.14.0 + env: 5.14.0 + matrix: 5.14.0 + major: 5 + tox: qt5 + - name: 5.14.1 + env: 5.14.1 + matrix: 5.14.1 + major: 5 + tox: qt5 + - name: 5.14.2 + env: 5.14.2 + matrix: 5.14.2 + major: 5 + tox: qt5 + - name: 5.15.0 + env: 5.15.0 + matrix: 5.15.0 + major: 5 + tox: qt5 + - name: 5.15.1 + env: 5.15.1 + matrix: 5.15.1 + major: 5 + tox: qt5 + - name: 5.15.2 + env: 5.15.2 + matrix: 5.15.2 + major: 5 + tox: qt5 + - name: 6.0.0 + env: 6.0.0 + matrix: 6.0.0 + major: 6 + tox: qt6 + - name: 6.0.1 + env: 6.0.1 + matrix: 6.0.1 + major: 6 + tox: qt6 + - name: 6.0.2 + env: 6.0.2 + matrix: 6.0.2 + major: 6 + tox: qt6 + - name: 6.0.3 + env: 6.0.3 + matrix: 6.0.3 + major: 6 + tox: qt6 + - name: 6.0.4 + env: 6.0.4 + matrix: 6.0.4 + major: 6 + tox: qt6 + - name: 6.1.0 + env: 6.1.0 + matrix: 6.1.0 + major: 6 + tox: qt6 bitness: - name: x32 action: x86 @@ -197,15 +299,21 @@ jobs: os: name: macOS - qt: - qt_version: 5.14.0 + matrix: 5.14.0 os: name: macOS - qt: - qt_version: 5.14.1 + matrix: 5.14.1 os: name: macOS + - bitness: + name: x32 + os: + name: Windows + qt: + major: 6 env: - QT_VERSION: ${{ matrix.qt.qt_version }} + QT_VERSION: ${{ matrix.qt.env }} steps: - name: Checkout @@ -213,7 +321,7 @@ jobs: - name: Download uses: actions/download-artifact@v1 with: - name: ${{ matrix.os.name }} Qt ${{ matrix.qt.qt_version }}-${{ matrix.bitness.name }} + name: ${{ matrix.os.name }} Qt ${{ matrix.qt.name }}-${{ matrix.bitness.name }} path: dist/ - name: Set up Python ${{ matrix.python.name }}-${{ matrix.bitness.name }} if: matrix.os.python_platform != 'linux' @@ -257,7 +365,7 @@ jobs: - uses: altendky/QTBUG-88688-libxcb-util@v3 - name: Test run: | - tox -e ${{ matrix.python.tox }} --installpkg ${{ env['WHEEL_PATH'] }} + tox -e ${{ matrix.python.tox }}-${{ matrix.qt.tox }} --installpkg ${{ env['WHEEL_PATH'] }} maybe_publish: name: Maybe Publish runs-on: ubuntu-latest diff --git a/MANIFEST.in b/MANIFEST.in index a584360..d18895b 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,3 +1,3 @@ -recursive-include src/qt5_applications * +recursive-include src/qt_applications * include versioneer.py -include src/qt5_applications/_version.py +include src/qt_applications/_version.py diff --git a/build.py b/build.py index 6aa2848..cc9d29e 100644 --- a/build.py +++ b/build.py @@ -212,13 +212,19 @@ def create_script_function_name(path: pathlib.Path): def linuxdeployqt_substitute_list_source( target, ) -> typing.List[pathlib.Path]: - paths = [ - dependency.path - for dependency in lddwrap.list_dependencies( - path=target, - ) - if dependency.path is not None - ] + try: + paths = [ + dependency.path + for dependency in lddwrap.list_dependencies( + path=target, + ) + if dependency.path is not None + ] + except RuntimeError as e: + if "Failed to ldd external" not in str(e): + raise + + paths = [] return paths @@ -959,7 +965,7 @@ def main(package_path, build_base_path): # TODO: uhhh.... i'm trying to use an existing directory i thought build_base_path.mkdir(parents=True, exist_ok=True) build_path = tempfile.mkdtemp( - prefix='qt5_applications-', + prefix='qt_applications-', dir=fspath(build_base_path), ) print('after ---!!!', file=sys.stderr) @@ -1187,7 +1193,7 @@ def windeployqt_list_source( for line in process.stdout.decode('utf-8').splitlines() ] - return paths + return [path for path in paths if path.name != "qt_en.qm"] def install_qt(configuration): diff --git a/pyproject.toml b/pyproject.toml index 9bfdfe0..5aef2ac 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,9 @@ [build-system] requires = [ "attrs", - "aqtinstall", + # >= 1.0.0b1 for Qt6 support + "aqtinstall >= 1.0.0b1; python_version >= '3.6'", + "aqtinstall; python_version < '3.6'", # != 0.10.0 for https://github.com/miurahr/py7zr/issues/252 "py7zr != 0.10.0", "importlib-metadata", @@ -9,7 +11,7 @@ requires = [ "macholib", "msvc-runtime; sys_platform == 'win32'", "pip", - "pylddwrap", + "pylddwrap~=1.2", "requests", "setuptools", "versioneer-518 == 0.18", diff --git a/setup.cfg b/setup.cfg index 57125fe..294f353 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [versioneer] VCS = git style = pep440-post -versionfile_source = src/qt5_applications/_version.py -versionfile_build = qt5_applications/_version.py +versionfile_source = src/qt_applications/_version.py +versionfile_build = qt_applications/_version.py tag_prefix = v diff --git a/setup.py b/setup.py index f479eb7..51fd67e 100644 --- a/setup.py +++ b/setup.py @@ -55,10 +55,11 @@ def pad_version(v, segment_count=3): # TODO: really doesn't seem quite proper here and probably should come # in some other way? -qt_version = pad_version(os.environ.setdefault('QT_VERSION', '5.15.1')) +qt_version = pad_version(os.environ.setdefault('QT_VERSION', '6.1.0')) +qt_major_version = qt_version.partition('.')[0] -qt5_applications_wrapper_version = versioneer.get_versions()['version'] -qt5_applications_version = '{}.{}'.format(qt_version, qt5_applications_wrapper_version) +qt_applications_wrapper_version = versioneer.get_versions()['version'] +qt_applications_version = '{}.{}'.format(qt_version, qt_applications_wrapper_version) with open('README.rst') as f: @@ -73,8 +74,12 @@ def has_ext_modules(self): return True +distribution_name = "qt{}-applications".format(qt_major_version) +import_name = distribution_name.replace('-', '_') + + setuptools.setup( - name="qt5-applications", + name=distribution_name, description="The collection of Qt tools easily installable in Python", long_description=readme, long_description_content_type='text/x-rst', @@ -102,9 +107,9 @@ def has_ext_modules(self): ], cmdclass={'bdist_wheel': BdistWheel, 'build_py': build.BuildPy}, distclass=Dist, - packages=setuptools.find_packages('src'), - package_dir={'': 'src'}, - version=qt5_applications_version, + packages=[package.replace('qt_applications', import_name) for package in setuptools.find_packages('src')], + package_dir={import_name: 'src/qt_applications'}, + version=qt_applications_version, include_package_data=True, python_requires=">=3.5", ) diff --git a/src/qt5_applications/__init__.py b/src/qt5_applications/__init__.py deleted file mode 100644 index 3f7dd73..0000000 --- a/src/qt5_applications/__init__.py +++ /dev/null @@ -1,21 +0,0 @@ -import pathlib - -import qt5_applications._applications - - -from ._version import get_versions -__version__ = get_versions()['version'] -del get_versions - - -_root = pathlib.Path(__file__).absolute().parent -_bin = _root.joinpath('Qt', 'bin') -_plugins = _root.joinpath('Qt', 'plugins') - - -def _application_names(): - return [*qt5_applications._applications.application_paths.keys()] - - -def _application_path(name): - return _bin.joinpath(qt5_applications._applications.application_paths[name]) diff --git a/src/qt_applications/__init__.py b/src/qt_applications/__init__.py new file mode 100644 index 0000000..8380d31 --- /dev/null +++ b/src/qt_applications/__init__.py @@ -0,0 +1,41 @@ +import pathlib + + +# TODO: CAMPid 0970432108721340872130742130870874321 +def import_it(*segments): + import importlib + import pkg_resources + + major = int(pkg_resources.get_distribution(__name__).version.partition(".")[0]) + + m = { + "pyqt_tools": "pyqt{major}_tools".format(major=major), + "pyqt_plugins": "pyqt{major}_plugins".format(major=major), + "qt_tools": "qt{major}_tools".format(major=major), + "qt_applications": "qt{major}_applications".format(major=major), + } + + majored = [m[segments[0]], *segments[1:]] + return importlib.import_module(".".join(majored)) + + +qt_applications = import_it("qt_applications") +import_it("qt_applications", "_applications") + + +from ._version import get_versions +__version__ = get_versions()['version'] +del get_versions + + +_root = pathlib.Path(__file__).absolute().parent +_bin = _root.joinpath('Qt', 'bin') +_plugins = _root.joinpath('Qt', 'plugins') + + +def _application_names(): + return [*qt_applications._applications.application_paths.keys()] + + +def _application_path(name): + return _bin.joinpath(qt_applications._applications.application_paths[name]) diff --git a/src/qt5_applications/_applications.py b/src/qt_applications/_applications.py similarity index 100% rename from src/qt5_applications/_applications.py rename to src/qt_applications/_applications.py diff --git a/src/qt5_applications/_version.py b/src/qt_applications/_version.py similarity index 99% rename from src/qt5_applications/_version.py rename to src/qt_applications/_version.py index 6da222b..65132ee 100644 --- a/src/qt5_applications/_version.py +++ b/src/qt_applications/_version.py @@ -43,7 +43,7 @@ def get_config(): cfg.style = "pep440-post" cfg.tag_prefix = "v" cfg.parentdir_prefix = "None" - cfg.versionfile_source = "src/qt5_applications/_version.py" + cfg.versionfile_source = "src/qt_applications/_version.py" cfg.verbose = False return cfg diff --git a/src/qt5_applications/tests/__init__.py b/src/qt_applications/tests/__init__.py similarity index 100% rename from src/qt5_applications/tests/__init__.py rename to src/qt_applications/tests/__init__.py diff --git a/src/qt5_applications/tests/test_entrypoints.py b/src/qt_applications/tests/test_entrypoints.py similarity index 72% rename from src/qt5_applications/tests/test_entrypoints.py rename to src/qt_applications/tests/test_entrypoints.py index 21d2183..9b05b58 100644 --- a/src/qt5_applications/tests/test_entrypoints.py +++ b/src/qt_applications/tests/test_entrypoints.py @@ -1,11 +1,29 @@ +import importlib import os import subprocess import sys import sysconfig +import pkg_resources import pytest -import qt5_applications +major = int(pkg_resources.get_distribution(__name__.partition(".")[0]).version.partition(".")[0]) + + +m = { + "pyqt_tools": "pyqt{major}_tools".format(major=major), + "pyqt_plugins": "pyqt{major}_plugins".format(major=major), + "qt_tools": "qt{major}_tools".format(major=major), + "qt_applications": "qt{major}_applications".format(major=major), +} + + +def import_it(*segments): + majored = [m[segments[0]], *segments[1:]] + return importlib.import_module(".".join(majored)) + + +qt_applications = import_it("qt_applications") fspath = getattr(os, 'fspath', str) @@ -43,7 +61,7 @@ def create_environment(reference): def test_designer(): - path = fspath(qt5_applications._application_path('designer')) + path = fspath(qt_applications._application_path('designer')) if path.endswith('.app'): cmd = ["open", path] @@ -70,7 +88,7 @@ def test_qmlscene(): with pytest.raises(subprocess.TimeoutExpired): subprocess.run( [ - fspath(qt5_applications._application_path('qmlscene')), + fspath(qt_applications._application_path('qmlscene')), ], check=True, env={**create_environment(os.environ), 'QT_DEBUG_PLUGINS': '1'}, @@ -81,7 +99,7 @@ def test_qmlscene(): # def test_language(): # completed_process = subprocess.run( # [ -# fspath(qt5_applications._application_path('qtdiag')), +# fspath(qt_applications._application_path('qtdiag')), # ], # check=True, # env={**os.environ, 'LANGUAGE': 'de_DE'}, diff --git a/tox.ini b/tox.ini index e9e4e5a..495a43b 100644 --- a/tox.ini +++ b/tox.ini @@ -7,6 +7,9 @@ deps= pytest pytest-faulthandler pytest-xvfb; sys_platform=="linux" +setenv= + qt5: MAJOR = 5 + qt6: MAJOR = 6 commands= {envbindir}/pip freeze - {envbindir}/pytest --capture=no qt5_applications.tests --pyargs + {envbindir}/pytest --capture=no qt{env:MAJOR}_applications.tests --pyargs