aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--build_scripts/utils.py19
-rw-r--r--build_scripts/wheel_utils.py17
-rw-r--r--coin_build_instructions.py14
-rw-r--r--sources/pyside6/.cmake.conf5
-rw-r--r--sources/pyside6/CMakeLists.txt1
-rw-r--r--sources/pyside6/cmake/PySideSetup.cmake25
-rw-r--r--sources/pyside6/pyside_version.py10
-rw-r--r--sources/shiboken6/.cmake.conf5
-rw-r--r--sources/shiboken6/CMakeLists.txt1
-rw-r--r--sources/shiboken6/cmake/ShibokenSetup.cmake22
-rw-r--r--sources/shiboken6/shiboken_version.py10
11 files changed, 63 insertions, 66 deletions
diff --git a/build_scripts/utils.py b/build_scripts/utils.py
index 10af2725f..c4a99edee 100644
--- a/build_scripts/utils.py
+++ b/build_scripts/utils.py
@@ -1238,3 +1238,22 @@ def get_ci_qmake_path(ci_install_dir, ci_host_os):
return f"{qmake_path}\\bin\\qmake.exe"
else:
return f"{qmake_path}/bin/qmake"
+
+
+def parse_cmake_conf_assignments_by_key(source_dir):
+ """
+ Parses a .cmake.conf file that contains set(foo "bar") assignments
+ and returns a dict with those assignments transformed to keys and
+ values.
+ """
+
+ d = {}
+ contents = (Path(source_dir) / ".cmake.conf").read_text()
+ matches = re.findall(r'set\((.+?) "(.*?)"\)', contents)
+ for m in matches:
+ key = m[0]
+ value = m[1]
+ if key and value:
+ d[key] = value
+ return d
+
diff --git a/build_scripts/wheel_utils.py b/build_scripts/wheel_utils.py
index 4cea2a83f..bfff47f04 100644
--- a/build_scripts/wheel_utils.py
+++ b/build_scripts/wheel_utils.py
@@ -46,7 +46,7 @@ from packaging.version import parse as parse_version
from .options import OPTION
from .qtinfo import QtInfo
-from .utils import memoize, get_python_dict
+from .utils import memoize, parse_cmake_conf_assignments_by_key
from .versions import PYSIDE
@@ -78,12 +78,15 @@ def get_qt_version():
def get_package_version():
""" Returns the version string for the PySide6 package. """
setup_script_dir = os.getcwd()
- pyside_version_py = os.path.join(
- setup_script_dir, "sources", PYSIDE, "pyside_version.py")
- d = get_python_dict(pyside_version_py)
- final_version = f"{d['major_version']}.{d['minor_version']}.{d['patch_version']}"
- release_version_type = d['release_version_type']
- pre_release_version = d['pre_release_version']
+ pyside_project_dir = os.path.join(setup_script_dir, "sources", PYSIDE)
+ d = parse_cmake_conf_assignments_by_key(pyside_project_dir)
+ major_version = d['pyside_MAJOR_VERSION']
+ minor_version = d['pyside_MINOR_VERSION']
+ patch_version = d['pyside_MICRO_VERSION']
+
+ final_version = f"{major_version}.{minor_version}.{patch_version}"
+ release_version_type = d['pyside_PRE_RELEASE_VERSION_TYPE']
+ pre_release_version = d['pyside_PRE_RELEASE_VERSION']
if pre_release_version and release_version_type:
final_version = f"{final_version}{release_version_type}{pre_release_version}"
diff --git a/coin_build_instructions.py b/coin_build_instructions.py
index 6f75cdaff..6510b6cd7 100644
--- a/coin_build_instructions.py
+++ b/coin_build_instructions.py
@@ -42,7 +42,7 @@ from build_scripts.utils import install_pip_dependencies, expand_clang_variables
from build_scripts.utils import get_qtci_virtualEnv
from build_scripts.utils import run_instruction
from build_scripts.utils import rmtree
-from build_scripts.utils import get_python_dict
+from build_scripts.utils import parse_cmake_conf_assignments_by_key
from build_scripts.utils import get_ci_qtpaths_path
import os
import datetime
@@ -88,7 +88,7 @@ def is_snapshot_build():
"""
Returns True if project needs to be built with --snapshot-build
- This is true if the version found in pyside_version.py is not a
+ This is true if the version found in .cmake.conf is not a
pre-release version (no alphas, betas).
This eliminates the need to remove the --snapshot-build option
@@ -96,12 +96,12 @@ def is_snapshot_build():
for a release).
"""
setup_script_dir = get_current_script_path()
- pyside_version_py = os.path.join(
- setup_script_dir, "sources", "pyside6", "pyside_version.py")
- d = get_python_dict(pyside_version_py)
+ pyside_project_dir = os.path.join(setup_script_dir, "sources", "pyside6")
- release_version_type = d['release_version_type']
- pre_release_version = d['pre_release_version']
+ d = parse_cmake_conf_assignments_by_key(pyside_project_dir)
+
+ release_version_type = d['pyside_PRE_RELEASE_VERSION_TYPE']
+ pre_release_version = d['pyside_PRE_RELEASE_VERSION']
if pre_release_version and release_version_type:
return True
return False
diff --git a/sources/pyside6/.cmake.conf b/sources/pyside6/.cmake.conf
new file mode 100644
index 000000000..07d8cc49a
--- /dev/null
+++ b/sources/pyside6/.cmake.conf
@@ -0,0 +1,5 @@
+set(pyside_MAJOR_VERSION "6")
+set(pyside_MINOR_VERSION "0")
+set(pyside_MICRO_VERSION "0")
+set(pyside_PRE_RELEASE_VERSION_TYPE "a")
+set(pyside_PRE_RELEASE_VERSION "1")
diff --git a/sources/pyside6/CMakeLists.txt b/sources/pyside6/CMakeLists.txt
index 48b892930..4fc668ea5 100644
--- a/sources/pyside6/CMakeLists.txt
+++ b/sources/pyside6/CMakeLists.txt
@@ -3,6 +3,7 @@ include(cmake/Macros/icecc.cmake) # this must be the first line!
cmake_minimum_required(VERSION 3.16)
cmake_policy(VERSION 3.16)
+include(".cmake.conf")
project(pysidebindings)
include(cmake/PySideSetup.cmake)
diff --git a/sources/pyside6/cmake/PySideSetup.cmake b/sources/pyside6/cmake/PySideSetup.cmake
index 159fdcd86..e4b098ad6 100644
--- a/sources/pyside6/cmake/PySideSetup.cmake
+++ b/sources/pyside6/cmake/PySideSetup.cmake
@@ -33,18 +33,11 @@ endif()
find_package(Shiboken6 2.0.0 REQUIRED)
-set(PYSIDE_VERSION_FILE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/pyside_version.py")
-set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS
- ${PYSIDE_VERSION_FILE_PATH}
-)
-execute_process(
- COMMAND ${PYTHON_EXECUTABLE} "${PYSIDE_VERSION_FILE_PATH}"
- OUTPUT_VARIABLE PYSIDE_VERSION_OUTPUT
- ERROR_VARIABLE PYSIDE_VERSION_OUTPUT_ERROR
- OUTPUT_STRIP_TRAILING_WHITESPACE)
-if(NOT PYSIDE_VERSION_OUTPUT)
- message(FATAL_ERROR "Could not identify PySide6 version. Error: ${PYSIDE_VERSION_OUTPUT_ERROR}")
-endif()
+set(BINDING_API_MAJOR_VERSION "${pyside_MAJOR_VERSION}")
+set(BINDING_API_MINOR_VERSION "${pyside_MINOR_VERSION}")
+set(BINDING_API_MICRO_VERSION "${pyside_MICRO_VERSION}")
+set(BINDING_API_PRE_RELEASE_VERSION_TYPE "${pyside_PRE_RELEASE_VERSION_TYPE}")
+set(BINDING_API_PRE_RELEASE_VERSION "${pyside_PRE_RELEASE_VERSION}")
# Detect if the Python interpreter is actually PyPy
execute_process(
@@ -58,14 +51,6 @@ execute_process(
OUTPUT_VARIABLE PYPY_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE)
-list(GET PYSIDE_VERSION_OUTPUT 0 BINDING_API_MAJOR_VERSION)
-list(GET PYSIDE_VERSION_OUTPUT 1 BINDING_API_MINOR_VERSION)
-list(GET PYSIDE_VERSION_OUTPUT 2 BINDING_API_MICRO_VERSION)
-# a - alpha, b - beta, rc - rc
-list(GET PYSIDE_VERSION_OUTPUT 3 BINDING_API_PRE_RELEASE_VERSION_TYPE)
-# the number of the pre release (alpha1, beta3, rc7, etc.)
-list(GET PYSIDE_VERSION_OUTPUT 4 BINDING_API_PRE_RELEASE_VERSION)
-
if(WIN32)
set(PATH_SEP "\;")
else()
diff --git a/sources/pyside6/pyside_version.py b/sources/pyside6/pyside_version.py
index b5ebfa59c..e2c5bfcb6 100644
--- a/sources/pyside6/pyside_version.py
+++ b/sources/pyside6/pyside_version.py
@@ -37,17 +37,17 @@
##
#############################################################################
-major_version = "6"
-minor_version = "0"
-patch_version = "0"
+major_version = "@pyside_MAJOR_VERSION@"
+minor_version = "@pyside_MINOR_VERSION@"
+patch_version = "@pyside_MICRO_VERSION@"
# For example: "a", "b", "rc"
# (which means "alpha", "beta", "release candidate").
# An empty string means the generated package will be an official release.
-release_version_type = "a"
+release_version_type = "@pyside_PRE_RELEASE_VERSION_TYPE@"
# For example: "1", "2" (which means "beta1", "beta2", if type is "b").
-pre_release_version = "1"
+pre_release_version = "@pyside_PRE_RELEASE_VERSION@"
if __name__ == '__main__':
# Used by CMake.
diff --git a/sources/shiboken6/.cmake.conf b/sources/shiboken6/.cmake.conf
new file mode 100644
index 000000000..233359a86
--- /dev/null
+++ b/sources/shiboken6/.cmake.conf
@@ -0,0 +1,5 @@
+set(shiboken_MAJOR_VERSION "6")
+set(shiboken_MINOR_VERSION "0")
+set(shiboken_MICRO_VERSION "0")
+set(shiboken_PRE_RELEASE_VERSION_TYPE "a")
+set(shiboken_PRE_RELEASE_VERSION "1")
diff --git a/sources/shiboken6/CMakeLists.txt b/sources/shiboken6/CMakeLists.txt
index afc368d16..4d5f279df 100644
--- a/sources/shiboken6/CMakeLists.txt
+++ b/sources/shiboken6/CMakeLists.txt
@@ -5,6 +5,7 @@ cmake_policy(VERSION 3.16)
set(CMAKE_BUILD_TYPE Release CACHE STRING "Build Type")
+include(".cmake.conf")
project(shiboken6)
include(cmake/ShibokenSetup.cmake)
diff --git a/sources/shiboken6/cmake/ShibokenSetup.cmake b/sources/shiboken6/cmake/ShibokenSetup.cmake
index c5ab582c3..5eaa01d2a 100644
--- a/sources/shiboken6/cmake/ShibokenSetup.cmake
+++ b/sources/shiboken6/cmake/ShibokenSetup.cmake
@@ -26,28 +26,6 @@ endif()
setup_clang()
-set(SHIBOKEN_VERSION_FILE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/shiboken_version.py")
-set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS
- ${SHIBOKEN_VERSION_FILE_PATH}
-)
-execute_process(
- COMMAND ${PYTHON_EXECUTABLE} "${SHIBOKEN_VERSION_FILE_PATH}"
- OUTPUT_VARIABLE SHIBOKEN_VERSION_OUTPUT
- ERROR_VARIABLE SHIBOKEN_VERSION_OUTPUT_ERROR
- OUTPUT_STRIP_TRAILING_WHITESPACE)
-if (NOT SHIBOKEN_VERSION_OUTPUT)
- message(FATAL_ERROR "Could not identify shiboken version. \
- Error: ${SHIBOKEN_VERSION_OUTPUT_ERROR}")
-endif()
-
-list(GET SHIBOKEN_VERSION_OUTPUT 0 shiboken_MAJOR_VERSION)
-list(GET SHIBOKEN_VERSION_OUTPUT 1 shiboken_MINOR_VERSION)
-list(GET SHIBOKEN_VERSION_OUTPUT 2 shiboken_MICRO_VERSION)
-# a - alpha, b - beta, rc - rc
-list(GET SHIBOKEN_VERSION_OUTPUT 3 shiboken_PRE_RELEASE_VERSION_TYPE)
-# the number of the pre release (alpha1, beta3, rc7, etc.)
-list(GET SHIBOKEN_VERSION_OUTPUT 4 shiboken_PRE_RELEASE_VERSION)
-
set(shiboken6_VERSION "${shiboken_MAJOR_VERSION}.${shiboken_MINOR_VERSION}.${shiboken_MICRO_VERSION}")
set(shiboken6_library_so_version "${shiboken_MAJOR_VERSION}.${shiboken_MINOR_VERSION}")
diff --git a/sources/shiboken6/shiboken_version.py b/sources/shiboken6/shiboken_version.py
index b5ebfa59c..37d9e2715 100644
--- a/sources/shiboken6/shiboken_version.py
+++ b/sources/shiboken6/shiboken_version.py
@@ -37,17 +37,17 @@
##
#############################################################################
-major_version = "6"
-minor_version = "0"
-patch_version = "0"
+major_version = "@shiboken_MAJOR_VERSION@"
+minor_version = "@shiboken_MINOR_VERSION@"
+patch_version = "@shiboken_MICRO_VERSION@"
# For example: "a", "b", "rc"
# (which means "alpha", "beta", "release candidate").
# An empty string means the generated package will be an official release.
-release_version_type = "a"
+release_version_type = "@shiboken_PRE_RELEASE_VERSION_TYPE@"
# For example: "1", "2" (which means "beta1", "beta2", if type is "b").
-pre_release_version = "1"
+pre_release_version = "@shiboken_PRE_RELEASE_VERSION@"
if __name__ == '__main__':
# Used by CMake.