forked from mirrors/gecko-dev
Backed out changeset 561899ab9176 (bug 1858065) for breaking local mach browsertime tooling CLOSED TREE
This commit is contained in:
parent
272077c094
commit
4e7d0230df
6 changed files with 23 additions and 27 deletions
|
|
@ -5,14 +5,14 @@
|
|||
import os
|
||||
import platform
|
||||
import subprocess
|
||||
from distutils.version import StrictVersion
|
||||
|
||||
from mozboot.util import get_tools_dir
|
||||
from mozfile import which
|
||||
from packaging.version import Version
|
||||
from six import PY3
|
||||
|
||||
NODE_MIN_VERSION = Version("12.22.12")
|
||||
NPM_MIN_VERSION = Version("6.14.16")
|
||||
NODE_MIN_VERSION = StrictVersion("12.22.12")
|
||||
NPM_MIN_VERSION = StrictVersion("6.14.16")
|
||||
|
||||
|
||||
def find_node_paths():
|
||||
|
|
@ -68,7 +68,7 @@ def check_executable_version(exe, wrap_call_with_node=False):
|
|||
.lstrip("v")
|
||||
.rstrip()
|
||||
)
|
||||
return Version(out)
|
||||
return StrictVersion(out)
|
||||
|
||||
|
||||
def find_node_executable(
|
||||
|
|
@ -123,4 +123,4 @@ def find_executable(name, min_version, use_node_for_version_check=False):
|
|||
if version < min_version:
|
||||
return None, None
|
||||
|
||||
return exe, version.release
|
||||
return exe, version.version
|
||||
|
|
|
|||
|
|
@ -3,9 +3,9 @@
|
|||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
import re
|
||||
from distutils.version import StrictVersion
|
||||
|
||||
from looseversion import LooseVersion
|
||||
from packaging.version import Version
|
||||
|
||||
|
||||
class MozillaVersionCompareMixin:
|
||||
|
|
@ -17,12 +17,12 @@ class MozillaVersionCompareMixin:
|
|||
has_esr = set()
|
||||
if isinstance(other, LooseModernMozillaVersion) and str(other).endswith("esr"):
|
||||
# If other version ends with esr, coerce through MozillaVersion ending up with
|
||||
# a Version if possible
|
||||
# a StrictVersion if possible
|
||||
has_esr.add("other")
|
||||
other = MozillaVersion(str(other)[:-3]) # strip ESR from end of string
|
||||
if isinstance(self, LooseModernMozillaVersion) and str(self).endswith("esr"):
|
||||
# If our version ends with esr, coerce through MozillaVersion ending up with
|
||||
# a Version if possible
|
||||
# a StrictVersion if possible
|
||||
has_esr.add("self")
|
||||
self = MozillaVersion(str(self)[:-3]) # strip ESR from end of string
|
||||
if isinstance(other, LooseModernMozillaVersion) or isinstance(
|
||||
|
|
@ -35,13 +35,8 @@ class MozillaVersionCompareMixin:
|
|||
LooseModernMozillaVersion(str(other)),
|
||||
)
|
||||
else:
|
||||
# No versions are loose, therefore we can use Version
|
||||
def cmp(a, b):
|
||||
a, b = Version(str(a)), Version(str(b))
|
||||
return (a > b) - (a < b)
|
||||
|
||||
val = cmp(self, other)
|
||||
|
||||
# No versions are loose, therefore we can use StrictVersion
|
||||
val = StrictVersion._cmp(self, other)
|
||||
if has_esr.isdisjoint(set(["other", "self"])) or has_esr.issuperset(
|
||||
set(["other", "self"])
|
||||
):
|
||||
|
|
@ -56,8 +51,8 @@ class MozillaVersionCompareMixin:
|
|||
return 1 # non esr is greater than esr
|
||||
|
||||
|
||||
class ModernMozillaVersion(MozillaVersionCompareMixin, Version):
|
||||
"""A version class that is slightly less restrictive than Version.
|
||||
class ModernMozillaVersion(MozillaVersionCompareMixin, StrictVersion):
|
||||
"""A version class that is slightly less restrictive than StrictVersion.
|
||||
Instead of just allowing "a" or "b" as prerelease tags, it allows any
|
||||
alpha. This allows us to support the once-shipped "3.6.3plugin1" and
|
||||
similar versions."""
|
||||
|
|
@ -69,8 +64,8 @@ class ModernMozillaVersion(MozillaVersionCompareMixin, Version):
|
|||
)
|
||||
|
||||
|
||||
class AncientMozillaVersion(MozillaVersionCompareMixin, Version):
|
||||
"""A version class that is slightly less restrictive than Version.
|
||||
class AncientMozillaVersion(MozillaVersionCompareMixin, StrictVersion):
|
||||
"""A version class that is slightly less restrictive than StrictVersion.
|
||||
Instead of just allowing "a" or "b" as prerelease tags, it allows any
|
||||
alpha. This allows us to support the once-shipped "3.6.3plugin1" and
|
||||
similar versions.
|
||||
|
|
@ -87,7 +82,7 @@ class AncientMozillaVersion(MozillaVersionCompareMixin, Version):
|
|||
class LooseModernMozillaVersion(MozillaVersionCompareMixin, LooseVersion):
|
||||
"""A version class that is more restrictive than LooseVersion.
|
||||
This class reduces the valid strings to "esr", "a", "b" and "rc" in order
|
||||
to support esr. Version requires a trailing number after all strings."""
|
||||
to support esr. StrictVersion requires a trailing number after all strings."""
|
||||
|
||||
component_re = re.compile(r"(\d+ | a | b | rc | esr | \.)", re.VERBOSE)
|
||||
|
||||
|
|
|
|||
|
|
@ -263,10 +263,10 @@ class RaptorRunner(MozbuildObject):
|
|||
def setup_node(command_context):
|
||||
"""Fetch the latest node-16 binary and install it into the .mozbuild directory."""
|
||||
import platform
|
||||
from distutils.version import StrictVersion
|
||||
|
||||
from mozbuild.artifact_commands import artifact_toolchain
|
||||
from mozbuild.nodeutil import find_node_executable
|
||||
from packaging.version import Version
|
||||
|
||||
print("Setting up node for browsertime...")
|
||||
state_dir = get_state_dir()
|
||||
|
|
@ -274,7 +274,7 @@ def setup_node(command_context):
|
|||
|
||||
def __check_for_node():
|
||||
# Check standard locations first
|
||||
node_exe = find_node_executable(min_version=Version("16.0.0"))
|
||||
node_exe = find_node_executable(min_version=StrictVersion("16.0.0"))
|
||||
if node_exe and (node_exe[0] is not None):
|
||||
return node_exe[0]
|
||||
if not os.path.exists(cache_path):
|
||||
|
|
|
|||
|
|
@ -81,9 +81,9 @@ def silence():
|
|||
|
||||
def node_path(command_context):
|
||||
import platform
|
||||
from distutils.version import StrictVersion
|
||||
|
||||
from mozbuild.nodeutil import find_node_executable
|
||||
from packaging.version import Version
|
||||
|
||||
state_dir = command_context._mach_context.state_dir
|
||||
cache_path = os.path.join(state_dir, "browsertime", "node-16")
|
||||
|
|
@ -97,7 +97,7 @@ def node_path(command_context):
|
|||
)
|
||||
|
||||
# Check standard locations first
|
||||
node_exe = find_node_executable(min_version=Version(MIN_NODE_VERSION))
|
||||
node_exe = find_node_executable(min_version=StrictVersion(MIN_NODE_VERSION))
|
||||
if node_exe and (node_exe[0] is not None):
|
||||
return os.path.abspath(node_exe[0])
|
||||
if not os.path.exists(cache_path):
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ clippy:
|
|||
# the version of cargo-clippy is:
|
||||
# clippy 0.1.65 (2019147 2022-09-19)
|
||||
# we use the date instead to facilitate the check
|
||||
# replacing - by . because Python packaging.version.Version expects this
|
||||
# replacing - by . because Python StrictVersion expects this
|
||||
min_clippy_version: 2022.09.19
|
||||
type: external
|
||||
payload: clippy:lint
|
||||
|
|
|
|||
|
|
@ -2,15 +2,16 @@
|
|||
# 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/.
|
||||
|
||||
from distutils.version import StrictVersion
|
||||
|
||||
from mach.decorators import Command, CommandArgument
|
||||
from packaging.version import Version
|
||||
|
||||
|
||||
def is_osx_10_10_or_greater(cls):
|
||||
import platform
|
||||
|
||||
release = platform.mac_ver()[0]
|
||||
return release and Version(release) >= Version("10.10")
|
||||
return release and StrictVersion(release) >= StrictVersion("10.10")
|
||||
|
||||
|
||||
# Get system power consumption and related measurements.
|
||||
|
|
|
|||
Loading…
Reference in a new issue