diff options
| author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2018-05-18 16:45:35 +0200 |
|---|---|---|
| committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2018-05-18 16:45:35 +0200 |
| commit | 3f8c8702ea295f39357e7c66f46e5138f56bcc9f (patch) | |
| tree | 9ca65a7f94d544ba4b36f239c4a48852ad8a7b09 /build_scripts/utils.py | |
| parent | 5fce76074c01e52a22151133a1e3a2cf71cfe535 (diff) | |
| parent | df1a619d65d8e5db91f3c8db46b00872b461e334 (diff) | |
Merge remote-tracking branch 'origin/5.9' into 5.11
Change-Id: I20cf741f5b07426ad5113eb8c52f144102c331ce
Diffstat (limited to 'build_scripts/utils.py')
| -rw-r--r-- | build_scripts/utils.py | 40 |
1 files changed, 38 insertions, 2 deletions
diff --git a/build_scripts/utils.py b/build_scripts/utils.py index af40916b7..2dffd345c 100644 --- a/build_scripts/utils.py +++ b/build_scripts/utils.py @@ -409,7 +409,7 @@ def make_file_writable_by_owner(path): current_permissions = stat.S_IMODE(os.lstat(path).st_mode) os.chmod(path, current_permissions | stat.S_IWUSR) -def rmtree(dirname): +def rmtree(dirname, ignore=False): def handleRemoveReadonly(func, path, exc): excvalue = exc[1] if func in (os.rmdir, os.remove) and excvalue.errno == errno.EACCES: @@ -417,7 +417,7 @@ def rmtree(dirname): func(path) else: raise - shutil.rmtree(dirname, ignore_errors=False, onerror=handleRemoveReadonly) + shutil.rmtree(dirname, ignore_errors=ignore, onerror=handleRemoveReadonly) def run_process_output(args, initial_env=None): if initial_env is None: @@ -1081,3 +1081,39 @@ def get_python_dict(python_script_path): print("get_python_dict: Couldn't get dict from python " "file: {}.".format(python_script_path)) raise + +def install_pip_dependencies(env_pip, packages): + for p in packages: + run_instruction([env_pip, "install", p], "Failed to install " + p) + +def get_qtci_virtualEnv(python_ver, host, hostArch, targetArch): + _pExe = "python" + _env = "env" + str(python_ver) + env_python = _env + "/bin/python" + env_pip = _env + "/bin/pip" + + if host == "Windows": + print("New virtualenv to build " + targetArch + " in " + hostArch + " host.") + _pExe = "python.exe" + # With windows we are creating building 32-bit target in 64-bit host + if hostArch == "X86_64" and targetArch == "X86": + if python_ver == "3": + _pExe = os.path.join(os.getenv("PYTHON3_32_PATH"), "python.exe") + else: + _pExe = os.path.join(os.getenv("PYTHON2_32_PATH"), "python.exe") + else: + if python_ver == "3": + _pExe = os.path.join(os.getenv("PYTHON3_PATH"), "python.exe") + env_python = _env + "\\Scripts\\python.exe" + env_pip = _env + "\\Scripts\\pip.exe" + else: + if python_ver == "3": + _pExe = "python3" + return(_pExe, _env, env_pip, env_python) + +def run_instruction(instruction, error): + print("Running Coin instruction: " + ' '.join(str(e) for e in instruction)) + result = subprocess.call(instruction) + if result != 0: + print("ERROR : " + error) + exit(result) |
