www-client/icecat: add 115.18.0

Signed-off-by: Alfred Wingate <parona@protonmail.com>
This commit is contained in:
Alfred Wingate 2024-12-11 22:38:08 +02:00
parent f2d7d3c13b
commit fbc29f2b9e
No known key found for this signature in database
GPG Key ID: A12750536B5E7010
3 changed files with 1419 additions and 0 deletions

View File

@ -1,2 +1,3 @@
DIST firefox-115esr-patches-13.tar.xz 51360 BLAKE2B a048bfadba989ebbd4c6e3df97d303d6853844e66ed92f5f5f322acf18866218b91d52dbbece63827de283eef855c932d67e329c8d93200aa83f11268a5d1b2f SHA512 186ec72323e621362dcef1bc67c476716aff97dfad701faa9220a7302e798d3cb4ed90d5ea59e3e92f016be29875bb5219787635db99a8848b7c76e4e2e09e90
DIST icecat-115.16.1-1gnu1.tar.bz2 694949802 BLAKE2B 3c8dfd778c25a4353e3536465e2e8c4018e4803c6f33f63293709f43df0cb4ddb8a1aba49ed14955ab60c49da8a5c9a71e348f397b5f108184743095b01e9958 SHA512 35fd9fc2c92a7a380def996c7506fadd7727eb025aaa930973e0840ce722c94e011ab428b762ecee8c00e7447b5b8ded0542d7ce85bfe2a925b0348f94fc60b9
DIST icecat-115.18.0-1gnu2.tar.bz2 694848841 BLAKE2B 23a41f20b481128be18c44d079c62cd98683d90d4d25ae417428791aadaacfd0cbf55127e5eb4cc8725cd8eb2ce9307b2001227b8c82689439361a839ef275c7 SHA512 c9e96ceaaf86c064a30c5defa47218d199271bfb7f4a1297857a7b00dda8752ec203cadcc4c265a49fa0c29ebe42ab751f28ebb71d0f98558e9d91a91e58ae8d

View File

@ -0,0 +1,147 @@
# HG changeset patch
# User Filipe Laíns <lains@riseup.net>
# Date 1733719242 0
# Node ID b0dbc944fb7b5f7df9ae370a247405d5c7c181ee
# Parent 550046479ed6e9c01ea14ae7156002f5ec815ae5
Bug 1935621 - Fix virtual environment sysconfig path calculation r=firefox-build-system-reviewers,ahochheiden
Signed-off-by: Filipe Laíns <lains@riseup.net>
Signed-off-by: Filipe Laíns <lains@riseup.net>
Signed-off-by: Filipe Laíns <lains@riseup.net>
Differential Revision: https://phabricator.services.mozilla.com/D231480
--- a/python/mach/mach/site.py
+++ b/python/mach/mach/site.py
@@ -12,16 +12,17 @@ import json
import os
import platform
import shutil
import site
import subprocess
import sys
import sysconfig
import tempfile
+import warnings
from contextlib import contextmanager
from pathlib import Path
from typing import Callable, Optional
from mach.requirements import (
MachEnvRequirements,
UnexpectedFlexibleRequirementException,
)
@@ -814,43 +815,85 @@ class CommandSiteManager:
self._metadata,
)
class PythonVirtualenv:
"""Calculates paths of interest for general python virtual environments"""
def __init__(self, prefix):
- if _is_windows:
- self.bin_path = os.path.join(prefix, "Scripts")
- self.python_path = os.path.join(self.bin_path, "python.exe")
+ self.prefix = os.path.realpath(prefix)
+ self.paths = self._get_sysconfig_paths(self.prefix)
+
+ # Name of the Python executable to use in virtual environments.
+ # An executable with the same name as sys.executable might not exist in
+ # virtual environments. An executable with 'python' as the steam —
+ # without version numbers or ABI flags — will always be present in
+ # virtual environments, so we use that.
+ python_exe_name = "python" + sysconfig.get_config_var("EXE")
+
+ self.bin_path = self.paths["scripts"]
+ self.python_path = os.path.join(self.bin_path, python_exe_name)
+
+ @staticmethod
+ def _get_sysconfig_paths(prefix):
+ """Calculate the sysconfig paths of a virtual environment in the given prefix.
+
+ The virtual environment MUST be using the same Python distribution as us.
+ """
+ # Determine the sysconfig scheme used in virtual environments
+ if "venv" in sysconfig.get_scheme_names():
+ # A 'venv' scheme was added in Python 3.11 to allow users to
+ # calculate the paths for a virtual environment, since the default
+ # scheme may not always be the same as used on virtual environments.
+ # Some common examples are the system Python distributed by macOS,
+ # Debian, and Fedora.
+ # For more information, see https://github.com/python/cpython/issues/89576
+ venv_scheme = "venv"
+ elif os.name == "nt":
+ # We know that before the 'venv' scheme was added, on Windows,
+ # the 'nt' scheme was used in virtual environments.
+ venv_scheme = "nt"
+ elif os.name == "posix":
+ # We know that before the 'venv' scheme was added, on POSIX,
+ # the 'posix_prefix' scheme was used in virtual environments.
+ venv_scheme = "posix_prefix"
else:
- self.bin_path = os.path.join(prefix, "bin")
- self.python_path = os.path.join(self.bin_path, "python")
- self.prefix = os.path.realpath(prefix)
+ # This should never happen with upstream Python, as the 'venv'
+ # scheme should always be available on >=3.11, and no other
+ # platforms are supported by the upstream on older Python versions.
+ #
+ # Since the 'venv' scheme isn't available, and we have no knowledge
+ # of this platform/distribution, fallback to the default scheme.
+ #
+ # Hitting this will likely be the result of running a custom Python
+ # distribution targetting a platform that is not supported by the
+ # upstream.
+ # In this case, unless the Python vendor patched the Python
+ # distribution in such a way as the default scheme may not always be
+ # the same scheme, using the default scheme should be correct.
+ # If the vendor did patch Python as such, to work around this issue,
+ # I would recommend them to define a 'venv' scheme that matches
+ # the layout used on virtual environments in their Python distribution.
+ # (rec. signed Filipe Laíns — upstream sysconfig maintainer)
+ venv_scheme = sysconfig.get_default_scheme()
+ warnings.warn(
+ f"Unknown platform '{os.name}', using the default install scheme '{venv_scheme}'. "
+ "If this is incorrect, please ask your Python vendor to add a 'venv' sysconfig scheme "
+ "(see https://github.com/python/cpython/issues/89576, or check the code comment).",
+ stacklevel=2,
+ )
+ # Build the sysconfig config_vars dictionary for the virtual environment.
+ venv_vars = sysconfig.get_config_vars().copy()
+ venv_vars["base"] = venv_vars["platbase"] = prefix
+ # Get sysconfig paths for the virtual environment.
+ return sysconfig.get_paths(venv_scheme, vars=venv_vars)
- @functools.lru_cache(maxsize=None)
def resolve_sysconfig_packages_path(self, sysconfig_path):
- # macOS uses a different default sysconfig scheme based on whether it's using the
- # system Python or running in a virtualenv.
- # Manually define the scheme (following the implementation in
- # "sysconfig._get_default_scheme()") so that we're always following the
- # code path for a virtualenv directory structure.
- if os.name == "posix":
- scheme = "posix_prefix"
- else:
- scheme = os.name
-
- sysconfig_paths = sysconfig.get_paths(scheme)
- data_path = Path(sysconfig_paths["data"])
- path = Path(sysconfig_paths[sysconfig_path])
- 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(Path(self.prefix) / relative_path))
+ return self.paths[sysconfig_path]
def site_packages_dirs(self):
dirs = []
if sys.platform.startswith("win"):
dirs.append(os.path.normpath(os.path.normcase(self.prefix)))
purelib = self.resolve_sysconfig_packages_path("purelib")
platlib = self.resolve_sysconfig_packages_path("platlib")

File diff suppressed because it is too large Load Diff