Skip to content

Commit 260578b

Browse files
authored
Add workdir() method to UnixBuild (#462)
1 parent 9cceb2d commit 260578b

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

master/custom/factories.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,13 @@ class UnixBuild(BaseBuild):
6767
test_environ = {}
6868
build_out_of_tree = False
6969

70+
def workdir(self, *parts):
71+
"""Calculate the working dir to change to.
72+
73+
Designed to be used with the `workdir` argument to e.g. ShellCommand.
74+
"""
75+
return os.path.join("build", *parts)
76+
7077
def setup(self, parallel, branch, test_with_PTY=False, **kwargs):
7178
out_of_tree_dir = "build_oot"
7279

@@ -82,7 +89,7 @@ def setup(self, parallel, branch, test_with_PTY=False, **kwargs):
8289

8390
if self.build_out_of_tree:
8491
configure_cmd = "../configure"
85-
oot_kwargs = {'workdir': os.path.join("build", out_of_tree_dir)}
92+
oot_kwargs = {'workdir': self.workdir(out_of_tree_dir)}
8693
else:
8794
configure_cmd = "./configure"
8895
oot_kwargs = {}
@@ -686,7 +693,7 @@ def setup(self, parallel, branch, test_with_PTY=False, **kwargs):
686693
assert self.host is not None, "Must set self.host on cross builds"
687694

688695
out_of_tree_dir = "build_oot"
689-
oot_dir_path = os.path.join("build", out_of_tree_dir)
696+
oot_dir_path = self.workdir(out_of_tree_dir)
690697
oot_build_path = os.path.join(oot_dir_path, "build")
691698
oot_host_path = os.path.join(oot_dir_path, "host")
692699

@@ -873,7 +880,7 @@ def __init__(self, source, *, extra_tags=[], **kwargs):
873880

874881
def setup(self, parallel, branch, test_with_PTY=False, **kwargs):
875882
wasi_py = "Tools/wasm/wasi.py"
876-
host_path = "build/cross-build/wasm32-wasi"
883+
host_path = self.workdir("cross-build", "wasm32-wasi")
877884

878885
# Build Python
879886
build_configure = ["python3", wasi_py, "configure-build-python"]

0 commit comments

Comments
 (0)