Skip to content

Commit

Permalink
Remove virtualenv fixup
Browse files Browse the repository at this point in the history
I *think* virtualenv fixed these? We'll see.
  • Loading branch information
uranusjr committed Feb 12, 2020
1 parent 4eae4ac commit ac8cec6
Showing 1 changed file with 0 additions and 37 deletions.
37 changes: 0 additions & 37 deletions tests/lib/venv.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ def _create(self, clear=False):
"--no-wheel",
"--no-setuptools",
])
self._fix_virtualenv_site_module()
elif self._venv_type == 'venv':
builder = _venv.EnvBuilder()
context = builder.ensure_directories(self.location)
Expand All @@ -74,42 +73,6 @@ def _create(self, clear=False):
self.sitecustomize = self._sitecustomize
self.user_site_packages = self._user_site_packages

def _fix_virtualenv_site_module(self):
# Patch `site.py` so user site work as expected.
site_py = self.lib / 'site.py'
with open(site_py) as fp:
site_contents = fp.read()
for pattern, replace in (
(
# Ensure enabling user site does not result in adding
# the real site-packages' directory to `sys.path`.
(
'\ndef virtual_addsitepackages(known_paths):\n'
),
(
'\ndef virtual_addsitepackages(known_paths):\n'
' return known_paths\n'
),
),
(
# Fix sites ordering: user site must be added before system.
(
'\n paths_in_sys = addsitepackages(paths_in_sys)'
'\n paths_in_sys = addusersitepackages(paths_in_sys)\n'
),
(
'\n paths_in_sys = addusersitepackages(paths_in_sys)'
'\n paths_in_sys = addsitepackages(paths_in_sys)\n'
),
),
):
assert pattern in site_contents
site_contents = site_contents.replace(pattern, replace)
with open(site_py, 'w') as fp:
fp.write(site_contents)
# Make sure bytecode is up-to-date too.
assert compileall.compile_file(str(site_py), quiet=1, force=True)

def _customize_site(self):
contents = ''
if self._venv_type == 'venv':
Expand Down

0 comments on commit ac8cec6

Please sign in to comment.