aboutsummaryrefslogtreecommitdiffstats
path: root/build_scripts/config.py
diff options
context:
space:
mode:
Diffstat (limited to 'build_scripts/config.py')
-rw-r--r--build_scripts/config.py52
1 files changed, 31 insertions, 21 deletions
diff --git a/build_scripts/config.py b/build_scripts/config.py
index 89e6d7574..0a6eebf78 100644
--- a/build_scripts/config.py
+++ b/build_scripts/config.py
@@ -1,11 +1,12 @@
# Copyright (C) 2018 The Qt Company Ltd.
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
-import os
+import sys
+from .log import log, LogLevel
+from pathlib import Path
-from setuptools._distutils import log
-
-from .versions import PYSIDE, PYSIDE_MODULE, SHIBOKEN
+from . import PYSIDE, PYSIDE_MODULE, SHIBOKEN
+from .utils import available_pyside_tools
class Config(object):
@@ -60,11 +61,10 @@ class Config(object):
self.python_version_classifiers = [
'Programming Language :: Python',
'Programming Language :: Python :: 3',
- 'Programming Language :: Python :: 3.6',
- 'Programming Language :: Python :: 3.7',
- 'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
+ 'Programming Language :: Python :: 3.11',
+ 'Programming Language :: Python :: 3.12',
]
self.setup_script_dir = None
@@ -77,7 +77,8 @@ class Config(object):
ext_modules=None,
setup_script_dir=None,
cmake_toolchain_file=None,
- quiet=False):
+ log_level=LogLevel.INFO,
+ qt_install_path: Path = None):
"""
Sets up the global singleton config which is used in many parts
of the setup process.
@@ -98,7 +99,7 @@ class Config(object):
else:
self.build_type = self._build_type_all
- self.setup_script_dir = setup_script_dir
+ self.setup_script_dir = Path(setup_script_dir)
self.cmake_toolchain_file = cmake_toolchain_file
@@ -114,10 +115,10 @@ class Config(object):
setup_kwargs['zip_safe'] = False
setup_kwargs['cmdclass'] = cmd_class_dict
setup_kwargs['version'] = package_version
- setup_kwargs['python_requires'] = ">=3.6, <3.11"
+ setup_kwargs['python_requires'] = ">=3.9, <3.13"
- if quiet:
- # Tells distutils / setuptools to be quiet, and only print warnings or errors.
+ if log_level == LogLevel.QUIET:
+ # Tells setuptools to be quiet, and only print warnings or errors.
# Makes way less noise in the terminal when building.
setup_kwargs['verbose'] = 0
@@ -198,13 +199,22 @@ class Config(object):
setup_kwargs['install_requires'] = [
f"{self.shiboken_module_st_name}=={package_version}"
]
- _pyside_tools = ["uic", "rcc", "assistant", "designer", "linguist",
- "lupdate", "lrelease", "genpyi", "metaobjectdump",
- "project", "qml", "qmltyperegistrar", "qmllint"]
- setup_kwargs['entry_points'] = {
- 'console_scripts': [f'{PYSIDE}-{tool} = {package_name}.scripts.pyside_tool:{tool}'
- for tool in _pyside_tools]
- }
+ if qt_install_path:
+ _pyside_tools = available_pyside_tools(qt_tools_path=qt_install_path)
+
+ # replacing pyside6-android_deploy by pyside6-android-deploy for consistency
+ # Also, the tool should not exist in any other platform than Linux
+ _console_scripts = []
+ if ("android_deploy" in _pyside_tools) and sys.platform.startswith("linux"):
+ _console_scripts = [(f"{PYSIDE}-android-deploy ="
+ " PySide6.scripts.pyside_tool:android_deploy")]
+ _pyside_tools.remove("android_deploy")
+
+ _console_scripts.extend([f'{PYSIDE}-{tool} = {package_name}.scripts.pyside_tool:'
+ f'{tool}' for tool in _pyside_tools])
+
+ setup_kwargs['entry_points'] = {'console_scripts': _console_scripts}
+
self.setup_kwargs = setup_kwargs
def get_long_description(self):
@@ -221,7 +231,7 @@ class Config(object):
content = ''
changes = ''
try:
- with open(os.path.join(self.setup_script_dir, readme_filename)) as f:
+ with open(self.setup_script_dir / readme_filename) as f:
readme = f.read()
except Exception as e:
log.error(f"Couldn't read contents of {readme_filename}. {e}")
@@ -232,7 +242,7 @@ class Config(object):
include_changes = False
if include_changes:
try:
- with open(os.path.join(self.setup_script_dir, changes_filename)) as f:
+ with open(self.setup_script_dir / changes_filename) as f:
changes = f.read()
except Exception as e:
log.error(f"Couldn't read contents of {changes_filename}. {e}")