From f71e58336b34940782d9742a1b9b4e413f525f0a Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Thu, 31 May 2018 14:11:13 +0200 Subject: Don't set --snapshot-build for official release builds on Coin This changes coin_build_instructions.py to read the version in sources/pyside2/pyside_version.py to check if it is not a pre-release version (no alphas, betas), which means that --snapshot-build should not be passed, thus generating proper wheel names that can be uploaded to PyPI. This eliminates the need to remove the --snapshot-build param on a per release branch basis (and thus, less things to remember for official releases). Change-Id: I10afcb5bfe8a661583104f3d7b2c0b4ebd4530fb Reviewed-by: Friedemann Kleint --- coin_build_instructions.py | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) (limited to 'coin_build_instructions.py') diff --git a/coin_build_instructions.py b/coin_build_instructions.py index 1a6e3dae3..c48f5e3b2 100644 --- a/coin_build_instructions.py +++ b/coin_build_instructions.py @@ -42,6 +42,7 @@ from build_scripts.utils import install_pip_dependencies 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 import os # Values must match COIN thrift @@ -60,6 +61,36 @@ if _ci_features is not None: CI_FEATURES.append(f) CI_RELEASE_CONF = has_option("packaging") +def get_current_script_path(): + """ Returns the absolute path containing this script. """ + try: + this_file = __file__ + except NameError: + this_file = sys.argv[0] + this_file = os.path.abspath(this_file) + return os.path.dirname(this_file) + +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 + pre-release version (no alphas, betas). + + This eliminates the need to remove the --snapshot-build option + on a per-release branch basis (less things to remember to do + for a release). + """ + setup_script_dir = get_current_script_path() + pyside_version_py = os.path.join( + setup_script_dir, "sources", "pyside2", "pyside_version.py") + d = get_python_dict(pyside_version_py) + + pre_release_version_type = d['pre_release_version_type'] + pre_release_version = d['pre_release_version'] + if pre_release_version or pre_release_version_type: + return True + return False def call_setup(python_ver): _pExe, _env, env_pip, env_python = get_qtci_virtualEnv(python_ver, CI_HOST_OS, CI_HOST_ARCH, CI_TARGET_ARCH) @@ -83,10 +114,11 @@ def call_setup(python_ver): cmd += ["--qmake=" + CI_ENV_INSTALL_DIR + "/bin/qmake"] cmd += ["--build-tests", "--jobs=4", - "--verbose-build", - "--snapshot-build"] + "--verbose-build"] if python_ver == "3": cmd += ["--limited-api=yes"] + if is_snapshot_build(): + cmd += ["--snapshot-build"] run_instruction(cmd, "Failed to run setup.py") -- cgit v1.2.3