diff options
author | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2022-07-28 18:33:43 +0200 |
---|---|---|
committer | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2022-07-28 18:33:43 +0200 |
commit | 72f2320ca52ee90d8d243aad9e8670883482eb09 (patch) | |
tree | 0fe74cf1ef45ba34b00ea69b6a6f9e2b31213d35 /bin/just-mr.py | |
parent | 3d6e428d1990bd17f01ccdc84881e114c05384b4 (diff) | |
download | justbuild-72f2320ca52ee90d8d243aad9e8670883482eb09.tar.gz |
Fix style in just-mr
Diffstat (limited to 'bin/just-mr.py')
-rwxr-xr-x | bin/just-mr.py | 38 |
1 files changed, 24 insertions, 14 deletions
diff --git a/bin/just-mr.py b/bin/just-mr.py index a9c4db8e..2e088279 100755 --- a/bin/just-mr.py +++ b/bin/just-mr.py @@ -62,8 +62,9 @@ def try_rmtree(tree): shutil.rmtree(tree) return except: - time.sleep(1.0) - fail("Failed to remove %s" % (tree,)) + time.sleep(1.0) + fail("Failed to remove %s" % (tree, )) + def move_to_place(src, dst): os.makedirs(os.path.dirname(dst), exist_ok=True) @@ -73,12 +74,21 @@ def move_to_place(src, dst): if not os.path.exists(dst): fail("Failed to move %s to %s: %s" % (src, dst, e)) if not os.path.exists(dst): - fail("%s not present after move" % (dst,)) + fail("%s not present after move" % (dst, )) + -def run_cmd(cmd, *, env=None, stdout=subprocess.DEVNULL, stdin=None, cwd, +def run_cmd(cmd, + *, + env=None, + stdout=subprocess.DEVNULL, + stdin=None, + cwd, attempts=1): for _ in range(attempts): - result = subprocess.run(cmd, cwd=cwd, env=env, stdout=stdout, + result = subprocess.run(cmd, + cwd=cwd, + env=env, + stdout=stdout, stdin=stdin) if result.returncode == 0: return @@ -119,15 +129,13 @@ def git_keep(commit, *, upstream): # for those, we assume the referenced commit is kept by # some branch anyway return - run_cmd( - [ - "git", "tag", "-f", "-m", "Keep referenced tree alive", - "keep-%s" % (commit, ), commit - ], - cwd=git_root(upstream=upstream), - env=dict(os.environ, **GIT_NOBODY_ENV), - attempts=3 - ) + run_cmd([ + "git", "tag", "-f", "-m", "Keep referenced tree alive", + "keep-%s" % (commit, ), commit + ], + cwd=git_root(upstream=upstream), + env=dict(os.environ, **GIT_NOBODY_ENV), + attempts=3) def git_init_options(*, upstream): @@ -455,10 +463,12 @@ def resolve_repo(desc, *, seen=None, repos): def distdir_repo_dir(content): return os.path.join(ROOT, "distdir", content) + def distdir_tmp_dir(content): return os.path.join(ROOT, "tmp-workspaces", "distdir", "%d-%s" % (os.getpid(), content)) + def distdir_tree_id_file(content): return os.path.join(ROOT, "distfiles-tree-map", content) |