nebius/SWE-bench-extra huggingface dataset:
Repository: Yelp/virtualenv-tools

Issue:
Unable to find the VIRTUAL_ENV variable in activate.sh for recent virtualenv versions.
Starting in `virtualenv==20.0.0`, the `VIRTUAL_ENV` variable is now defined using single quotes instead of double quotes. This breaks `virtualenv-tools3` as it specifically searches for the string `VIRTUAL_ENV="` in `activate.sh`.

Comments:

Patch:
diff --git a/tox.ini b/tox.ini
index 43f5f76..fceab09 100644
--- a/tox.ini
+++ b/tox.ini
@@ -16,4 +16,4 @@ envdir = venv-{[tox]project}
 commands =
 
 [pep8]
-ignore = E265,E501
+ignore = E265,E501,W504
diff --git a/virtualenv_tools.py b/virtualenv_tools.py
index 2b3cfae..2f76a24 100644
--- a/virtualenv_tools.py
+++ b/virtualenv_tools.py
@@ -31,7 +31,7 @@ ACTIVATION_SCRIPTS = [
 _pybin_match = re.compile(r'^python\d+\.\d+$')
 _pypy_match = re.compile(r'^\d+.\d+$')
 _activation_path_re = re.compile(
-    r'^(?:set -gx |setenv |)VIRTUAL_ENV[ =]"(.*?)"\s*$',
+    r'^(?:set -gx |setenv |)VIRTUAL_ENV[ =][\'"](.*?)[\'"]\s*$',
 )
 VERBOSE = False
 MAGIC_LENGTH = 4 + 4  # magic length + 4 byte timestamp
@@ -169,7 +169,11 @@ def update_pycs(lib_dir, new_path):
 
     for dirname, dirnames, filenames in os.walk(lib_dir):
         for filename in filenames:
-            if filename.endswith(('.pyc', '.pyo')):
+            if (
+                    filename.endswith(('.pyc', '.pyo')) and
+                    # python 2, virtualenv 20.x symlinks os.pyc
+                    not os.path.islink(os.path.join(dirname, filename))
+            ):
                 filename = os.path.join(dirname, filename)
                 local_path = get_new_path(filename)
                 update_pyc(filename, local_path)
@@ -236,11 +240,13 @@ def get_orig_path(venv_path):
 
     with open(activate_path) as activate:
         for line in activate:
-            if line.startswith('VIRTUAL_ENV="'):
-                return line.split('"', 2)[1]
+            # virtualenv 20 changes the position
+            for possible in ('VIRTUAL_ENV="', "VIRTUAL_ENV='"):
+                if line.startswith(possible):
+                    return line.split(possible[-1], 2)[1]
         else:
             raise AssertionError(
-                'Could not find VIRTUAL_ENV=" in activation script: %s' %
+                'Could not find VIRTUAL_ENV= in activation script: %s' %
                 activate_path
             )
 


Test patch:
diff --git a/tests/virtualenv_tools_test.py b/tests/virtualenv_tools_test.py
index e34d596..44fdc27 100644
--- a/tests/virtualenv_tools_test.py
+++ b/tests/virtualenv_tools_test.py
@@ -185,7 +185,7 @@ def test_verbose(venv, capsys):
     run(venv.before, venv.after, args=('--verbose',))
     out, _ = capsys.readouterr()
     # Lots of output
-    assert len(out.splitlines()) > 25
+    assert len(out.splitlines()) > 10
 
 
 def test_non_absolute_error(capsys):