diff options
-rw-r--r-- | coin/instructions/execute_build_instructions.yaml | 12 | ||||
-rw-r--r-- | coin/instructions/execute_license_check.yaml | 2 | ||||
-rw-r--r-- | coin/instructions/execute_test_instructions.yaml | 8 | ||||
-rw-r--r-- | coin_build_instructions.py | 132 | ||||
-rw-r--r-- | coin_test_instructions.py | 138 | ||||
-rw-r--r-- | testing/wheel_tester.py | 9 |
6 files changed, 210 insertions, 91 deletions
diff --git a/coin/instructions/execute_build_instructions.yaml b/coin/instructions/execute_build_instructions.yaml index ef63c6e22..cf2eb7b36 100644 --- a/coin/instructions/execute_build_instructions.yaml +++ b/coin/instructions/execute_build_instructions.yaml @@ -11,7 +11,7 @@ instructions: userMessageOnFailure: > Failed to install setuptools on osx - type: ExecuteCommand - command: "python3 -u coin_build_instructions.py --os={{.Env.CI_OS}} {{.Env.CI_PACKAGING_FEATURE}} {{.Env.CI_USE_SCCACHE}} --instdir=/Users/qt/work/install --targetOs={{.Env.CI_OS}} --hostArch=X86_64 --targetArch={{.Env.CI_TARGET_ARCHITECTURE}} --phase=ALL" + command: "python3 -u coin_build_instructions.py --os={{.Env.CI_OS}} {{.Env.CI_PACKAGING_FEATURE}} {{.Env.CI_USE_SCCACHE}} --instdir=/Users/qt/work/install --targetOs={{.Env.CI_OS}} --hostArch=X86_64 --targetArch={{.Env.CI_TARGET_ARCHITECTURE}} --phase=ALL --pypy" maxTimeInSeconds: 14400 maxTimeBetweenOutput: 1200 enable_if: @@ -26,7 +26,7 @@ instructions: userMessageOnFailure: > Failed to execute build instructions on osx - type: ExecuteCommand - command: "python3 -u coin_build_instructions.py --os={{.Env.CI_OS}} {{.Env.CI_PACKAGING_FEATURE}} {{.Env.CI_USE_SCCACHE}} --instdir=/Users/qt/work/install --targetOs={{.Env.CI_OS}} --hostArch=X86_64 --targetArch=X86_64-ARM64 --phase=ALL" + command: "python3 -u coin_build_instructions.py --os={{.Env.CI_OS}} {{.Env.CI_PACKAGING_FEATURE}} {{.Env.CI_USE_SCCACHE}} --instdir=/Users/qt/work/install --targetOs={{.Env.CI_OS}} --hostArch=X86_64 --targetArch=X86_64-ARM64 --phase=ALL --pypy" maxTimeInSeconds: 14400 maxTimeBetweenOutput: 1200 enable_if: @@ -41,7 +41,7 @@ instructions: userMessageOnFailure: > Failed to execute build instructions on osx - type: ExecuteCommand - command: "python3 -u coin_build_instructions.py --os={{.Env.CI_OS}} {{.Env.CI_PACKAGING_FEATURE}} {{.Env.CI_USE_SCCACHE}} --instdir=/home/qt/work/install --targetOs={{.Env.CI_OS}} --hostArch=X86_64 --targetArch={{.Env.CI_TARGET_ARCHITECTURE}} --phase=ALL" + command: "python3 -u coin_build_instructions.py --os={{.Env.CI_OS}} {{.Env.CI_PACKAGING_FEATURE}} {{.Env.CI_USE_SCCACHE}} --instdir=/home/qt/work/install --targetOs={{.Env.CI_OS}} --hostArch=X86_64 --targetArch={{.Env.CI_TARGET_ARCHITECTURE}} --phase=ALL --pypy" maxTimeInSeconds: 14400 maxTimeBetweenOutput: 600 enable_if: @@ -51,7 +51,7 @@ instructions: userMessageOnFailure: > Failed to execute build instructions on Linux - type: ExecuteCommand - command: "c:\\users\\qt\\MSVC.bat {{.Env.PYTHON3_PATH}}\\python.exe -u coin_build_instructions.py --os={{.Env.CI_OS}} {{.Env.CI_PACKAGING_FEATURE}} {{.Env.CI_USE_SCCACHE}} --instdir=\\Users\\qt\\work\\install --targetOs={{.Env.CI_OS}} --hostArch=X86_64 --targetArch={{.Env.CI_TARGET_ARCHITECTURE}} --phase=BUILD" + command: "c:\\users\\qt\\MSVC.bat {{.Env.PYTHON3_PATH}}\\python.exe -u coin_build_instructions.py --os={{.Env.CI_OS}} {{.Env.CI_PACKAGING_FEATURE}} {{.Env.CI_USE_SCCACHE}} --instdir=\\Users\\qt\\work\\install --targetOs={{.Env.CI_OS}} --hostArch=X86_64 --targetArch={{.Env.CI_TARGET_ARCHITECTURE}} --phase=BUILD --pypy" maxTimeInSeconds: 14400 maxTimeBetweenOutput: 600 enable_if: @@ -61,7 +61,7 @@ instructions: userMessageOnFailure: > Failed to execute build instructions on Windows - type: SignPackage - directory: "{{.AgentWorkingDir}}\\pyside\\pyside-setup\\build\\qfpa-p3.6\\package_for_wheels" + directory: "{{.AgentWorkingDir}}\\pyside\\pyside-setup\\build\\qfp-p3.8\\package_for_wheels" maxTimeInSeconds: 1200 maxTimeBetweenOutput: 1200 enable_if: @@ -75,7 +75,7 @@ instructions: property: host.os equals_value: Windows - type: ExecuteCommand - command: "c:\\users\\qt\\MSVC.bat {{.Env.PYTHON3_PATH}}\\python.exe -u coin_build_instructions.py --os={{.Env.CI_OS}} {{.Env.CI_PACKAGING_FEATURE}} {{.Env.CI_USE_SCCACHE}} --instdir=\\Users\\qt\\work\\install --targetOs={{.Env.CI_OS}} --hostArch=X86_64 --targetArch={{.Env.CI_TARGET_ARCHITECTURE}} --phase=WHEEL" + command: "c:\\users\\qt\\MSVC.bat {{.Env.PYTHON3_PATH}}\\python.exe -u coin_build_instructions.py --os={{.Env.CI_OS}} {{.Env.CI_PACKAGING_FEATURE}} {{.Env.CI_USE_SCCACHE}} --instdir=\\Users\\qt\\work\\install --targetOs={{.Env.CI_OS}} --hostArch=X86_64 --targetArch={{.Env.CI_TARGET_ARCHITECTURE}} --phase=WHEEL --pypy" maxTimeInSeconds: 14400 maxTimeBetweenOutput: 300 enable_if: diff --git a/coin/instructions/execute_license_check.yaml b/coin/instructions/execute_license_check.yaml index 0bf4d3ca1..e8e5cbe9c 100644 --- a/coin/instructions/execute_license_check.yaml +++ b/coin/instructions/execute_license_check.yaml @@ -6,7 +6,7 @@ instructions: maxTimeInSeconds: 600 maxTimeBetweenOutput: 600 project: qt/qtbase - ref: "CURRENT_BRANCH" + ref: 6.3 directory: qt/qtbase userMessageOnFailure: > Could not install source archive. Please investigate why. diff --git a/coin/instructions/execute_test_instructions.yaml b/coin/instructions/execute_test_instructions.yaml index 1c8c9a919..7faf58268 100644 --- a/coin/instructions/execute_test_instructions.yaml +++ b/coin/instructions/execute_test_instructions.yaml @@ -5,7 +5,7 @@ enable_if: not_contains_value: LicenseCheck instructions: - type: ExecuteCommand - command: "python3 -u coin_test_instructions.py --os={{.Env.CI_OS}} {{.Env.CI_PACKAGING_FEATURE}} --instdir=/Users/qt/work/install --targetOs={{.Env.CI_OS}} --hostArch=ARM64 --targetArch={{.Env.CI_TARGET_ARCHITECTURE}}" + command: "echo not supported" maxTimeInSeconds: 14400 maxTimeBetweenOutput: 1200 enable_if: @@ -20,7 +20,7 @@ instructions: userMessageOnFailure: > Failed to execute test instructions on arm mac - type: ExecuteCommand - command: "python3 -u coin_test_instructions.py --os={{.Env.CI_OS}} {{.Env.CI_PACKAGING_FEATURE}} --instdir=/Users/qt/work/install --targetOs={{.Env.CI_OS}} --hostArch=X86_64 --targetArch={{.Env.CI_TARGET_ARCHITECTURE}}" + command: "python3 -u coin_test_instructions.py --os={{.Env.CI_OS}} {{.Env.CI_PACKAGING_FEATURE}} --instdir=/Users/qt/work/install --targetOs={{.Env.CI_OS}} --hostArch=X86_64 --targetArch={{.Env.CI_TARGET_ARCHITECTURE}} --pypy" maxTimeInSeconds: 14400 maxTimeBetweenOutput: 1200 enable_if: @@ -35,7 +35,7 @@ instructions: userMessageOnFailure: > Failed to execute test instructions on osx - type: ExecuteCommand - command: "python3 -u coin_test_instructions.py --os={{.Env.CI_OS}} {{.Env.CI_PACKAGING_FEATURE}} --instdir=/home/qt/work/install --targetOs={{.Env.CI_OS}} --hostArch=X86_64 --targetArch={{.Env.CI_TARGET_ARCHITECTURE}}" + command: "python3 -u coin_test_instructions.py --os={{.Env.CI_OS}} {{.Env.CI_PACKAGING_FEATURE}} --instdir=/home/qt/work/install --targetOs={{.Env.CI_OS}} --hostArch=X86_64 --targetArch={{.Env.CI_TARGET_ARCHITECTURE}} --pypy" maxTimeInSeconds: 14400 maxTimeBetweenOutput: 600 enable_if: @@ -45,7 +45,7 @@ instructions: userMessageOnFailure: > Failed to execute test instructions on Linux - type: ExecuteCommand - command: "c:\\users\\qt\\MSVC.bat {{.Env.PYTHON3_PATH}}\\python.exe -u coin_test_instructions.py --os={{.Env.CI_OS}} {{.Env.CI_PACKAGING_FEATURE}} --instdir=\\Users\\qt\\work\\install --targetOs={{.Env.CI_OS}} --hostArch=X86_64 --targetArch={{.Env.CI_TARGET_ARCHITECTURE}}" + command: "c:\\users\\qt\\MSVC.bat {{.Env.PYTHON3_PATH}}\\python.exe -u coin_test_instructions.py --os={{.Env.CI_OS}} {{.Env.CI_PACKAGING_FEATURE}} --instdir=\\Users\\qt\\work\\install --targetOs={{.Env.CI_OS}} --hostArch=X86_64 --targetArch={{.Env.CI_TARGET_ARCHITECTURE}} --pypy" maxTimeInSeconds: 14400 maxTimeBetweenOutput: 600 enable_if: diff --git a/coin_build_instructions.py b/coin_build_instructions.py index 97c6e4f98..0501e6e00 100644 --- a/coin_build_instructions.py +++ b/coin_build_instructions.py @@ -42,6 +42,9 @@ import os import os.path import site import sys +from os.path import expanduser +import pathlib +import urllib.request as urllib from build_scripts.options import has_option, log, option_value from build_scripts.utils import (expand_clang_variables, get_ci_qtpaths_path, @@ -67,11 +70,11 @@ _ci_features = option_value("features") if _ci_features is not None: for f in _ci_features.split(', '): CI_FEATURES.append(f) -CI_RELEASE_CONF = has_option("packaging") +CI_RELEASE_CONF = has_option("packaging") CI_TEST_PHASE = option_value("phase") if CI_TEST_PHASE not in ["ALL", "BUILD", "WHEEL"]: CI_TEST_PHASE = "ALL" - +CI_TEST_WITH_PYPY = has_option("pypy") def get_current_script_path(): """ Returns the absolute path containing this script. """ @@ -104,37 +107,42 @@ def is_snapshot_build(): return True return False - -def call_setup(python_ver, phase): +def call_setup(python_ver, phase, pypy): print("call_setup") print("python_ver", python_ver) print("phase", phase) - _pExe, _env, env_pip, env_python = get_qtci_virtualEnv(python_ver, CI_HOST_OS, CI_HOST_ARCH, CI_TARGET_ARCH) + env_python = "" + if python_ver == "pypy": + print("running with " + pypy) + env_python = pypy + else: + _pExe, _env, env_pip, env_python = get_qtci_virtualEnv(python_ver, CI_HOST_OS, CI_HOST_ARCH, CI_TARGET_ARCH) + + if phase in ["BUILD"]: + remove_tree(_env, True) + # Pinning the virtualenv before creating one + # Use pip3 if possible while pip seems to install the virtualenv to wrong dir in some OS + python3 = "python3" + if sys.platform == "win32": + python3 = os.path.join(os.getenv("PYTHON3_PATH"), "python.exe") + run_instruction([python3, "-m", "pip", "install", "--user", "virtualenv==20.7.2"], "Failed to pin virtualenv") + # installing to user base might not be in PATH by default. + env_path = os.path.join(site.USER_BASE, "bin") + v_env = os.path.join(env_path, "virtualenv") + if sys.platform == "win32": + env_path = os.path.join(site.USER_BASE, "Scripts") + v_env = os.path.join(env_path, "virtualenv.exe") + try: + run_instruction([v_env, "--version"], "Using default virtualenv") + except Exception as e: + log.info("Failed to use the default virtualenv") + log.info(f"{type(e).__name__}: {e}") + v_env = "virtualenv" + run_instruction([v_env, "-p", _pExe, _env], "Failed to create virtualenv") + # When the 'python_ver' variable is empty, we are using Python 2 + # Pip is always upgraded when CI template is provisioned, upgrading it in later phase may cause perm issue + run_instruction([env_pip, "install", "-r", "requirements.txt"], "Failed to install dependencies") - if phase in ["BUILD"]: - remove_tree(_env, True) - # Pinning the virtualenv before creating one - # Use pip3 if possible while pip seems to install the virtualenv to wrong dir in some OS - python3 = "python3" - if sys.platform == "win32": - python3 = os.path.join(os.getenv("PYTHON3_PATH"), "python.exe") - run_instruction([python3, "-m", "pip", "install", "--user", "virtualenv==20.7.2"], "Failed to pin virtualenv") - # installing to user base might not be in PATH by default. - env_path = os.path.join(site.USER_BASE, "bin") - v_env = os.path.join(env_path, "virtualenv") - if sys.platform == "win32": - env_path = os.path.join(site.USER_BASE, "Scripts") - v_env = os.path.join(env_path, "virtualenv.exe") - try: - run_instruction([v_env, "--version"], "Using default virtualenv") - except Exception as e: - log.info("Failed to use the default virtualenv") - log.info(f"{type(e).__name__}: {e}") - v_env = "virtualenv" - run_instruction([v_env, "-p", _pExe, _env], "Failed to create virtualenv") - # When the 'python_ver' variable is empty, we are using Python 2 - # Pip is always upgraded when CI template is provisioned, upgrading it in later phase may cause perm issue - run_instruction([env_pip, "install", "-r", "requirements.txt"], "Failed to install dependencies") cmd = [env_python, "-u", "setup.py"] if phase in ["BUILD"]: @@ -151,7 +159,7 @@ def call_setup(python_ver, phase): if CI_USE_SCCACHE: cmd += [f"--compiler-launcher={CI_USE_SCCACHE}"] - cmd += ["--limited-api=yes"] + # not with pypy cmd += ["--limited-api=yes"] if is_snapshot_build(): cmd += ["--snapshot-build"] @@ -175,34 +183,82 @@ def call_setup(python_ver, phase): cmd = [env_python, "create_wheels.py"] run_instruction(cmd, "Failed to create new wheels", initial_env=env) +def install_pypy(): + localfile = None + home = expanduser("~") + file = "https://downloads.python.org/pypy/pypy3.8-v7.3.8-osx64.tar.bz2" + target =os.path.join(home, "work", "pypy-3.8") + pypy = os.path.join(target, "pypy3.8-v7.3.8-osx64", "bin", "pypy") + if sys.platform == "win32": + file = "http://ci-files01-hki.ci.local/input/pypy/pypy3.8-v7.3.8-win64.zip" + pypy = os.path.join(target, "pypy3.8-v7.3.8-win64", "pypy.exe") + if CI_HOST_OS == "Linux": + file = "https://downloads.python.org/pypy/pypy3.8-v7.3.8-linux64.tar.bz2" + pypy = os.path.join(target, "pypy3.8-v7.3.8-linux64", "bin", "pypy") + + for i in range(1, 10): + try: + log.info(f"Downloading fileUrl {file}, attempt #{i}") + localfile, info = urllib.urlretrieve(file) + break + except urllib.URLError: + pass + if not localfile: + log.error(f"Error downloading {file} : {info}") + raise RuntimeError(f" Error downloading {file}") + + pathlib.Path(target).mkdir(parents=True, exist_ok=True) + if sys.platform == "win32": + cmd = ["7z", "x", "-y", localfile, "-o"+target] + else: + cmd = ["tar", "xjf", localfile, "-C", target] + run_instruction(cmd, "Failed to extract pypy") + return pypy + + +def build_with_pypy(pypy): + run_instruction([pypy, "-m", "ensurepip"], "Failed to install pip") + cmd = [pypy, "-m", "pip", "install", "-r", "requirements.txt"] + run_instruction(cmd, "Failed to install requirements.txt") + + cmd = [pypy, "-m", "pip", "install", "numpy"] + run_instruction(cmd, "Failed to install numpy") + if __name__ == "__main__": # Remove some environment variables that impact cmake arch = '32' if CI_TARGET_ARCH == 'X86' else '64' expand_clang_variables(arch) + pypy = "" + p_ver = "3" for env_var in ['CC', 'CXX']: if os.environ.get(env_var): del os.environ[env_var] - python_ver = "3" - if CI_TARGET_OS in ["Linux"]: - python_ver = "3.8" wheel_package_dir = "qfpa-p3.6" - if CI_TARGET_OS in ["Windows"]: + + if CI_TEST_WITH_PYPY: + pypy = install_pypy() + build_with_pypy(pypy) + p_ver = "pypy" + wheel_package_dir = "qfp-p3.8" + if CI_TARGET_OS in ["Windows"] and not CI_TEST_WITH_PYPY: if os.environ.get('HOST_OSVERSION_COIN') == 'windows_10_21h2': - python_ver = "3.10.0" + p_ver = "3.10.0" wheel_package_dir = "qfpa-p3.10" else: - python_ver = "3.7.9" + p_ver = "3.7.9" wheel_package_dir = "qfpa-p3.7" + if CI_TEST_PHASE in ["ALL", "BUILD"]: - call_setup(python_ver, "BUILD") + call_setup(p_ver, "BUILD", pypy) # Until CI has a feature to set more dynamic signing dir, make sure it actually exist if os.environ.get("QTEST_ENVIRONMENT") == "ci" and sys.platform == "win32": + signing_dir = os.path.join(os.getcwd(), "build", wheel_package_dir, "package_for_wheels") print("Check for signing dir " + signing_dir) assert(os.path.isdir(signing_dir)) if CI_TEST_PHASE in ["ALL", "WHEEL"]: - call_setup(python_ver, "WHEEL") + call_setup(p_ver,"WHEEL", pypy) diff --git a/coin_test_instructions.py b/coin_test_instructions.py index 52c61d9eb..da53b1c12 100644 --- a/coin_test_instructions.py +++ b/coin_test_instructions.py @@ -39,6 +39,9 @@ import os import site import sys +from os.path import expanduser +import pathlib +import urllib.request as urllib from build_scripts.options import has_option, log, option_value from build_scripts.utils import (expand_clang_variables, get_ci_qmake_path, @@ -61,41 +64,43 @@ if _ci_features is not None: for f in _ci_features.split(', '): CI_FEATURES.append(f) CI_RELEASE_CONF = has_option("packaging") +CI_TEST_WITH_PYPY = has_option("pypy") -def call_testrunner(python_ver, buildnro): - _pExe, _env, env_pip, env_python = get_qtci_virtualEnv(python_ver, CI_HOST_OS, CI_HOST_ARCH, CI_TARGET_ARCH) - remove_tree(_env, True) - # Pinning the virtualenv before creating one - # Use pip3 if possible while pip seems to install the virtualenv to wrong dir in some OS - python3 = "python3" - if sys.platform == "win32": - python3 = os.path.join(os.getenv("PYTHON3_PATH"), "python.exe") - - # we shouldn't install anything to m1, while it is not virtualized - if CI_HOST_OS == "MacOS" and CI_HOST_ARCH == "ARM64": - v_env = "virtualenv" - run_instruction([v_env, "-p", _pExe, _env], "Failed to create virtualenv") +def call_testrunner(python_ver, buildnro, pypy=None): + env_python="" + if python_ver == "pypy": + print("running with " + pypy) + env_python = pypy else: - run_instruction([python3, "-m", "pip", "install", "--user", "virtualenv==20.7.2"], "Failed to pin virtualenv") - # installing to user base might not be in PATH by default. - env_path = os.path.join(site.USER_BASE, "bin") - v_env = os.path.join(env_path, "virtualenv") + _pExe, _env, env_pip, env_python = get_qtci_virtualEnv(python_ver, CI_HOST_OS, CI_HOST_ARCH, CI_TARGET_ARCH) + remove_tree(_env, True) + # Pinning the virtualenv before creating one + # Use pip3 if possible while pip seems to install the virtualenv to wrong dir in some OS + python3 = "python3" if sys.platform == "win32": - env_path = os.path.join(site.USER_BASE, "Scripts") - v_env = os.path.join(env_path, "virtualenv.exe") - try: - run_instruction([v_env, "--version"], "Using default virtualenv") - except Exception as e: - log.info("Failed to use the default virtualenv") - log.info(f"{type(e).__name__}: {e}") + python3 = os.path.join(os.getenv("PYTHON3_PATH"), "python.exe") + + if CI_HOST_OS == "MacOS" and CI_HOST_ARCH == "ARM64": # we shouldn't install anything to m1, while it is not virtualized v_env = "virtualenv" - run_instruction([v_env, "-p", _pExe, _env], "Failed to create virtualenv") - # When the 'python_ver' variable is empty, we are using Python 2 - # Pip is always upgraded when CI template is provisioned, upgrading it in later phase may cause perm issue - run_instruction([env_pip, "install", "-r", "requirements.txt"], "Failed to install dependencies") - # Install distro to replace missing platform.linux_distribution() in python3.8 - run_instruction([env_pip, "install", "distro"], "Failed to install distro") + run_instruction([v_env, "-p", _pExe, _env], "Failed to create virtualenv") + else: + run_instruction([python3, "-m", "pip", "install", "--user", "virtualenv==20.7.2"], "Failed to pin virtualenv") + # installing to user base might not be in PATH by default. + env_path = os.path.join(site.USER_BASE, "bin") + v_env = os.path.join(env_path, "virtualenv") + if sys.platform == "win32": + env_path = os.path.join(site.USER_BASE, "Scripts") + v_env = os.path.join(env_path, "virtualenv.exe") + try: + run_instruction([v_env, "--version"], "Using default virtualenv") + except Exception as e: + v_env = "virtualenv" + run_instruction([v_env, "-p", _pExe, _env], "Failed to create virtualenv") + # When the 'python_ver' variable is empty, we are using Python 2 + # Pip is always upgraded when CI template is provisioned, upgrading it in later phase may cause perm issue + run_instruction([env_pip, "install", "-r", "requirements.txt"], "Failed to install dependencies") + cmd = [env_python, "testrunner.py", "test", "--blacklist", "build_history/blacklist.txt", f"--buildno={buildnro}"] @@ -109,7 +114,8 @@ def call_testrunner(python_ver, buildnro): # Run the test for the old set of wheels cmd = [env_python, wheel_tester_path, qmake_path] run_instruction(cmd, "Error while running wheel_tester.py on old wheels") - + if python_ver == "pypy": + return # Uninstalling the other wheels run_instruction([env_pip, "uninstall", "shiboken6", "shiboken6_generator", "pyside6", "-y"], "Failed to uninstall old wheels") @@ -119,27 +125,77 @@ def call_testrunner(python_ver, buildnro): run_instruction(cmd, "Error while running wheel_tester.py on new wheels") +# move to utils +def install_pypy(): + localfile = None + home = expanduser("~") + file = "https://downloads.python.org/pypy/pypy3.8-v7.3.8-osx64.tar.bz2" + target =os.path.join(home, "work", "pypy-3.8") + pypy = os.path.join(target, "pypy3.8-v7.3.8-osx64", "bin", "pypy") + if sys.platform == "win32": + file = "http://ci-files01-hki.ci.local/input/pypy/pypy3.8-v7.3.8-win64.zip" + pypy = os.path.join(target, "pypy3.8-v7.3.8-win64", "pypy.exe") + if CI_HOST_OS == "Linux": + file = "https://downloads.python.org/pypy/pypy3.8-v7.3.8-linux64.tar.bz2" + pypy = os.path.join(target, "pypy3.8-v7.3.8-linux64", "bin", "pypy") + + for i in range(1, 10): + try: + log.info(f"Downloading fileUrl {file}, attempt #{i}") + localfile, info = urllib.urlretrieve(file) + break + except urllib.URLError: + pass + if not localfile: + log.error(f"Error downloading {file} : {info}") + raise RuntimeError(f" Error downloading {file}") + + pathlib.Path(target).mkdir(parents=True, exist_ok=True) + if sys.platform == "win32": + cmd = ["7z", "x", "-y", localfile, "-o"+target] + else: + cmd = ["tar", "xjf", localfile, "-C", target] + run_instruction(cmd, "Failed to extract pypy") + return pypy + +# move to utils and rename +def build_with_pypy(pypy): + run_instruction([pypy, "-m", "ensurepip"], "Failed to install pip") + cmd = [pypy, "-m", "pip", "install", "-r", "requirements.txt"] + run_instruction(cmd, "Failed to install requirements.txt") + + cmd = [pypy, "-m", "pip", "install", "numpy"] + run_instruction(cmd, "Failed to install numpy") + + def run_test_instructions(): # Remove some environment variables that impact cmake arch = '32' if CI_TARGET_ARCH == 'X86' else '64' + pypy = "" + p_ver = "3" expand_clang_variables(arch) for env_var in ['CC', 'CXX']: if os.environ.get(env_var): del os.environ[env_var] - os.chdir(CI_ENV_AGENT_DIR) testRun = 0 - # In win machines, there are additional python versions to test with - if CI_HOST_OS == "Windows": - if os.environ.get('HOST_OSVERSION_COIN') == 'windows_10_21h2': - call_testrunner("3.10.0", str(testRun)) - else: - call_testrunner("3.7.9", str(testRun)) - elif CI_HOST_OS == "Linux": - call_testrunner("3.8", str(testRun)) + if CI_TEST_WITH_PYPY: + pypy = install_pypy() + build_with_pypy(pypy) + p_ver = "pypy" + call_testrunner(p_ver, str(testRun), pypy) else: - call_testrunner("3", str(testRun)) + # In win machines, there are additional python versions to test with + if CI_HOST_OS == "Windows": + if os.environ.get('HOST_OSVERSION_COIN') == 'windows_10_21h2': + call_testrunner("3.10.0", str(testRun)) + else: + call_testrunner("3.7.9", str(testRun)) + elif CI_HOST_OS == "Linux": + call_testrunner("3.8", str(testRun)) + else: + call_testrunner("3", str(testRun)) if __name__ == "__main__": diff --git a/testing/wheel_tester.py b/testing/wheel_tester.py index c1552a9de..7425dd1b4 100644 --- a/testing/wheel_tester.py +++ b/testing/wheel_tester.py @@ -156,9 +156,13 @@ def try_install_wheels(wheels_dir, py_version): log.info(f"No wheels found in {wheels_dir}") log.info("") + py ="cp" + if hasattr(sys, 'pypy_version_info'): + py = "pypy" + for p in package_prefix_names(): log.info(f"Trying to install {p}:") - pattern = f"{p}-*cp{int(float(py_version))}*.whl" + pattern = f"{p}-*{py}{int(float(py_version))}*.whl" files = find_files_using_glob(wheels_dir, pattern) if files and len(files) == 1: wheel_path = files[0] @@ -348,6 +352,9 @@ def run_wheel_tests(install_wheels, wheels_dir_name): log.info("Attempting to install wheels.\n") try_install_wheels(wheels_dir, py_version) + if hasattr(sys, 'pypy_version_info'): + return + log.info("Attempting to build examples.\n") try_build_examples() |