summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Frysinger <vapier@google.com>2022-09-12 14:17:50 -0400
committerMike Frysinger <vapier@google.com>2022-09-12 19:27:09 +0000
commit45ef9011c29b342f0c61e3ebe430ffff09e65501 (patch)
tree3efdca066ec739b61db17af12834a6e4c06b5c0e
parent891e8f72ce3551a19c377456574bbfbeac5c8b8e (diff)
downloadgit-repo-45ef9011c29b342f0c61e3ebe430ffff09e65501.tar.gz
update-manpages: force use of active interp
Since the repo wrapper uses #!/usr/bin/python, use the python3 that this wrapper is actively using. Change-Id: I03d1e54418d18a504eec628e549b4cc233621c45 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/345294 Reviewed-by: LaMont Jones <lamontjones@google.com> Tested-by: Mike Frysinger <vapier@google.com>
-rwxr-xr-xrelease/update-manpages14
1 files changed, 11 insertions, 3 deletions
diff --git a/release/update-manpages b/release/update-manpages
index ddbce0cc..d619cf0b 100755
--- a/release/update-manpages
+++ b/release/update-manpages
@@ -59,18 +59,26 @@ def main(argv):
59 version = RepoSourceVersion() 59 version = RepoSourceVersion()
60 cmdlist = [['help2man', '-N', '-n', f'repo {cmd} - manual page for repo {cmd}', 60 cmdlist = [['help2man', '-N', '-n', f'repo {cmd} - manual page for repo {cmd}',
61 '-S', f'repo {cmd}', '-m', 'Repo Manual', f'--version-string={version}', 61 '-S', f'repo {cmd}', '-m', 'Repo Manual', f'--version-string={version}',
62 '-o', MANDIR.joinpath(f'repo-{cmd}.1.tmp'), TOPDIR.joinpath('repo'), 62 '-o', MANDIR.joinpath(f'repo-{cmd}.1.tmp'), './repo',
63 '-h', f'help {cmd}'] for cmd in subcmds.all_commands] 63 '-h', f'help {cmd}'] for cmd in subcmds.all_commands]
64 cmdlist.append(['help2man', '-N', '-n', 'repository management tool built on top of git', 64 cmdlist.append(['help2man', '-N', '-n', 'repository management tool built on top of git',
65 '-S', 'repo', '-m', 'Repo Manual', f'--version-string={version}', 65 '-S', 'repo', '-m', 'Repo Manual', f'--version-string={version}',
66 '-o', MANDIR.joinpath('repo.1.tmp'), TOPDIR.joinpath('repo'), 66 '-o', MANDIR.joinpath('repo.1.tmp'), './repo',
67 '-h', '--help-all']) 67 '-h', '--help-all'])
68 68
69 with tempfile.TemporaryDirectory() as tempdir: 69 with tempfile.TemporaryDirectory() as tempdir:
70 repo_dir = Path(tempdir) / '.repo' 70 tempdir = Path(tempdir)
71 repo_dir = tempdir / '.repo'
71 repo_dir.mkdir() 72 repo_dir.mkdir()
72 (repo_dir / 'repo').symlink_to(TOPDIR) 73 (repo_dir / 'repo').symlink_to(TOPDIR)
73 74
75 # Create a repo wrapper using the active Python executable. We can't pass
76 # this directly to help2man as it's too simple, so insert it via shebang.
77 data = (TOPDIR / 'repo').read_text(encoding='utf-8')
78 tempbin = tempdir / 'repo'
79 tempbin.write_text(f'#!{sys.executable}\n' + data, encoding='utf-8')
80 tempbin.chmod(0o755)
81
74 # Run all cmd in parallel, and wait for them to finish. 82 # Run all cmd in parallel, and wait for them to finish.
75 with multiprocessing.Pool() as pool: 83 with multiprocessing.Pool() as pool:
76 pool.map(partial(worker, cwd=tempdir, check=True), cmdlist) 84 pool.map(partial(worker, cwd=tempdir, check=True), cmdlist)