- with open(output_filename, 'w') as output_file:
- v.status(
- 'Generating tarball for git revision %s' %
- pin.git_revision)
- git = subprocess.Popen(['git',
- '-C',
- git_cache.git_cachedir(channel.git_repo),
- 'archive',
- '--prefix=%s/' % pin.release_name,
- pin.git_revision],
- stdout=subprocess.PIPE)
- xz = subprocess.Popen(['xz'], stdin=git.stdout, stdout=output_file)
- xz.wait()
- git.wait()
- v.result(git.returncode == 0 and xz.returncode == 0)
+ with open(output_filename, 'w', encoding='utf-8') as output_file:
+ v.status(f'Generating tarball for git revision {pin.git_revision}')
+ with subprocess.Popen(
+ ['git', '-C', git_cache.git_cachedir(channel.git_repo),
+ 'archive', f'--prefix={pin.release_name}/', pin.git_revision],
+ stdout=subprocess.PIPE) as git:
+ with subprocess.Popen(['xz'], stdin=git.stdout, stdout=output_file) as xz:
+ xz.wait()
+ git.wait()
+ v.result(git.returncode == 0 and xz.returncode == 0)