# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. import os import re from pathlib import Path
class PthSpecifier: def __init__(self, path: str):
self.path = path
class PypiSpecifier: def __init__(self, requirement):
self.requirement = requirement
class PypiOptionalSpecifier(PypiSpecifier): def __init__(self, repercussion, requirement):
super().__init__(requirement)
self.repercussion = repercussion
class MachEnvRequirements: """Requirements associated with a "site dependency manifest", as
defined in"python/sites/".
Represents the dependencies of a site. The source files consist
of colon-delimited fields. The first field
specifies the action. The remaining fields are arguments to that
action. The following actions are supported:
requires-python -- Specifies the minimum and/or maximum Python
versions supported by this site.
pth -- Adds the path given as argument to "mach.pth" under
the virtualenv's site packages directory.
pypi -- Fetch the package, plus dependencies, from PyPI.
pypi-optional -- Attempt to install the package and dependencies from PyPI. Continue using the site, even if the package could not be installed.
packages.txt -- Denotes that the specified path is a child manifest. It
will be read and processed asif its contents were concatenated
into the manifest being read.
thunderbird-packages.txt -- Denotes a Thunderbird child manifest.
Thunderbird child manifests are only activated when working on Thunderbird, and they can cannot have "pypi"or"pypi-optional" entries. """
def _parse_mach_env_requirements(
requirements_output,
root_requirements_path: Path,
topsrcdir: Path,
is_thunderbird,
only_strict_requirements,
): def _parse_requirements_line(
current_requirements_path: Path, line, line_number, is_thunderbird_packages_txt
):
line = line.strip() ifnot line or line.startswith("#"): return
action, params = line.rstrip().split(":", maxsplit=1) if action == "requires-python": if requirements_output.requires_python == "":
requirements_output.requires_python = params else: raise Exception(
f"'requires-python' is already set to "
f"'{requirements_output.requires_python}'. "
f"Attempted to set it again to '{params}'. "
f"Please ensure the file '{root_requirements_path}' "
f"contains only one 'requires-python' entry."
) elif action == "pth":
path = topsrcdir / params ifnot path.exists(): # In sparse checkouts, not all paths will be populated. return
if only_strict_requirements and [
s for s in requirement.specifier if s.operator != "=="
]: raise UnexpectedFlexibleRequirementException(raw_requirement) return requirement
¤ Dauer der Verarbeitung: 0.13 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.