From 0c51c4dd78c564eaf722a2735ef1f8236ce00a86 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Mon, 26 Feb 2018 15:51:53 +0100 Subject: Improve macOS minimum deployment target decision process Instead of asking the user to specify a minimum macOS deployment target, setup.py will now query the value from qmake. A user can still specify a custom value if they wish to do so. This simplifies building on the CI, meaning there is no need to hardcode the minimum deployment targets per branch. Task-number: PYSIDE-603 Task-number: PYSIDE-606 Change-Id: I55c79dc643b5a2b59d0e65add132c581fb6fc7f4 Reviewed-by: Friedemann Kleint --- utils.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'utils.py') diff --git a/utils.py b/utils.py index 6c3b90fb2..169e1218b 100644 --- a/utils.py +++ b/utils.py @@ -874,3 +874,17 @@ def rpathsHasOrigin(rpaths): if match: return True return False + +def memoize(function): + """ Decorator to wrap a function with a memoizing callable. + It returns cached values when the wrapped function is called with the same arguments. + """ + memo = {} + def wrapper(*args): + if args in memo: + return memo[args] + else: + rv = function(*args) + memo[args] = rv + return rv + return wrapper -- cgit v1.2.3 From 197d56d444e0368e07dd1e867c321d010f08f9f0 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Mon, 26 Feb 2018 15:58:24 +0100 Subject: Improve packaging on Windows A lot of the packaging rules on Windows were outdated (Qt4 times). This change does a couple of things to improve the process: - Removes attempts of copying files matching Qt4 naming patterns - Fixes filters to copy Qt dlls / pdbs for a single build configuration (only debug dlls, or only release dlls depending on which configuration was used when building PySide2). As a result this reduces the total size of the package. - Removes some comments that are outdated. - Simplifies pdb copying logic. - Adds a bit of whitespace between copying rules, for easier navigation. Change-Id: Icc06398f524f0249504750c718f97b61ffadf7df Reviewed-by: Friedemann Kleint --- utils.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'utils.py') diff --git a/utils.py b/utils.py index 169e1218b..acc9ec0f6 100644 --- a/utils.py +++ b/utils.py @@ -283,7 +283,7 @@ def makefile(dst, content=None, vars=None): def copydir(src, dst, filter=None, ignore=None, force=True, recursive=True, vars=None, - dir_filter_function=None, force_copy_symlinks=False): + dir_filter_function=None, file_filter_function=None, force_copy_symlinks=False): if vars is not None: src = src.format(**vars) @@ -317,10 +317,12 @@ def copydir(src, dst, filter=None, ignore=None, force=True, recursive=True, vars if recursive: results.extend( copydir(srcname, dstname, filter, ignore, force, recursive, - vars, dir_filter_function, force_copy_symlinks)) + vars, dir_filter_function, file_filter_function, + force_copy_symlinks)) else: - if (filter is not None and not filter_match(name, filter)) or \ - (ignore is not None and filter_match(name, ignore)): + if (file_filter_function is not None and not file_filter_function(name, srcname)) \ + or (filter is not None and not filter_match(name, filter)) \ + or (ignore is not None and filter_match(name, ignore)): continue if not os.path.exists(dst): os.makedirs(dst) -- cgit v1.2.3 From b57c557c8cd1012851f8a245075591dc33be425b Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Thu, 1 Mar 2018 11:50:07 +0100 Subject: Implement proper package versioning This change is inspired by / follows PEP 440 for handling version numbers and also takes into account the Qt versioning scheme. PySide2 as package name will stay as-is (not renamed to PySide5). Release versions would have the following pattern: PySide2 5.x.y (e.g. 5.6.3) Package (wheel) name would also contain the bundled Qt version, e.g.: PySide2-5.6.0-5.6.4-cp27-cp27m-macosx_10_7_intel.whl Pre-release versions would look like: PySide2 5.6.0a1, 5.6.0a2, 5.6.0b1, 5.6.0b2, 5.6.0rc1, etc. Development (snapshot) versions would look like: PySide2 5.6.0-dev123456789 (last part is timestamp of build time) All of the examples above comply with the PEP 440 rules. In the example above where the Qt version is specified as part of the wheel package name ("5.6.4"), the Qt version is not part of the package version itself, because it doesn't comply with PEP 440. But it does comply with wheel package names (PEP 427), and by that PEP's definitions, it will be the optional "build tag" part of the file name, which is preceded by the actual package version, and followed by the python version / abi tag. Implementation: This change defines two new python configuration files which will be the authoritative source for the shiboken and PySide2 libraries, as well as the final PySide2 package itself: sources/shiboken/shiboken_version.py sources/pyside2/pyside_version.py The pyside_version.py file will be the source of the final package version. The shiboken and PySide2 version should be modified in sync, when bumping the version of the package before a release. The reason for having both files instead of 1, is to make life easier for developers that might extract only shiboken from the repository. If at some point shiboken and PySide2 CMake projects get merged into one project, the duplicate version files would go away. The version files are parsed by CMake to correctly name the shared libraries (and SO versions), and they are also read by the setup.py script, to generate correct package metadata and a correct package (wheel) name. This change also removes the broken dist targets from PySide2's and shiboken's CMakelists files, which depended on some version suffix which was never set in setup.py. PEP440: https://www.python.org/dev/peps/pep-0440/ PEP427: https://www.python.org/dev/peps/pep-0427/ Change-Id: I3226460b1adf2555c8711fa2ba47c223b957cb44 Reviewed-by: Qt CI Bot Reviewed-by: Friedemann Kleint --- utils.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'utils.py') 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 -- cgit v1.2.3