Debian Codegraph @

tests/testutils/site.py

raw
1 import subprocess
2
3 from typing import Optional
4
5 from buildstream import utils, ProgramNotFoundError
6
7 GIT: Optional[str]
8 BZR: Optional[str]
9
10 try:
11 GIT = utils.get_host_tool("git")
12 HAVE_GIT = True
13
14 out = str(subprocess.check_output(["git", "--version"]), "utf-8")
15 # e.g. on Git for Windows we get "git version 2.21.0.windows.1".
16 # e.g. on Mac via Homebrew we get "git version 2.19.0".
17 version = tuple(int(x) for x in out.split(" ")[2].split(".")[:3])
18 HAVE_OLD_GIT = version < (1, 8, 5)
19
20 GIT_ENV = {
21 "GIT_AUTHOR_DATE": "1320966000 +0200",
22 "GIT_AUTHOR_NAME": "tomjon",
23 "GIT_AUTHOR_EMAIL": "[email protected]",
24 "GIT_COMMITTER_DATE": "1320966000 +0200",
25 "GIT_COMMITTER_NAME": "tomjon",
26 "GIT_COMMITTER_EMAIL": "[email protected]",
27 }
28 except ProgramNotFoundError:
29 GIT = None
30 HAVE_GIT = False
31 HAVE_OLD_GIT = False
32 GIT_ENV = {}
33
34 try:
35 BZR = utils.get_host_tool("bzr")
36 HAVE_BZR = True
37 # Breezy 3.0 supports `BRZ_EMAIL` but not `BZR_EMAIL`
38 BZR_ENV = {
39 "BZR_EMAIL": "Testy McTesterson <[email protected]>",
40 "BRZ_EMAIL": "Testy McTesterson <[email protected]>",
41 }
42 except ProgramNotFoundError:
43 BZR = None
44 HAVE_BZR = False
45 BZR_ENV = {}