aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--setup.py77
-rw-r--r--sources/pyside2/CMakeLists.txt67
-rw-r--r--sources/pyside2/PySide2/CMakeLists.txt5
-rw-r--r--sources/pyside2/PySide2/__init__.py.in7
-rw-r--r--sources/pyside2/PySide2/_config.py.in11
-rw-r--r--sources/pyside2/pyside_version.py10
-rw-r--r--sources/pyside2/tests/pysidetest/version_test.py6
-rw-r--r--sources/shiboken2/CMakeLists.txt44
-rw-r--r--sources/shiboken2/shiboken_version.py10
-rw-r--r--utils.py11
10 files changed, 170 insertions, 78 deletions
diff --git a/setup.py b/setup.py
index cc7db352a..5f5235da3 100644
--- a/setup.py
+++ b/setup.py
@@ -125,16 +125,42 @@ OS X Minimum deployment target:
version.
"""
-# This stores the current repo branch / tag version.
-current_git_branch_version = "5.6"
+import os
+import time
+from utils import memoize, has_option, get_python_dict
+OPTION_SNAPSHOT_BUILD = has_option("snapshot-build")
+script_dir = os.getcwd()
+
+
+@memoize
+def get_package_timestamp():
+ return int(time.time())
-# This is just for PEP compliance, and shoudn't be used.
-__version__ = current_git_branch_version
+@memoize
+def get_package_version():
+ """ Returns the version string for the PySide2 package. """
+ pyside_version_py = os.path.join(script_dir, "sources", "pyside2", "pyside_version.py")
+ d = get_python_dict(pyside_version_py)
+
+ final_version = "{}.{}.{}".format(d['major_version'], d['minor_version'], d['patch_version'])
+ pre_release_version_type = d['pre_release_version_type']
+ pre_release_version = d['pre_release_version']
+ if pre_release_version and pre_release_version:
+ final_version += pre_release_version_type + pre_release_version
+
+ # Add the current timestamp to the version number, to suggest it is a development snapshot
+ # build.
+ if OPTION_SNAPSHOT_BUILD:
+ final_version += ".dev{}".format(get_package_timestamp())
+ return final_version
+
+# The __version__ variable is just for PEP compliancy, and shoudn't be used as a value source.
+__version__ = get_package_version()
# Buildable extensions.
containedModules = ['shiboken2', 'pyside2', 'pyside2-tools']
-# Git submodules.
+# Git submodules: ["submodule_name", "location_relative_to_sources_folder"]
submodules = [["pyside2-tools"],
["pyside2-examples"],
["wiki", ".."]]
@@ -147,10 +173,8 @@ except ImportError:
from ez_setup import use_setuptools
use_setuptools()
-import os
import sys
import platform
-import time
import re
import fnmatch
@@ -188,7 +212,6 @@ from utils import makefile
from utils import copyfile
from utils import copydir
from utils import run_process_output, run_process
-from utils import has_option
from utils import option_value
from utils import update_env_path
from utils import init_msvc_env
@@ -197,7 +220,6 @@ from utils import filter_match
from utils import osx_fix_rpaths_for_library
from utils import copy_icu_libs
from utils import find_files_using_glob
-from utils import memoize
from textwrap import dedent
@@ -340,7 +362,6 @@ except NameError:
this_file = os.path.abspath(this_file)
if os.path.dirname(this_file):
os.chdir(os.path.dirname(this_file))
-script_dir = os.getcwd()
if OPTION_NOEXAMPLES:
# Remove pyside2-examples from submodules so they will not be included.
@@ -359,7 +380,7 @@ def prefix():
# Initialize, pull and checkout submodules
def prepareSubModules():
- print("Initializing submodules for PySide2 version: {}".format(current_git_branch_version))
+ print("Initializing submodules for PySide2 version: {}".format(get_package_version()))
submodules_dir = os.path.join(script_dir, "sources")
# Create list of [name, desired branch, absolute path, desired branch]
@@ -490,7 +511,8 @@ if wheel_module_exists:
# Example: PySide2-5.6-5.6.4-cp27-cp27m-macosx_10_10_intel.whl
# The PySide2 version is "5.6. The built against Qt version is "5.6.4.
qt_version = get_qt_version()
- wheel_version = "{}-{}".format(current_git_branch_version, qt_version)
+ package_version = get_package_version()
+ wheel_version = "{}-{}".format(package_version, qt_version)
components = (_safer_name(self.distribution.get_name()),
wheel_version)
if self.build_number:
@@ -779,7 +801,7 @@ class pyside_build(_build):
setuptools_install_prefix = OPTION_FINAL_INSTALL_PREFIX
log.info("=" * 30)
- log.info("Package version: %s" % current_git_branch_version)
+ log.info("Package version: %s" % get_package_version())
log.info("Build type: %s" % self.build_type)
log.info("Build tests: %s" % self.build_tests)
log.info("-" * 3)
@@ -1012,6 +1034,17 @@ class pyside_build(_build):
pyside_qt_conf_prefix = '"."'
cmake_cmd.append("-DPYSIDE_QT_CONF_PREFIX=%s" % pyside_qt_conf_prefix)
+ # Pass package version to CMake, so this string can be embedded into _config.py file.
+ package_version = get_package_version()
+ cmake_cmd.append("-DPYSIDE_SETUP_PY_PACKAGE_VERSION={0}".format(package_version))
+
+ # In case if this is a snapshot build, also pass the timestamp as a separate value,
+ # because it the only version component that is actually generated by setup.py.
+ timestamp = ''
+ if OPTION_SNAPSHOT_BUILD:
+ timestamp = get_package_timestamp()
+ cmake_cmd.append("-DPYSIDE_SETUP_PY_PACKAGE_TIMESTAMP={0}".format(timestamp))
+
if extension.lower() == "shiboken2":
cmake_cmd.append("-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=yes")
if sys.version_info[0] > 2:
@@ -1120,20 +1153,8 @@ class pyside_build(_build):
# Get config that contains list of built modules, and SOVERSIONs of the built libraries.
pyside_package_dir = vars['pyside_package_dir']
config_path = os.path.join(pyside_package_dir, "PySide2", "_config.py")
-
- try:
- with open(config_path) as f:
- scoped_locals = {}
- code = compile(f.read(), config_path, 'exec')
- exec(code, scoped_locals, scoped_locals)
- config = {}
- config['built_modules'] = scoped_locals['built_modules']
- config['shiboken_library_soversion'] = scoped_locals['shiboken_library_soversion']
- config['pyside_library_soversion'] = scoped_locals['pyside_library_soversion']
- return config
- except IOError as e:
- print("get_built_pyside_config: Couldn't find file: {}.".format(config_path))
- raise
+ config = get_python_dict(config_path)
+ return config
def prepare_packages_posix(self, vars):
executables = []
@@ -1718,7 +1739,7 @@ if wheel_module_exists:
setup(
name = "PySide2",
- version = current_git_branch_version,
+ version = get_package_version(),
description = ("Python bindings for the Qt cross-platform application and UI framework"),
long_description = README + "\n\n" + CHANGES,
classifiers = [
diff --git a/sources/pyside2/CMakeLists.txt b/sources/pyside2/CMakeLists.txt
index fac031fdb..56eadb844 100644
--- a/sources/pyside2/CMakeLists.txt
+++ b/sources/pyside2/CMakeLists.txt
@@ -21,6 +21,27 @@ else()
find_package(PythonLibs 2.6)
endif()
+set(PYSIDE_VERSION_FILE_PATH "${CMAKE_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 PySide2 version. Error: ${PYSIDE_VERSION_OUTPUT_ERROR}")
+endif()
+
+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)
+
macro(get_python_extension_suffix)
# Result of imp.get_suffixes() depends on the platform, but generally looks something like:
# [('.cpython-34m-x86_64-linux-gnu.so', 'rb', 3), ('.cpython-34m.so', 'rb', 3),
@@ -160,19 +181,15 @@ if(NOT CMAKE_BUILD_TYPE)
endif()
set(BINDING_NAME PySide2)
-set(BINDING_API_MAJOR_VERSION "2")
-set(BINDING_API_MINOR_VERSION "0")
-set(BINDING_API_MICRO_VERSION "0")
-set(BINDING_API_RELEASE_LEVEL "alpha") # alpha, beta, rc, or final
-set(BINDING_API_SERIAL 0) # leave as 0 when release level is final
-set(BINDING_API_VERSION "${BINDING_API_MAJOR_VERSION}.${BINDING_API_MINOR_VERSION}.${BINDING_API_MICRO_VERSION}" CACHE STRING "PySide version" FORCE)
+
+set(BINDING_API_VERSION "${BINDING_API_MAJOR_VERSION}.${BINDING_API_MINOR_VERSION}.${BINDING_API_MICRO_VERSION}" CACHE STRING "PySide2 version" FORCE)
set(PYSIDE_SO_VERSION ${BINDING_API_MAJOR_VERSION}.${BINDING_API_MINOR_VERSION})
-if (BINDING_API_RELEASE_LEVEL STREQUAL "final")
+if (BINDING_API_PRE_RELEASE_VERSION_TYPE STREQUAL "")
set(BINDING_API_VERSION_FULL "${BINDING_API_MAJOR_VERSION}.${BINDING_API_MINOR_VERSION}.${BINDING_API_MICRO_VERSION}"
- CACHE STRING "PySide version [full]" FORCE)
+ CACHE STRING "PySide2 version [full]" FORCE)
else()
- set(BINDING_API_VERSION_FULL "${BINDING_API_MAJOR_VERSION}.${BINDING_API_MINOR_VERSION}.${BINDING_API_MICRO_VERSION}~${BINDING_API_RELEASE_LEVEL}${BINDING_API_SERIAL}"
- CACHE STRING "PySide version [full]" FORCE)
+ set(BINDING_API_VERSION_FULL "${BINDING_API_MAJOR_VERSION}.${BINDING_API_MINOR_VERSION}.${BINDING_API_MICRO_VERSION}~${BINDING_API_PRE_RELEASE_VERSION_TYPE}${BINDING_API_PRE_RELEASE_VERSION}"
+ CACHE STRING "PySide2 version [full]" FORCE)
endif()
string(TIMESTAMP PYSIDE_BUILD_DATE "%Y-%m-%dT%H:%M:%S+00:00" UTC)
@@ -180,6 +197,19 @@ if (PYSIDE_BUILD_DATE)
set(PYSIDE_BUILD_DATE "__build_date__ = '${PYSIDE_BUILD_DATE}'")
endif()
+if (PYSIDE_SETUP_PY_PACKAGE_VERSION)
+ set(PYSIDE_SETUP_PY_PACKAGE_VERSION_ASSIGNMENT "__setup_py_package_version__ = '${PYSIDE_SETUP_PY_PACKAGE_VERSION}'")
+ set(FINAL_PACKAGE_VERSION ${PYSIDE_SETUP_PY_PACKAGE_VERSION})
+else()
+ set(FINAL_PACKAGE_VERSION ${BINDING_API_VERSION_FULL})
+endif()
+
+if (PYSIDE_SETUP_PY_PACKAGE_TIMESTAMP)
+ set(PYSIDE_SETUP_PY_PACKAGE_TIMESTAMP_ASSIGNMENT "__setup_py_package_timestamp__ = '${PYSIDE_SETUP_PY_PACKAGE_TIMESTAMP}'")
+else()
+ set(PYSIDE_SETUP_PY_PACKAGE_TIMESTAMP_ASSIGNMENT "__setup_py_package_timestamp__ = ''")
+endif()
+
find_package(Git)
if(GIT_FOUND)
# Check if current source folder is inside a git repo, so that commit information can be
@@ -221,11 +251,6 @@ if(GIT_FOUND)
endif()
endif()
-# Used by setup.py to know which symlink to resolve and copy in to the final package, in order to
-# avoid resolving all symlinks and thus copying unnecessary duplicate files.
-set(config_py_shiboken_library_version "")
-set(config_py_pyside_library_version "")
-
include(PySideModules)
macro(COLLECT_MODULE_IF_FOUND shortname)
@@ -346,8 +371,6 @@ endif()
# Define supported Qt Version
set(SUPPORTED_QT_VERSION "${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}")
-set(BINDING_VERSION ${BINDING_API_VERSION}.${QT_VERSION_MAJOR}.${QT_VERSION_MINOR})
-
# uninstall target
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
@@ -356,16 +379,6 @@ add_custom_target(uninstall "${CMAKE_COMMAND}"
-P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
-set(ARCHIVE_NAME pyside-qt${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}+${BINDING_API_VERSION_FULL})
-add_custom_target(dist
- COMMAND mkdir -p "${CMAKE_BINARY_DIR}/${ARCHIVE_NAME}" &&
- git log > "${CMAKE_BINARY_DIR}/${ARCHIVE_NAME}/ChangeLog" &&
- git archive --prefix=${ARCHIVE_NAME}/ HEAD --format=tar --output="${CMAKE_BINARY_DIR}/${ARCHIVE_NAME}.tar" &&
- tar -C "${CMAKE_BINARY_DIR}" --owner=root --group=root -r "${ARCHIVE_NAME}/ChangeLog" -f "${CMAKE_BINARY_DIR}/${ARCHIVE_NAME}.tar" &&
- bzip2 -f9 "${CMAKE_BINARY_DIR}/${ARCHIVE_NAME}.tar" &&
- echo "Source package created at ${CMAKE_BINARY_DIR}/${ARCHIVE_NAME}.tar.bz2.\n"
- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
-
if (NOT PYTHON_SITE_PACKAGES)
execute_process(
COMMAND ${SHIBOKEN_PYTHON_INTERPRETER} -c "if True:
diff --git a/sources/pyside2/PySide2/CMakeLists.txt b/sources/pyside2/PySide2/CMakeLists.txt
index 931842b00..02b4a7c16 100644
--- a/sources/pyside2/PySide2/CMakeLists.txt
+++ b/sources/pyside2/PySide2/CMakeLists.txt
@@ -10,6 +10,9 @@ configure_file("${CMAKE_CURRENT_SOURCE_DIR}/__init__.py.in"
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/_config.py.in"
"${CMAKE_CURRENT_BINARY_DIR}/_config.py" @ONLY)
+configure_file("${CMAKE_CURRENT_SOURCE_DIR}/../pyside_version.py"
+ "${CMAKE_CURRENT_BINARY_DIR}/_git_pyside_version.py" @ONLY)
+
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/support/__init__.py"
"${CMAKE_CURRENT_BINARY_DIR}/support/__init__.py" COPYONLY)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/support/signature/__init__.py"
@@ -48,6 +51,8 @@ install(FILES "${CMAKE_CURRENT_BINARY_DIR}/__init__.py"
DESTINATION "${PYTHON_SITE_PACKAGES}/${BINDING_NAME}${pyside2_SUFFIX}")
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/_config.py"
DESTINATION "${PYTHON_SITE_PACKAGES}/${BINDING_NAME}${pyside2_SUFFIX}")
+install(FILES "${CMAKE_CURRENT_BINARY_DIR}/_git_pyside_version.py"
+ DESTINATION "${PYTHON_SITE_PACKAGES}/${BINDING_NAME}${pyside2_SUFFIX}")
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/typesystem_templates.xml
DESTINATION share/PySide2${pyside_SUFFIX}/typesystems)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/pyside2_global.h
diff --git a/sources/pyside2/PySide2/__init__.py.in b/sources/pyside2/PySide2/__init__.py.in
index 92e52a81a..4ce266b69 100644
--- a/sources/pyside2/PySide2/__init__.py.in
+++ b/sources/pyside2/PySide2/__init__.py.in
@@ -1,14 +1,17 @@
__all__ = list("Qt" + body for body in
"@all_module_shortnames@"
.split(";"))
-__version__ = "@BINDING_API_VERSION_FULL@"
-__version_info__ = (@BINDING_API_MAJOR_VERSION@, @BINDING_API_MINOR_VERSION@, @BINDING_API_MICRO_VERSION@, "@BINDING_API_RELEASE_LEVEL@", @BINDING_API_SERIAL@)
+__version__ = "@FINAL_PACKAGE_VERSION@"
+__version_info__ = (@BINDING_API_MAJOR_VERSION@, @BINDING_API_MINOR_VERSION@, @BINDING_API_MICRO_VERSION@, "@BINDING_API_PRE_RELEASE_VERSION_TYPE@", @BINDING_API_PRE_RELEASE_VERSION@)
@PYSIDE_BUILD_DATE@
@PYSIDE_BUILD_COMMIT_DATE@
@PYSIDE_BUILD_COMMIT_HASH@
@PYSIDE_BUILD_COMMIT_HASH_DESCRIBED@
+# Timestamp used for snapshot build, which is part of snapshot package version.
+@PYSIDE_SETUP_PY_PACKAGE_TIMESTAMP_ASSIGNMENT@
+
def _setupQtDirectories():
import sys
import os
diff --git a/sources/pyside2/PySide2/_config.py.in b/sources/pyside2/PySide2/_config.py.in
index db8a17210..6f8d022dc 100644
--- a/sources/pyside2/PySide2/_config.py.in
+++ b/sources/pyside2/PySide2/_config.py.in
@@ -4,3 +4,14 @@ built_modules = list(name for name in
shiboken_library_soversion = str(@SHIBOKEN_SO_VERSION@)
pyside_library_soversion = str(@PYSIDE_SO_VERSION@)
+
+version = "@FINAL_PACKAGE_VERSION@"
+version_info = (@BINDING_API_MAJOR_VERSION@, @BINDING_API_MINOR_VERSION@, @BINDING_API_MICRO_VERSION@, "@BINDING_API_PRE_RELEASE_VERSION_TYPE@", @BINDING_API_PRE_RELEASE_VERSION@)
+
+@PYSIDE_BUILD_DATE@
+@PYSIDE_BUILD_COMMIT_DATE@
+@PYSIDE_BUILD_COMMIT_HASH@
+@PYSIDE_BUILD_COMMIT_HASH_DESCRIBED@
+
+# Timestamp used for snapshot build, which is part of snapshot package version.
+@PYSIDE_SETUP_PY_PACKAGE_TIMESTAMP_ASSIGNMENT@
diff --git a/sources/pyside2/pyside_version.py b/sources/pyside2/pyside_version.py
new file mode 100644
index 000000000..b207d6b9c
--- /dev/null
+++ b/sources/pyside2/pyside_version.py
@@ -0,0 +1,10 @@
+major_version = "5"
+minor_version = "6"
+patch_version = "0"
+pre_release_version_type = "a" # e.g. "a", "b", "rc".
+pre_release_version = "1" # e.g "1", "2", (which means "beta1", "beta2", if type is "b")
+
+if __name__ == '__main__':
+ # Used by CMake.
+ print('{0};{1};{2};{3};{4}'.format(major_version, minor_version, patch_version,
+ pre_release_version_type, pre_release_version))
diff --git a/sources/pyside2/tests/pysidetest/version_test.py b/sources/pyside2/tests/pysidetest/version_test.py
index 5901a56c1..01e88dbc6 100644
--- a/sources/pyside2/tests/pysidetest/version_test.py
+++ b/sources/pyside2/tests/pysidetest/version_test.py
@@ -33,8 +33,10 @@ from PySide2 import __version_info__, __version__, QtCore
class CheckForVariablesTest(unittest.TestCase):
def testVesions(self):
- self.assertTrue(__version_info__ >= (1, 0, 0))
- self.assertTrue(__version_info__ < (99, 99, 99))
+ version_tuple = (__version_info__[0], __version_info__[1], __version_info__[2])
+ self.assertTrue(version_tuple >= (1, 0, 0))
+
+ self.assertTrue(version_tuple < (99, 99, 99))
self.assertTrue(__version__)
self.assertTrue(QtCore.__version_info__ >= (4, 5, 0))
diff --git a/sources/shiboken2/CMakeLists.txt b/sources/shiboken2/CMakeLists.txt
index c5cca506e..5735fea18 100644
--- a/sources/shiboken2/CMakeLists.txt
+++ b/sources/shiboken2/CMakeLists.txt
@@ -11,12 +11,6 @@ find_package(Qt5 REQUIRED COMPONENTS Core Xml XmlPatterns)
add_definitions(${Qt5Core_DEFINITIONS})
-set(shiboken_MAJOR_VERSION "2")
-set(shiboken_MINOR_VERSION "0")
-set(shiboken_MICRO_VERSION "0")
-set(shiboken2_VERSION "${shiboken_MAJOR_VERSION}.${shiboken_MINOR_VERSION}.${shiboken_MICRO_VERSION}")
-set(shiboken2_library_so_version "${shiboken_MAJOR_VERSION}.${shiboken_MINOR_VERSION}")
-
option(BUILD_TESTS "Build tests." TRUE)
option(USE_PYTHON_VERSION "Use specific python version to build shiboken2." "")
@@ -28,6 +22,31 @@ else()
find_package(PythonLibs 2.6)
endif()
+set(SHIBOKEN_VERSION_FILE_PATH "${CMAKE_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(shiboken2_VERSION "${shiboken_MAJOR_VERSION}.${shiboken_MINOR_VERSION}.${shiboken_MICRO_VERSION}")
+set(shiboken2_library_so_version "${shiboken_MAJOR_VERSION}.${shiboken_MINOR_VERSION}")
+
## For debugging the PYTHON* variables
message("PYTHONLIBS_FOUND: " ${PYTHONLIBS_FOUND})
message("PYTHON_LIBRARIES: " ${PYTHON_LIBRARIES})
@@ -279,16 +298,3 @@ else()
endif()
add_subdirectory(data)
-
-# dist target
-set(ARCHIVE_NAME ${CMAKE_PROJECT_NAME}-${shiboken2_VERSION})
-add_custom_target(dist
- COMMAND mkdir -p "${CMAKE_BINARY_DIR}/${ARCHIVE_NAME}" &&
- git log > "${CMAKE_BINARY_DIR}/${ARCHIVE_NAME}/ChangeLog" &&
- git archive --prefix=${ARCHIVE_NAME}/ HEAD --format=tar --output="${CMAKE_BINARY_DIR}/${ARCHIVE_NAME}.tar" &&
- tar -C "${CMAKE_BINARY_DIR}" --owner=root --group=root -r "${ARCHIVE_NAME}/ChangeLog" -f "${CMAKE_BINARY_DIR}/${ARCHIVE_NAME}.tar" &&
- bzip2 -f9 "${CMAKE_BINARY_DIR}/${ARCHIVE_NAME}.tar" &&
- echo "Source package created at ${CMAKE_BINARY_DIR}/${ARCHIVE_NAME}.tar.bz2."
- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
-
-
diff --git a/sources/shiboken2/shiboken_version.py b/sources/shiboken2/shiboken_version.py
new file mode 100644
index 000000000..b207d6b9c
--- /dev/null
+++ b/sources/shiboken2/shiboken_version.py
@@ -0,0 +1,10 @@
+major_version = "5"
+minor_version = "6"
+patch_version = "0"
+pre_release_version_type = "a" # e.g. "a", "b", "rc".
+pre_release_version = "1" # e.g "1", "2", (which means "beta1", "beta2", if type is "b")
+
+if __name__ == '__main__':
+ # Used by CMake.
+ print('{0};{1};{2};{3};{4}'.format(major_version, minor_version, patch_version,
+ pre_release_version_type, pre_release_version))
diff --git a/utils.py b/utils.py
index acc9ec0f6..1e23a89c4 100644
--- a/utils.py
+++ b/utils.py
@@ -890,3 +890,14 @@ def memoize(function):
memo[args] = rv
return rv
return wrapper
+
+def get_python_dict(python_script_path):
+ try:
+ with open(python_script_path) as f:
+ python_dict = {}
+ code = compile(f.read(), python_script_path, 'exec')
+ exec(code, {}, python_dict)
+ return python_dict
+ except IOError as e:
+ print("get_python_dict: Couldn't get dict from python file: {}.".format(python_script_path))
+ raise