Backed out changeset 2ad8e52fa3e6 (bug 1761849) for causing python failures on test_objdir_mismatch.

This commit is contained in:
Cosmin Sabou 2022-05-31 00:17:59 +03:00
parent ad884cad4b
commit 3419858c99

View File

@ -60,6 +60,17 @@ 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."""
@ -891,9 +902,7 @@ class MachCommandBase(MozbuildObject):
# of the wrong objdir when the current objdir is ambiguous.
config_topobjdir = dummy.resolve_mozconfig_topobjdir()
if config_topobjdir and not Path(topobjdir).samefile(
Path(config_topobjdir)
):
if config_topobjdir and not samepath(topobjdir, config_topobjdir):
raise ObjdirMismatchException(topobjdir, config_topobjdir)
except BuildEnvironmentNotFoundException:
pass