forked from mirrors/gecko-dev
Bug 1800225 - Only realpath the prefix when resolving the sysconfig packages path r=firefox-build-system-reviewers,glandium
On POSIX platforms there can be `lib` and `lib64` for `site-packages`. On Fedora35 once a virtualenv is created, `lib64` is a symlink of `lib`. Since we can determine what these paths will be before the virtualenv is created, `realpath` has different results before/after, which is problematic for our `pthfile`. Since we only care about resolving the symlink in the prefix (to keep it in line with the `topobjdir`, we can simply only `realpath` that and disregard that there's a symlink between `lib` and `lib64`, which makes our `pthfile` that's created and expected always the same on all platforms. Differential Revision: https://phabricator.services.mozilla.com/D162136
This commit is contained in:
parent
bff0d2da74
commit
9b7eee2c37
1 changed files with 5 additions and 9 deletions
|
|
@ -18,10 +18,10 @@ import site
|
|||
import subprocess
|
||||
import sys
|
||||
import sysconfig
|
||||
from pathlib import Path
|
||||
import tempfile
|
||||
from contextlib import contextmanager
|
||||
from typing import Optional, Callable
|
||||
from pathlib import Path
|
||||
from typing import Callable, Optional
|
||||
|
||||
from mach.requirements import (
|
||||
MachEnvRequirements,
|
||||
|
|
@ -763,7 +763,7 @@ class PythonVirtualenv:
|
|||
else:
|
||||
self.bin_path = os.path.join(prefix, "bin")
|
||||
self.python_path = os.path.join(self.bin_path, "python")
|
||||
self.prefix = prefix
|
||||
self.prefix = os.path.realpath(prefix)
|
||||
|
||||
@functools.lru_cache(maxsize=None)
|
||||
def resolve_sysconfig_packages_path(self, sysconfig_path):
|
||||
|
|
@ -783,16 +783,12 @@ class PythonVirtualenv:
|
|||
relative_path = path.relative_to(data_path)
|
||||
|
||||
# Path to virtualenv's "site-packages" directory for provided sysconfig path
|
||||
return os.path.normpath(
|
||||
os.path.normcase(os.path.realpath(Path(self.prefix) / relative_path))
|
||||
)
|
||||
return os.path.normpath(os.path.normcase(Path(self.prefix) / relative_path))
|
||||
|
||||
def site_packages_dirs(self):
|
||||
dirs = []
|
||||
if sys.platform.startswith("win"):
|
||||
dirs.append(
|
||||
os.path.normpath(os.path.normcase(os.path.realpath(self.prefix)))
|
||||
)
|
||||
dirs.append(os.path.normpath(os.path.normcase(self.prefix)))
|
||||
purelib = self.resolve_sysconfig_packages_path("purelib")
|
||||
platlib = self.resolve_sysconfig_packages_path("platlib")
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue