diff options
| author | Eike Ziller <eike.ziller@qt.io> | 2020-02-18 13:37:24 +0100 |
|---|---|---|
| committer | Eike Ziller <eike.ziller@qt.io> | 2020-02-19 09:56:08 +0000 |
| commit | 8a18ccdef9790a364ec2140f64627bd1555d418f (patch) | |
| tree | 5bb155f6ab4b9a1763a4bbe107a0d1cfab271467 /scripts/common.py | |
| parent | faf7e8f49ac33e1d65d2ec70cf8ccf6a371dce38 (diff) | |
Add script for building Qt Creator for packaging
The result is a number of 7zips in the build directory
that can be packaged in an installer, or unzipped
on a different machine directly
Change-Id: Ic1a691678b2268c08e9159c1958dbecefc640fc3
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Diffstat (limited to 'scripts/common.py')
| -rw-r--r-- | scripts/common.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/scripts/common.py b/scripts/common.py index db97ea35616..5bb52633f8c 100644 --- a/scripts/common.py +++ b/scripts/common.py @@ -40,6 +40,33 @@ def is_linux_platform(): def is_mac_platform(): return sys.platform.startswith('darwin') +def check_print_call(command, workdir): + print('------------------------------------------') + print('COMMAND:') + print(' '.join(['"' + c.replace('"', '\\"') + '"' for c in command])) + print('PWD: "' + workdir + '"') + print('------------------------------------------') + subprocess.check_call(command, cwd=workdir) + + +def get_git_SHA(path): + try: + return subprocess.check_output(['git', 'rev-list', '-n1', 'HEAD'], cwd=path).strip() + except subprocess.CalledProcessError: + return None + return None + + +# get commit SHA either directly from git, or from a .tag file in the source directory +def get_commit_SHA(path): + git_sha = get_git_SHA(path) + if not git_sha: + tagfile = os.path.join(path, '.tag') + if os.path.exists(tagfile): + with open(tagfile, 'r') as f: + git_sha = f.read().strip() + return git_sha + # copy of shutil.copytree that does not bail out if the target directory already exists # and that does not create empty directories def copytree(src, dst, symlinks=False, ignore=None): |
