mirror of
https://gerrit.googlesource.com/git-repo
synced 2024-12-21 07:16:21 +00:00
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>
This commit is contained in:
parent
891e8f72ce
commit
45ef9011c2
@ -59,18 +59,26 @@ def main(argv):
|
|||||||
version = RepoSourceVersion()
|
version = RepoSourceVersion()
|
||||||
cmdlist = [['help2man', '-N', '-n', f'repo {cmd} - manual page for repo {cmd}',
|
cmdlist = [['help2man', '-N', '-n', f'repo {cmd} - manual page for repo {cmd}',
|
||||||
'-S', f'repo {cmd}', '-m', 'Repo Manual', f'--version-string={version}',
|
'-S', f'repo {cmd}', '-m', 'Repo Manual', f'--version-string={version}',
|
||||||
'-o', MANDIR.joinpath(f'repo-{cmd}.1.tmp'), TOPDIR.joinpath('repo'),
|
'-o', MANDIR.joinpath(f'repo-{cmd}.1.tmp'), './repo',
|
||||||
'-h', f'help {cmd}'] for cmd in subcmds.all_commands]
|
'-h', f'help {cmd}'] for cmd in subcmds.all_commands]
|
||||||
cmdlist.append(['help2man', '-N', '-n', 'repository management tool built on top of git',
|
cmdlist.append(['help2man', '-N', '-n', 'repository management tool built on top of git',
|
||||||
'-S', 'repo', '-m', 'Repo Manual', f'--version-string={version}',
|
'-S', 'repo', '-m', 'Repo Manual', f'--version-string={version}',
|
||||||
'-o', MANDIR.joinpath('repo.1.tmp'), TOPDIR.joinpath('repo'),
|
'-o', MANDIR.joinpath('repo.1.tmp'), './repo',
|
||||||
'-h', '--help-all'])
|
'-h', '--help-all'])
|
||||||
|
|
||||||
with tempfile.TemporaryDirectory() as tempdir:
|
with tempfile.TemporaryDirectory() as tempdir:
|
||||||
repo_dir = Path(tempdir) / '.repo'
|
tempdir = Path(tempdir)
|
||||||
|
repo_dir = tempdir / '.repo'
|
||||||
repo_dir.mkdir()
|
repo_dir.mkdir()
|
||||||
(repo_dir / 'repo').symlink_to(TOPDIR)
|
(repo_dir / 'repo').symlink_to(TOPDIR)
|
||||||
|
|
||||||
|
# Create a repo wrapper using the active Python executable. We can't pass
|
||||||
|
# this directly to help2man as it's too simple, so insert it via shebang.
|
||||||
|
data = (TOPDIR / 'repo').read_text(encoding='utf-8')
|
||||||
|
tempbin = tempdir / 'repo'
|
||||||
|
tempbin.write_text(f'#!{sys.executable}\n' + data, encoding='utf-8')
|
||||||
|
tempbin.chmod(0o755)
|
||||||
|
|
||||||
# Run all cmd in parallel, and wait for them to finish.
|
# Run all cmd in parallel, and wait for them to finish.
|
||||||
with multiprocessing.Pool() as pool:
|
with multiprocessing.Pool() as pool:
|
||||||
pool.map(partial(worker, cwd=tempdir, check=True), cmdlist)
|
pool.map(partial(worker, cwd=tempdir, check=True), cmdlist)
|
||||||
|
Loading…
Reference in New Issue
Block a user