Commit 883d7e3f authored by Nirbheek Chauhan's avatar Nirbheek Chauhan 🐜
Browse files

cerbero: Support XCode Python 3 on macOS Big Sur

python.org's official Python 3 release does not work on Big Sur, so
the only option at present is to use the Python 3 that ships with
XCode. Unfortunately, that doesn't ship with python3-config right now
so you need to build with `-v nogi`.

XCode's Python 3 defaults to a framework path for sysconfig purelib:
/Library/Python/3.8/site-packages but setuptools still uses the posix
path: /lib/python3.8/site-packages. This also means we'd have
inconsistent paths based on your macOS version.

The second issue is that on Windows the purelib path is
\Lib\site-packages which is not version-specific but it *is* the
default for setuptools, so let's consistently add both.

Part-of: <!626>
parent e0d5ccbe
Pipeline #208995 passed with stages
in 62 minutes and 14 seconds
......@@ -390,22 +390,26 @@ class Config (object):
gstregistry = os.path.expanduser(gstregistry)
gstregistry10 = os.path.expanduser(gstregistry10)
pypath = sysconfig.get_path('purelib', vars={'base': ''})
# Must strip \/ to ensure that the path is relative
pypath = PurePath(pypath.strip('\\/'))
# Starting with Python 3.7.1 on Windows, each PYTHONPATH must use the
# native path separator and must end in a path separator.
pythonpath = [str(prefix / pypath) + os.sep,
str(self.build_tools_prefix / pypath) + os.sep]
if self.platform == Platform.WINDOWS:
# On Windows, pypath doesn't include Python version although some
# packages (pycairo, gi, etc...) install themselves using Python
# version scheme like on a posix system.
# Let's add an extra path to PYTHONPATH for these libraries.
pypath = sysconfig.get_path('purelib', 'posix_prefix', {'base': ''})
for p in (prefix, self.build_tools_prefix):
# Explicitly use the posix_prefix scheme because:
# 1. On Windows, pypath doesn't include Python version although some
# packages (pycairo, gi, etc...) install themselves using Python
# version scheme like on a posix system.
# 2. The Python3 that ships with XCode on macOS Big Sur defaults to
# a framework path, but setuptools defaults to a posix prefix
# So just use a posix prefix everywhere consistently.
pypath = sysconfig.get_path('purelib', 'posix_prefix', vars={'base': ''})
# Must strip \/ to ensure that the path is relative
pypath = PurePath(pypath.strip('\\/'))
pythonpath.append(str(prefix / pypath) + os.sep)
# Starting with Python 3.7.1 on Windows, each PYTHONPATH must use the
# native path separator and must end in a path separator.
pythonpath = [str(p / pypath) + os.sep]
# Make sure we also include the default non-versioned path on
# Windows in addition to the posix path.
if self.platform == Platform.WINDOWS:
pypath = sysconfig.get_path('purelib', vars={'base': ''})
pypath = PurePath(pypath.strip('\\/'))
pythonpath += [str(p / pypath) + os.sep]
# Ensure python paths exists because setup.py won't create them
for path in pythonpath:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment