Repository: pypa/virtualenv

Issue:
virtualenv does not work with the python3 in Xcode 11 beta.
Xcode 11 (now in beta) includes a build of python 3.   Additionally Mac OS 10.15 (also in beta) includes a `/usr/bin/python3` which is a `xcrun` stub pointing at Xcode's python.

Unfortunately virtualenv does not work with this python.   To reproduce, install MacOS 10.15 beta and Xcode 11 (or CLTools).   Then `pip3 install virtualenv` and `python3 -m virtualenv foo_environment`.   It will not be able to produce a virtualenv.

There are two reasons:

* virtualenv looks for the string `Python.framework`.   However Xcode's python is called `Python3.framework`, in order to disambiguate it from the python 2.7 that ships as `/System/Library/Frameworks/Python.framework` on Mac OS.

* virtualenv uses `mach_o_change()` or `install_name_tool` to change the path that the python binary uses to find `Python.framework`.   This assumes that the original python used an absolute path, but because Xcode is app and is therefore relocatable, Xcode's python uses `'@executable_path/../../../../Python3'` for this.


Discussion:

Resolving patch:
diff --git a/virtualenv.py b/virtualenv.py
--- a/virtualenv.py
+++ b/virtualenv.py
@@ -1498,7 +1498,7 @@ def install_python(home_dir, lib_dir, inc_dir, bin_dir, site_packages, clear, sy
 
     mkdir(bin_dir)
     py_executable = join(bin_dir, os.path.basename(sys.executable))
-    if "Python.framework" in prefix:
+    if "Python.framework" in prefix or "Python3.framework" in prefix:
         # OS X framework builds cause validation to break
         # https://github.com/pypa/virtualenv/issues/322
         if os.environ.get("__PYVENV_LAUNCHER__"):
@@ -1607,7 +1607,7 @@ def install_python(home_dir, lib_dir, inc_dir, bin_dir, site_packages, clear, sy
 
     if ".framework" in prefix:
         original_python = None
-        if "Python.framework" in prefix:
+        if "Python.framework" in prefix or "Python3.framework" in prefix:
             logger.debug("MacOSX Python framework detected")
             # Make sure we use the embedded interpreter inside
             # the framework, even if sys.executable points to
@@ -1626,25 +1626,21 @@ def install_python(home_dir, lib_dir, inc_dir, bin_dir, site_packages, clear, sy
 
         if os.path.exists(virtual_lib):
             os.unlink(virtual_lib)
-        copyfile(os.path.join(prefix, "Python"), virtual_lib, symlink)
+        lib_name = "Python3" if "Python3.framework" in prefix else "Python"
+        copyfile(os.path.join(prefix, lib_name), virtual_lib, symlink)
 
         # And then change the install_name of the copied python executable
+        search = (
+            "@executable_path/../../../../Python3" if "Python3.framework" in prefix else os.path.join(prefix, lib_name)
+        )
         # noinspection PyBroadException
         try:
-            mach_o_change(py_executable, os.path.join(prefix, "Python"), "@executable_path/../.Python")
+            mach_o_change(py_executable, search, "@executable_path/../.Python")
         except Exception:
             e = sys.exc_info()[1]
             logger.warn("Could not call mach_o_change: %s. " "Trying to call install_name_tool instead.", e)
             try:
-                call_subprocess(
-                    [
-                        "install_name_tool",
-                        "-change",
-                        os.path.join(prefix, "Python"),
-                        "@executable_path/../.Python",
-                        py_executable,
-                    ]
-                )
+                call_subprocess(["install_name_tool", "-change", search, "@executable_path/../.Python", py_executable])
             except Exception:
                 logger.fatal("Could not call install_name_tool -- you must " "have Apple's development tools installed")
                 raise
@@ -2195,99 +2191,99 @@ def convert(s):
 qOzp/eZmu8TbQ3a3yrbrEEP2LxFuszf2RULi4dYjJL1i0wYEFEWteNxPpQfNace8/uAZ9c9quzT8
 sehb3Hto+O9j38ZxJyo8hFb/Pqx+KriGzQB7gIHZ4pTtcMm6Q/Mm09w4VqwglDhATXIg1rTRTClN
 8MsygDJjl6sHDoqH3q58UZclbzqSQipkeYj7aCOBNTbGt6LSnS6Yo9eyQkxssymliJ2KjLxPYkKd
-9LUzCRsvvZ/tlrlJDsnsNimhL6i/QfjTm5/Pt7AFpkyh08N1+taG+PEWGOGyR49zxiX+PZ7n1nH9
-N2ZH1aRANfbd+XUynyZ67ifFPRkQbwuPtykpLp0u5fRmLGnvFdkF+zpp4Bf4GlGxW7J+BY2K51QG
-BFOZpjWShz1MrN+a19mUtgcqCW6ILrbE4gvaUeWE1zyNF2JAnWeYa9FcQemY27jUXlZR5ljeJ+pk
-drRIZkL+VscpBrNyPgdccPNGv4p4eEq5iJe8KcxlX0pO6zKpNkCDWOV674v2j52Gkw1PdOAhybsc
-TEHcUT4RVzhtfM+E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B3NkZ4Vb+fvV2
+M9GeesMTW3wKvhqlv/+TB/TvHn6w3Y93JX1sq6e9R/rZ38UTM1jc3OZS8zwCywOqdEAK/JEYWNnH
+W9QaQroM1UwOGYPCH3K4MUA6xYwZ+cZj7VRYQxH8Pz99ANE=
 """
 )
 
diff --git a/virtualenv_embedded/site.py b/virtualenv_embedded/site.py
--- a/virtualenv_embedded/site.py
+++ b/virtualenv_embedded/site.py
@@ -268,7 +268,7 @@ def addsitepackages(known_paths, sys_prefix=sys.prefix, exec_prefix=sys.exec_pre
                 # for framework builds *only* we add the standard Apple
                 # locations. Currently only per-user, but /Library and
                 # /Network/Library could be added too
-                if "Python.framework" in prefix:
+                if "Python.framework" in prefix or "Python3.framework" in prefix:
                     home = os.environ.get("HOME")
                     if home:
                         sitedirs.append(


Test patch: