forked from mirrors/gecko-dev
Bug 1891778 - Move mozilla_build_version out of mozbuild/util.py r=ahochheiden
Differential Revision: https://phabricator.services.mozilla.com/D207594
This commit is contained in:
parent
420631590e
commit
e003bc34c6
4 changed files with 25 additions and 19 deletions
|
|
@ -15,7 +15,7 @@ import time
|
|||
|
||||
import blessed
|
||||
import six
|
||||
from mozbuild.util import mozilla_build_version
|
||||
from mozbuild.buildversion import mozilla_build_version
|
||||
from packaging.version import Version
|
||||
|
||||
IS_WINDOWS = sys.platform.startswith("win")
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import subprocess
|
|||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
from mozbuild.util import mozilla_build_version
|
||||
from mozbuild.buildversion import mozilla_build_version
|
||||
from packaging.version import Version
|
||||
|
||||
from mozboot.base import BaseBootstrapper
|
||||
|
|
|
|||
23
python/mozbuild/mozbuild/buildversion.py
Normal file
23
python/mozbuild/mozbuild/buildversion.py
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
# 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
|
||||
from pathlib import Path
|
||||
|
||||
from packaging.version import Version
|
||||
|
||||
|
||||
def mozilla_build_version():
|
||||
mozilla_build = os.environ.get("MOZILLABUILD")
|
||||
|
||||
version_file = Path(mozilla_build) / "VERSION"
|
||||
|
||||
assert version_file.exists(), (
|
||||
f'The MozillaBuild VERSION file was not found at "{version_file}".\n'
|
||||
"Please check if MozillaBuild is installed correctly and that the"
|
||||
"`MOZILLABUILD` environment variable is to the correct path."
|
||||
)
|
||||
|
||||
with version_file.open() as file:
|
||||
return Version(file.readline().rstrip("\n"))
|
||||
|
|
@ -17,10 +17,8 @@ import os
|
|||
import re
|
||||
import sys
|
||||
from io import BytesIO, StringIO
|
||||
from pathlib import Path
|
||||
|
||||
import six
|
||||
from packaging.version import Version
|
||||
|
||||
from mozbuild.dirutils import ensureParentDir
|
||||
|
||||
|
|
@ -1229,18 +1227,3 @@ def hexdump(buf):
|
|||
line += "|\n"
|
||||
lines.append(line)
|
||||
return lines
|
||||
|
||||
|
||||
def mozilla_build_version():
|
||||
mozilla_build = os.environ.get("MOZILLABUILD")
|
||||
|
||||
version_file = Path(mozilla_build) / "VERSION"
|
||||
|
||||
assert version_file.exists(), (
|
||||
f'The MozillaBuild VERSION file was not found at "{version_file}".\n'
|
||||
"Please check if MozillaBuild is installed correctly and that the"
|
||||
"`MOZILLABUILD` environment variable is to the correct path."
|
||||
)
|
||||
|
||||
with version_file.open() as file:
|
||||
return Version(file.readline().rstrip("\n"))
|
||||
|
|
|
|||
Loading…
Reference in a new issue