Bug 1628726 - Use os.path.realpath consistently r=rstewart
authorKagami Sascha Rosylight <saschanaz@outlook.com>
Fri, 24 Apr 2020 20:59:03 +0000
changeset 526018 58be148294115992361b6aea7bffa2b7987f283d
parent 526017 8e8278c2c5f1a2f856ce26337152289ad44f8769
child 526019 e1a7a3f86d106263531e30dfea59eb1d529d7751
push id37348
push userrmaries@mozilla.com
push dateSat, 25 Apr 2020 09:49:23 +0000
treeherdermozilla-central@d8a8178627c4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrstewart
bugs1628726
milestone77.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1628726 - Use os.path.realpath consistently r=rstewart `os.path.realpath` in Python 3.8 now always uppercases Windows drive letter, while it was just an alias of `os.path.abspath` in Windows. This patch uses `.realpath()` consistently to get `topobjdir` to fix the incompatibility from the behavior change. Differential Revision: https://phabricator.services.mozilla.com/D72188
build/moz.configure/init.configure
python/mozbuild/mozbuild/base.py
python/mozbuild/mozbuild/config_status.py
--- a/build/moz.configure/init.configure
+++ b/build/moz.configure/init.configure
@@ -18,19 +18,19 @@ option(env='DIST', nargs=1, help='DIST d
 
 # Do not allow objdir == srcdir builds.
 # ==============================================================
 @depends('--help', 'DIST')
 @imports(_from='__builtin__', _import='open')
 @imports(_from='os.path', _import='exists')
 @imports(_from='six', _import='ensure_text')
 def check_build_environment(help, dist):
-    topobjdir = os.path.realpath(os.path.abspath('.'))
-    topsrcdir = os.path.realpath(os.path.abspath(
-        os.path.join(os.path.dirname(__file__), '..', '..')))
+    topobjdir = os.path.realpath('.')
+    topsrcdir = os.path.realpath(
+        os.path.join(os.path.dirname(__file__), '..', '..'))
 
     if dist:
         dist = normsep(dist[0])
     else:
         dist = os.path.join(topobjdir, 'dist')
 
     result = namespace(
         topsrcdir=topsrcdir,
--- a/python/mozbuild/mozbuild/base.py
+++ b/python/mozbuild/mozbuild/base.py
@@ -149,17 +149,17 @@ class MozbuildObject(ProcessExecutionMix
         If we're not inside a srcdir or objdir, an exception is raised.
 
         detect_virtualenv_mozinfo determines whether we should look for a
         mozinfo.json file relative to the virtualenv directory. This was
         added to facilitate testing. Callers likely shouldn't change the
         default.
         """
 
-        cwd = cwd or os.getcwd()
+        cwd = os.path.realpath(cwd or os.getcwd())
         topsrcdir = None
         topobjdir = None
         mozconfig = MozconfigLoader.AUTODETECT
 
         def load_mozinfo(path):
             info = json.load(io.open(path, 'rt', encoding='utf-8'))
             topsrcdir = info.get('topsrcdir')
             topobjdir = os.path.dirname(path)
--- a/python/mozbuild/mozbuild/config_status.py
+++ b/python/mozbuild/mozbuild/config_status.py
@@ -106,17 +106,17 @@ def config_status(topobjdir='.', topsrcd
                         help='what backend to build (default: %s).' %
                         ' '.join(default_backends))
     parser.add_argument('--dry-run', action='store_true',
                         help='do everything except writing files out.')
     options = parser.parse_args(args)
 
     # Without -n, the current directory is meant to be the top object directory
     if not options.not_topobjdir:
-        topobjdir = os.path.abspath('.')
+        topobjdir = os.path.realpath('.')
 
     env = ConfigEnvironment(topsrcdir, topobjdir, defines=defines,
                             non_global_defines=non_global_defines, substs=substs,
                             source=source, mozconfig=mozconfig)
 
     with FileAvoidWrite(os.path.join(topobjdir, 'mozinfo.json')) as f:
         write_mozinfo(f, env, os.environ)