diff options
author | andrei kulakov <andrei.avk@gmail.com> | 2022-01-07 06:50:30 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-07 06:50:30 (GMT) |
commit | f4e325c21d6d9c2bf70224dc69d707b226f87872 (patch) | |
tree | f748074c575af649935c6e802f79f0abbab2859d /Lib/venv | |
parent | 46c7a6566bca2e974a89c90c35ed1c498d9d3b02 (diff) | |
download | cpython-f4e325c21d6d9c2bf70224dc69d707b226f87872.zip cpython-f4e325c21d6d9c2bf70224dc69d707b226f87872.tar.gz cpython-f4e325c21d6d9c2bf70224dc69d707b226f87872.tar.bz2 |
bpo-41011: venv -- add more variables to pyvenv.cfg (GH-30382)
Diffstat (limited to 'Lib/venv')
-rw-r--r-- | Lib/venv/__init__.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/Lib/venv/__init__.py b/Lib/venv/__init__.py index 6f1af29..b907650 100644 --- a/Lib/venv/__init__.py +++ b/Lib/venv/__init__.py @@ -51,6 +51,7 @@ class EnvBuilder: self.symlinks = symlinks self.upgrade = upgrade self.with_pip = with_pip + self.orig_prompt = prompt if prompt == '.': # see bpo-38901 prompt = os.path.basename(os.getcwd()) self.prompt = prompt @@ -178,6 +179,29 @@ class EnvBuilder: f.write('version = %d.%d.%d\n' % sys.version_info[:3]) if self.prompt is not None: f.write(f'prompt = {self.prompt!r}\n') + f.write('executable = %s\n' % os.path.realpath(sys.executable)) + args = [] + nt = os.name == 'nt' + if nt and self.symlinks: + args.append('--symlinks') + if not nt and not self.symlinks: + args.append('--copies') + if not self.with_pip: + args.append('--without-pip') + if self.system_site_packages: + args.append('--system-site-packages') + if self.clear: + args.append('--clear') + if self.upgrade: + args.append('--upgrade') + if self.upgrade_deps: + args.append('--upgrade-deps') + if self.orig_prompt is not None: + args.append(f'--prompt="{self.orig_prompt}"') + + args.append(context.env_dir) + args = ' '.join(args) + f.write(f'command = {sys.executable} -m venv {args}\n') if os.name != 'nt': def symlink_or_copy(self, src, dst, relative_symlinks_ok=False): |