Bug 1761849 - Removed 'samepath' function and replaced the only use of it with a Pathlib equivalent r=firefox-build-system-reviewers,mhentges

Differential Revision: https://phabricator.services.mozilla.com/D142272
This commit is contained in:
ahochheiden 2022-05-30 19:46:22 +00:00
parent ff5b672032
commit 026134af4f

View File

@ -60,17 +60,6 @@ def ancestors(path):
path = newpath
def samepath(path1, path2):
# Under Python 3 (but NOT Python 2), MozillaBuild exposes the
# os.path.samefile function despite it not working, so only use it if we're
# not running under Windows.
if hasattr(os.path, "samefile") and os.name != "nt":
return os.path.samefile(path1, path2)
return os.path.normcase(os.path.realpath(path1)) == os.path.normcase(
os.path.realpath(path2)
)
class BadEnvironmentException(Exception):
"""Base class for errors raised when the build environment is not sane."""
@ -902,7 +891,9 @@ class MachCommandBase(MozbuildObject):
# of the wrong objdir when the current objdir is ambiguous.
config_topobjdir = dummy.resolve_mozconfig_topobjdir()
if config_topobjdir and not samepath(topobjdir, config_topobjdir):
if config_topobjdir and not Path(topobjdir).samefile(
Path(config_topobjdir)
):
raise ObjdirMismatchException(topobjdir, config_topobjdir)
except BuildEnvironmentNotFoundException:
pass