Bug 1147283 - Replace mozpack.path with mozpath. r=mshal, a=sledru
authorMike Hommey <mh+mozilla@glandium.org>
Wed, 25 Mar 2015 15:05:28 +0900
changeset 258313 d59b572e546f
parent 258312 a72d76b284ea
child 258314 fc1e894eec2f
push id4643
push userryanvm@gmail.com
push date2015-04-07 14:24 +0000
treeherdermozilla-beta@0c29ab096b90 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmshal, sledru
bugs1147283
milestone38.0
Bug 1147283 - Replace mozpack.path with mozpath. r=mshal, a=sledru Back when mozpack.path was added, it was used as: import mozpack.path mozpack.path.func() Nowadays, the common idiom is: import mozpack.path as mozpath mozpath.func() because it's shorter. $ git grep mozpath\\. | wc -l 423 $ git grep mozpack.path\\. | wc -l 123 This change was done with: $ git grep -l mozpack.path\\. | xargs sed -i 's/mozpack\.path\./mozpath./g' $ git grep -l 'import mozpack.path$' | xargs sed -i 's/import mozpack.path$/\0 as mozpath/' $ (pat='import mozpack.path as mozpath'; git grep -l "$pat" | xargs sed -i "1,/$pat/b;/$pat/d")
layout/tools/reftest/mach_commands.py
python/mach_commands.py
python/mozbuild/mozbuild/backend/base.py
python/mozbuild/mozbuild/backend/mach_commands.py
python/mozbuild/mozbuild/base.py
python/mozbuild/mozpack/chrome/manifest.py
python/mozbuild/mozpack/copier.py
python/mozbuild/mozpack/files.py
python/mozbuild/mozpack/mozjar.py
python/mozbuild/mozpack/packager/__init__.py
python/mozbuild/mozpack/packager/formats.py
python/mozbuild/mozpack/packager/l10n.py
python/mozbuild/mozpack/packager/unpack.py
python/mozbuild/mozpack/test/test_copier.py
python/mozbuild/mozpack/test/test_files.py
python/mozbuild/mozpack/test/test_mozjar.py
python/mozbuild/mozpack/test/test_packager.py
python/mozbuild/mozpack/unify.py
services/common/tests/mach_commands.py
testing/mochitest/mach_commands.py
toolkit/mozapps/installer/packager.py
tools/mach_commands.py
--- a/layout/tools/reftest/mach_commands.py
+++ b/layout/tools/reftest/mach_commands.py
@@ -1,15 +1,15 @@
 # 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/.
 
 from __future__ import unicode_literals
 
-import mozpack.path
+import mozpack.path as mozpath
 import os
 import re
 import sys
 import warnings
 import which
 
 from mozbuild.base import (
     MachCommandBase,
@@ -100,23 +100,23 @@ class ReftestRunner(MozbuildObject):
         the top source directory, an absolute path to the same, or a directory
         containing a manifest.
         """
         assert test_file
         path_arg = self._wrap_path_argument(test_file)
         relpath = path_arg.relpath()
 
         if os.path.isdir(path_arg.srcdir_path()):
-            return (mozpack.path.join(relpath, self._manifest_file(suite)), None)
+            return (mozpath.join(relpath, self._manifest_file(suite)), None)
 
         if relpath.endswith('.list'):
             return (relpath, None)
 
-        return (self._find_manifest(suite, mozpack.path.dirname(test_file))[0],
-                mozpack.path.basename(test_file))
+        return (self._find_manifest(suite, mozpath.dirname(test_file))[0],
+                mozpath.basename(test_file))
 
     def _make_shell_string(self, s):
         return "'%s'" % re.sub("'", r"'\''", s)
 
     def run_b2g_test(self, b2g_home=None, xre_path=None, test_file=None,
                      suite=None, filter=None, **kwargs):
         """Runs a b2g reftest.
 
@@ -131,26 +131,26 @@ class ReftestRunner(MozbuildObject):
         'crashtest').
         """
         if suite not in ('reftest', 'crashtest'):
             raise Exception('None or unrecognized reftest suite type.')
 
         # Find the manifest file
         if not test_file:
             if suite == 'reftest':
-                test_file = mozpack.path.join('layout', 'reftests')
+                test_file = mozpath.join('layout', 'reftests')
             elif suite == 'crashtest':
-                test_file = mozpack.path.join('testing', 'crashtest')
+                test_file = mozpath.join('testing', 'crashtest')
 
         if not os.path.exists(os.path.join(self.topsrcdir, test_file)):
-            test_file = mozpack.path.relpath(os.path.abspath(test_file),
+            test_file = mozpath.relpath(os.path.abspath(test_file),
                                              self.topsrcdir)
 
         (manifest, single_file_filter) = self._find_manifest(suite, test_file)
-        if not os.path.exists(mozpack.path.join(self.topsrcdir, manifest)):
+        if not os.path.exists(mozpath.join(self.topsrcdir, manifest)):
             raise Exception('No manifest file was found at %s.' % manifest)
         if single_file_filter:
             if filter:
                 raise Exception('Cannot run single files in conjunction with --filter')
             filter = single_file_filter
 
         # Need to chdir to reftest_dir otherwise imports fail below.
         os.chdir(self.reftest_dir)
@@ -256,17 +256,17 @@ class ReftestRunner(MozbuildObject):
         if suite not in ('reftest', 'reftest-ipc', 'crashtest', 'crashtest-ipc', 'jstestbrowser'):
             raise Exception('None or unrecognized reftest suite type.')
 
         env = {}
         extra_args = []
 
         if test_file:
             (path, single_file_filter) = self._find_manifest(suite, test_file)
-            if not os.path.exists(mozpack.path.join(self.topsrcdir, path)):
+            if not os.path.exists(mozpath.join(self.topsrcdir, path)):
                 raise Exception('No manifest file was found at %s.' % path)
             if single_file_filter:
                 if filter:
                     raise Exception('Cannot run single files in conjunction with --filter')
                 filter = single_file_filter
             env[b'TEST_PATH'] = path
         if filter:
             extra_args.extend(['--filter', self._make_shell_string(filter)])
--- a/python/mach_commands.py
+++ b/python/mach_commands.py
@@ -2,17 +2,17 @@
 # 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 __future__ import print_function, unicode_literals
 
 import argparse
 import glob
 import logging
-import mozpack.path
+import mozpack.path as mozpath
 import os
 import sys
 
 from mozbuild.base import (
     MachCommandBase,
 )
 
 from mach.decorators import (
@@ -66,26 +66,26 @@ class MachCommands(MachCommandBase):
         # from topsrcdir or cd'd into their test directory) and topsrcdir (to
         # support people running mach from the objdir).  The |break|s in the
         # loop below ensure that we don't run tests twice if we're running mach
         # from topsrcdir
         search_dirs = ['.', self.topsrcdir]
         last_search_dir = search_dirs[-1]
         for t in tests:
             for d in search_dirs:
-                test = mozpack.path.join(d, t)
+                test = mozpath.join(d, t)
                 if test.endswith('.py') and os.path.isfile(test):
                     files.append(test)
                     break
                 elif os.path.isfile(test + '.py'):
                     files.append(test + '.py')
                     break
                 elif os.path.isdir(test):
-                    files += glob.glob(mozpack.path.join(test, 'test*.py'))
-                    files += glob.glob(mozpack.path.join(test, 'unit*.py'))
+                    files += glob.glob(mozpath.join(test, 'test*.py'))
+                    files += glob.glob(mozpath.join(test, 'unit*.py'))
                     break
                 elif d == last_search_dir:
                     self.log(logging.WARN, 'python-test',
                              {'test': t},
                              'TEST-UNEXPECTED-FAIL | Invalid test: {test}')
                     if stop:
                         return 1
 
--- a/python/mozbuild/mozbuild/backend/base.py
+++ b/python/mozbuild/mozbuild/backend/base.py
@@ -21,17 +21,16 @@ import mozpack.path as mozpath
 from ..preprocessor import Preprocessor
 from ..pythonutil import iter_modules_in_path
 from ..util import FileAvoidWrite
 from ..frontend.data import (
     ContextDerived,
     ReaderSummary,
 )
 from .configenvironment import ConfigEnvironment
-import mozpack.path as mozpath
 
 
 class BackendConsumeSummary(object):
     """Holds state about what a backend did.
 
     This is used primarily to print a summary of what the backend did
     so people know what's going on.
     """
--- a/python/mozbuild/mozbuild/backend/mach_commands.py
+++ b/python/mozbuild/mozbuild/backend/mach_commands.py
@@ -2,17 +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 __future__ import print_function, unicode_literals
 
 import argparse
 import glob
 import logging
-import mozpack.path
 import os
 import sys
 import subprocess
 import which
 
 from mozbuild.backend.cpp_eclipse import CppEclipseBackend
 
 from mozbuild.base import (
--- a/python/mozbuild/mozbuild/base.py
+++ b/python/mozbuild/mozbuild/base.py
@@ -1,17 +1,17 @@
 # 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/.
 
 from __future__ import print_function, unicode_literals
 
 import json
 import logging
-import mozpack.path
+import mozpack.path as mozpath
 import multiprocessing
 import os
 import subprocess
 import sys
 import which
 
 from mach.mixin.logging import LoggingMixin
 from mach.mixin.process import ProcessExecutionMixin
@@ -701,17 +701,17 @@ class PathArgument(object):
         just return the path within the base directory."""
 
         abspath = os.path.abspath(os.path.join(self.cwd, self.arg))
 
         # If that path is within topsrcdir or topobjdir, return an equivalent
         # path relative to that base directory.
         for base_dir in [self.topobjdir, self.topsrcdir]:
             if abspath.startswith(os.path.abspath(base_dir)):
-                return mozpack.path.relpath(abspath, base_dir)
+                return mozpath.relpath(abspath, base_dir)
 
-        return mozpack.path.normsep(self.arg)
+        return mozpath.normsep(self.arg)
 
     def srcdir_path(self):
-        return mozpack.path.join(self.topsrcdir, self.relpath())
+        return mozpath.join(self.topsrcdir, self.relpath())
 
     def objdir_path(self):
-        return mozpack.path.join(self.topobjdir, self.relpath())
+        return mozpath.join(self.topobjdir, self.relpath())
--- a/python/mozbuild/mozpack/chrome/manifest.py
+++ b/python/mozbuild/mozpack/chrome/manifest.py
@@ -1,16 +1,16 @@
 # 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 re
 import os
 from urlparse import urlparse
-import mozpack.path
+import mozpack.path as mozpath
 from mozpack.chrome.flags import Flags
 from mozpack.errors import errors
 
 
 class ManifestEntry(object):
     '''
     Base class for all manifest entry types.
     Subclasses may define the following class or member variables:
@@ -96,22 +96,22 @@ class ManifestEntryWithRelPath(ManifestE
         return self.serialize(self.relpath)
 
     def rebase(self, base):
         '''
         Return a new manifest entry with all relative paths defined in the
         entry relative to a new base directory.
         '''
         clone = ManifestEntry.rebase(self, base)
-        clone.relpath = mozpack.path.rebase(self.base, base, self.relpath)
+        clone.relpath = mozpath.rebase(self.base, base, self.relpath)
         return clone
 
     @property
     def path(self):
-        return mozpack.path.normpath(mozpack.path.join(self.base,
+        return mozpath.normpath(mozpath.join(self.base,
                                                        self.relpath))
 
 
 class Manifest(ManifestEntryWithRelPath):
     '''
     Class for 'manifest' entries.
         manifest some/path/to/another.manifest
     '''
@@ -123,17 +123,17 @@ class ManifestChrome(ManifestEntryWithRe
     Abstract class for chrome entries.
     '''
     def __init__(self, base, name, relpath, *flags):
         ManifestEntryWithRelPath.__init__(self, base, relpath, *flags)
         self.name = name
 
     @property
     def location(self):
-        return mozpack.path.join(self.base, self.relpath)
+        return mozpath.join(self.base, self.relpath)
 
 
 class ManifestContent(ManifestChrome):
     '''
     Class for 'content' entries.
         content global content/global/
     '''
     type = 'content'
@@ -246,17 +246,17 @@ class ManifestResource(ManifestEntry):
     def __str__(self):
         return self.serialize(self.name, self.target)
 
     def rebase(self, base):
         u = urlparse(self.target)
         if u.scheme and u.scheme != 'jar':
             return ManifestEntry.rebase(self, base)
         clone = ManifestEntry.rebase(self, base)
-        clone.target = mozpack.path.rebase(self.base, base, self.target)
+        clone.target = mozpath.rebase(self.base, base, self.target)
         return clone
 
 
 class ManifestBinaryComponent(ManifestEntryWithRelPath):
     '''
     Class for 'binary-component' entries.
         binary-component some/path/to/a/component.dll
     '''
@@ -339,17 +339,17 @@ def parse_manifest_line(base, line):
         return errors.fatal('Unknown manifest directive: %s' % cmd[0])
     return MANIFESTS_TYPES[cmd[0]](base, *cmd[1:])
 
 
 def parse_manifest(root, path, fileobj=None):
     '''
     Parse a manifest file.
     '''
-    base = mozpack.path.dirname(path)
+    base = mozpath.dirname(path)
     if root:
         path = os.path.normpath(os.path.abspath(os.path.join(root, path)))
     if not fileobj:
         fileobj = open(path)
     linenum = 0
     for line in fileobj:
         linenum += 1
         with errors.context(path, linenum):
--- a/python/mozbuild/mozpack/copier.py
+++ b/python/mozbuild/mozpack/copier.py
@@ -5,17 +5,17 @@
 import os
 import stat
 
 from mozpack.errors import errors
 from mozpack.files import (
     BaseFile,
     Dest,
 )
-import mozpack.path
+import mozpack.path as mozpath
 import errno
 from collections import (
     Counter,
     OrderedDict,
 )
 
 
 class FileRegistry(object):
@@ -36,17 +36,17 @@ class FileRegistry(object):
 
     def _partial_paths(self, path):
         '''
         Turn "foo/bar/baz/zot" into ["foo/bar/baz", "foo/bar", "foo"].
         '''
         partial_paths = []
         partial_path = path
         while partial_path:
-            partial_path = mozpack.path.dirname(partial_path)
+            partial_path = mozpath.dirname(partial_path)
             if partial_path:
                 partial_paths.append(partial_path)
         return partial_paths
 
     def add(self, path, content):
         '''
         Add a BaseFile instance to the container, under the given path.
         '''
@@ -68,23 +68,23 @@ class FileRegistry(object):
     def match(self, pattern):
         '''
         Return the list of paths, stored in the container, matching the
         given pattern. See the mozpack.path.match documentation for a
         description of the handled patterns.
         '''
         if '*' in pattern:
             return [p for p in self.paths()
-                    if mozpack.path.match(p, pattern)]
+                    if mozpath.match(p, pattern)]
         if pattern == '':
             return self.paths()
         if pattern in self._files:
             return [pattern]
         return [p for p in self.paths()
-                if mozpack.path.basedir(p, [pattern]) == pattern]
+                if mozpath.basedir(p, [pattern]) == pattern]
 
     def remove(self, pattern):
         '''
         Remove paths matching the given pattern from the container. See the
         mozpack.path.match documentation for a description of the handled
         patterns.
         '''
         items = self.match(pattern)
--- a/python/mozbuild/mozpack/files.py
+++ b/python/mozbuild/mozpack/files.py
@@ -21,17 +21,17 @@ from mozpack.executables import (
 )
 from mozpack.chrome.manifest import ManifestEntry
 from io import BytesIO
 from mozpack.errors import (
     ErrorMessage,
     errors,
 )
 from mozpack.mozjar import JarReader
-import mozpack.path
+import mozpack.path as mozpath
 from collections import OrderedDict
 from jsmin import JavascriptMinify
 from tempfile import (
     mkstemp,
     NamedTemporaryFile,
 )
 
 # For clean builds, copying files on win32 using CopyFile through ctypes is
@@ -407,17 +407,17 @@ class PreprocessedFile(BaseFile):
             if os.path.islink(dest.path):
                 os.remove(dest.path)
 
         pp_deps = set(self.extra_depends)
 
         # If a dependency file was specified, and it exists, add any
         # dependencies from that file to our list.
         if self.depfile and os.path.exists(self.depfile):
-            target = mozpack.path.normpath(dest.name)
+            target = mozpath.normpath(dest.name)
             with open(self.depfile, 'rb') as fileobj:
                 for rule in makeutil.read_dep_makefile(fileobj):
                     if target in rule.targets():
                         pp_deps.update(rule.dependencies())
 
         skip = False
         if dest.exists() and skip_if_older:
             # If a dependency file was specified, and it doesn't exist,
@@ -750,111 +750,111 @@ class FileFinder(BaseFinder):
         Create a FileFinder for files under the given base directory.
 
         The find_executables argument determines whether the finder needs to
         try to guess whether files are executables. Disabling this guessing
         when not necessary can speed up the finder significantly.
 
         ``ignore`` accepts an iterable of patterns to ignore. Entries are
         strings that match paths relative to ``base`` using
-        ``mozpack.path.match()``. This means if an entry corresponds
+        ``mozpath.match()``. This means if an entry corresponds
         to a directory, all files under that directory will be ignored. If
         an entry corresponds to a file, that particular file will be ignored.
         '''
         BaseFinder.__init__(self, base, **kargs)
         self.find_executables = find_executables
         self.ignore = ignore
 
     def _find(self, pattern):
         '''
         Actual implementation of FileFinder.find(), dispatching to specialized
         member functions depending on what kind of pattern was given.
         Note all files with a name starting with a '.' are ignored when
         scanning directories, but are not ignored when explicitely requested.
         '''
         if '*' in pattern:
-            return self._find_glob('', mozpack.path.split(pattern))
+            return self._find_glob('', mozpath.split(pattern))
         elif os.path.isdir(os.path.join(self.base, pattern)):
             return self._find_dir(pattern)
         else:
             return self._find_file(pattern)
 
     def _find_dir(self, path):
         '''
         Actual implementation of FileFinder.find() when the given pattern
         corresponds to an existing directory under the base directory.
         Ignores file names starting with a '.' under the given path. If the
         path itself has leafs starting with a '.', they are not ignored.
         '''
         for p in self.ignore:
-            if mozpack.path.match(path, p):
+            if mozpath.match(path, p):
                 return
 
         # The sorted makes the output idempotent. Otherwise, we are
         # likely dependent on filesystem implementation details, such as
         # inode ordering.
         for p in sorted(os.listdir(os.path.join(self.base, path))):
             if p.startswith('.'):
                 continue
-            for p_, f in self._find(mozpack.path.join(path, p)):
+            for p_, f in self._find(mozpath.join(path, p)):
                 yield p_, f
 
     def _find_file(self, path):
         '''
         Actual implementation of FileFinder.find() when the given pattern
         corresponds to an existing file under the base directory.
         '''
         srcpath = os.path.join(self.base, path)
         if not os.path.exists(srcpath):
             return
 
         for p in self.ignore:
-            if mozpack.path.match(path, p):
+            if mozpath.match(path, p):
                 return
 
         if self.find_executables and is_executable(srcpath):
             yield path, ExecutableFile(srcpath)
         else:
             yield path, File(srcpath)
 
     def _find_glob(self, base, pattern):
         '''
         Actual implementation of FileFinder.find() when the given pattern
         contains globbing patterns ('*' or '**'). This is meant to be an
         equivalent of:
             for p, f in self:
-                if mozpack.path.match(p, pattern):
+                if mozpath.match(p, pattern):
                     yield p, f
         but avoids scanning the entire tree.
         '''
         if not pattern:
             for p, f in self._find(base):
                 yield p, f
         elif pattern[0] == '**':
             for p, f in self._find(base):
-                if mozpack.path.match(p, mozpack.path.join(*pattern)):
+                if mozpath.match(p, mozpath.join(*pattern)):
                     yield p, f
         elif '*' in pattern[0]:
             if not os.path.exists(os.path.join(self.base, base)):
                 return
 
             for p in self.ignore:
-                if mozpack.path.match(base, p):
+                if mozpath.match(base, p):
                     return
 
             # See above comment w.r.t. sorted() and idempotent behavior.
             for p in sorted(os.listdir(os.path.join(self.base, base))):
                 if p.startswith('.') and not pattern[0].startswith('.'):
                     continue
-                if mozpack.path.match(p, pattern[0]):
-                    for p_, f in self._find_glob(mozpack.path.join(base, p),
+                if mozpath.match(p, pattern[0]):
+                    for p_, f in self._find_glob(mozpath.join(base, p),
                                                  pattern[1:]):
                         yield p_, f
         else:
-            for p, f in self._find_glob(mozpack.path.join(base, pattern[0]),
+            for p, f in self._find_glob(mozpath.join(base, pattern[0]),
                                         pattern[1:]):
                 yield p, f
 
 
 class JarFinder(BaseFinder):
     '''
     Helper to get appropriate DeflatedFile instances from a JarReader.
     '''
@@ -869,19 +869,19 @@ class JarFinder(BaseFinder):
 
     def _find(self, pattern):
         '''
         Actual implementation of JarFinder.find(), dispatching to specialized
         member functions depending on what kind of pattern was given.
         '''
         if '*' in pattern:
             for p in self._files:
-                if mozpack.path.match(p, pattern):
+                if mozpath.match(p, pattern):
                     yield p, DeflatedFile(self._files[p])
         elif pattern == '':
             for p in self._files:
                 yield p, DeflatedFile(self._files[p])
         elif pattern in self._files:
             yield pattern, DeflatedFile(self._files[pattern])
         else:
             for p in self._files:
-                if mozpack.path.basedir(p, [pattern]) == pattern:
+                if mozpath.basedir(p, [pattern]) == pattern:
                     yield p, DeflatedFile(self._files[p])
--- a/python/mozbuild/mozpack/mozjar.py
+++ b/python/mozbuild/mozpack/mozjar.py
@@ -7,17 +7,17 @@ import struct
 import zlib
 import os
 from zipfile import (
     ZIP_STORED,
     ZIP_DEFLATED,
 )
 from collections import OrderedDict
 from urlparse import urlparse, ParseResult
-import mozpack.path
+import mozpack.path as mozpath
 
 JAR_STORED = ZIP_STORED
 JAR_DEFLATED = ZIP_DEFLATED
 MAX_WBITS = 15
 
 
 class JarReaderError(Exception):
     '''Error type for Jar reader errors.'''
@@ -575,17 +575,17 @@ class JarWriter(object):
         True), it is only really compressed if the compressed size is smaller
         than the uncompressed size.
         The mode option gives the unix permissions that should be stored
         for the jar entry.
         The given data may be a buffer, a file-like instance, a Deflater or a
         JarFileReader instance. The latter two allow to avoid uncompressing
         data to recompress it.
         '''
-        name = mozpack.path.normsep(name)
+        name = mozpath.normsep(name)
 
         if name in self._contents:
             raise JarWriterError("File %s already in JarWriter" % name)
         if compress is None:
             compress = self._compress
         if (isinstance(data, JarFileReader) and data.compressed == compress) \
                 or (isinstance(data, Deflater) and data.compress == compress):
             deflater = data
@@ -798,9 +798,9 @@ class JarLog(dict):
             assert os.path.isabs(url.path)
             path = url.path
             # On Windows, url.path will be /drive:/path ; on Unix systems,
             # /path. As we want drive:/path instead of /drive:/path on Windows,
             # remove the leading /.
             if os.path.isabs(path[1:]):
                 path = path[1:]
             path = os.path.realpath(path)
-            return mozpack.path.normsep(os.path.normcase(path))
+            return mozpath.normsep(os.path.normcase(path))
--- a/python/mozbuild/mozpack/packager/__init__.py
+++ b/python/mozbuild/mozpack/packager/__init__.py
@@ -8,17 +8,17 @@ import os
 from mozpack.errors import errors
 from mozpack.chrome.manifest import (
     Manifest,
     ManifestChrome,
     ManifestInterfaces,
     is_manifest,
     parse_manifest,
 )
-import mozpack.path
+import mozpack.path as mozpath
 from collections import deque
 
 
 class Component(object):
     '''
     Class that represents a component in a package manifest.
     '''
     def __init__(self, name, destdir=''):
@@ -248,28 +248,28 @@ class SimplePackager(object):
         '''
         assert not self._closed
         if is_manifest(path):
             self._add_manifest_file(path, file)
         elif path.endswith('.xpt'):
             self._queue.append(self.formatter.add_interfaces, path, file)
         else:
             self._file_queue.append(self.formatter.add, path, file)
-            if mozpack.path.basename(path) == 'install.rdf':
-                self._addons.add(mozpack.path.dirname(path))
+            if mozpath.basename(path) == 'install.rdf':
+                self._addons.add(mozpath.dirname(path))
 
     def _add_manifest_file(self, path, file):
         '''
         Add the given BaseFile with manifest file contents with the given path.
         '''
         self._manifests.add(path)
         base = ''
         if hasattr(file, 'path'):
             # Find the directory the given path is relative to.
-            b = mozpack.path.normsep(file.path)
+            b = mozpath.normsep(file.path)
             if b.endswith('/' + path) or b == path:
                 base = os.path.normpath(b[:-len(path)])
         for e in parse_manifest(base, path, file.open()):
             # ManifestResources need to be given after ManifestChrome, so just
             # put all ManifestChrome in a separate queue to make them first.
             if isinstance(e, ManifestChrome):
                 # e.move(e.base) just returns a clone of the entry.
                 self._chrome_queue.append(self.formatter.add_manifest,
@@ -283,29 +283,29 @@ class SimplePackager(object):
                 self._included_manifests.add(e.path)
 
     def get_bases(self, addons=True):
         '''
         Return all paths under which root manifests have been found. Root
         manifests are manifests that are included in no other manifest.
         `addons` indicates whether to include addon bases as well.
         '''
-        all_bases = set(mozpack.path.dirname(m)
+        all_bases = set(mozpath.dirname(m)
                         for m in self._manifests - self._included_manifests)
         if not addons:
             all_bases -= self._addons
         return all_bases
 
     def close(self):
         '''
         Push all instructions to the formatter.
         '''
         self._closed = True
         broken_addons = sorted(m for m in self._included_manifests
-                               if mozpack.path.dirname(m) in self._addons)
+                               if mozpath.dirname(m) in self._addons)
         if broken_addons:
             errors.fatal(
                 'Addon base manifest (%s) is included in some other manifest' %
                 ', '.join(broken_addons)
             )
         for base in self.get_bases():
             if base:
                 self.formatter.add_base(base, base in self._addons)
@@ -334,31 +334,31 @@ class SimpleManifestSink(object):
         self._closed = False
         self._manifests = set()
 
     @staticmethod
     def normalize_path(path):
         '''
         Remove any bin/ prefix.
         '''
-        if mozpack.path.basedir(path, ['bin']) == 'bin':
-            return mozpack.path.relpath(path, 'bin')
+        if mozpath.basedir(path, ['bin']) == 'bin':
+            return mozpath.relpath(path, 'bin')
         return path
 
     def add(self, component, pattern):
         '''
         Add files with the given pattern in the given component.
         '''
         assert not self._closed
         added = False
         for p, f in self._finder.find(pattern):
             added = True
             if is_manifest(p):
                 self._manifests.add(p)
-            dest = mozpack.path.join(component.destdir, SimpleManifestSink.normalize_path(p))
+            dest = mozpath.join(component.destdir, SimpleManifestSink.normalize_path(p))
             self.packager.add(dest, f)
         if not added:
             errors.error('Missing file(s): %s' % pattern)
 
     def remove(self, component, pattern):
         '''
         Remove files with the given pattern in the given component.
         '''
@@ -367,15 +367,15 @@ class SimpleManifestSink(object):
 
     def close(self, auto_root_manifest=True):
         '''
         Add possibly missing bits and push all instructions to the formatter.
         '''
         if auto_root_manifest:
             # Simple package manifests don't contain the root manifests, so
             # find and add them.
-            paths = [mozpack.path.dirname(m) for m in self._manifests]
-            path = mozpack.path.dirname(mozpack.path.commonprefix(paths))
-            for p, f in self._finder.find(mozpack.path.join(path,
+            paths = [mozpath.dirname(m) for m in self._manifests]
+            path = mozpath.dirname(mozpath.commonprefix(paths))
+            for p, f in self._finder.find(mozpath.join(path,
                                           'chrome.manifest')):
                 if not p in self._manifests:
                     self.packager.add(SimpleManifestSink.normalize_path(p), f)
         self.packager.close()
--- a/python/mozbuild/mozpack/packager/formats.py
+++ b/python/mozbuild/mozpack/packager/formats.py
@@ -5,17 +5,17 @@
 from mozpack.chrome.manifest import (
     Manifest,
     ManifestInterfaces,
     ManifestChrome,
     ManifestBinaryComponent,
     ManifestResource,
 )
 from urlparse import urlparse
-import mozpack.path
+import mozpack.path as mozpath
 from mozpack.files import (
     ManifestFile,
     XPTFile,
 )
 from mozpack.copier import (
     FileRegistry,
     Jarrer,
 )
@@ -82,53 +82,53 @@ class FlatFormatter(object):
         if addon and base not in self._addons:
             self._addons.append(base)
 
     def _get_base(self, path):
         '''
         Return the deepest base directory containing the given path.
         '''
         self._frozen_bases = True
-        return mozpack.path.basedir(path, self._bases)
+        return mozpath.basedir(path, self._bases)
 
     def add(self, path, content):
         self.copier.add(path, content)
 
     def add_manifest(self, entry):
         # Store manifest entries in a single manifest per directory, named
         # after their parent directory, except for root manifests, all named
         # chrome.manifest.
         base = self._get_base(entry.base)
         if entry.base == base:
             name = 'chrome'
         else:
-            name = mozpack.path.basename(entry.base)
-        path = mozpack.path.normpath(mozpack.path.join(entry.base,
+            name = mozpath.basename(entry.base)
+        path = mozpath.normpath(mozpath.join(entry.base,
                                                        '%s.manifest' % name))
         if not self.copier.contains(path):
-            assert mozpack.path.basedir(entry.base, [base]) == base
+            assert mozpath.basedir(entry.base, [base]) == base
             # Add a reference to the manifest file in the parent manifest, if
             # the manifest file is not a root manifest.
             if len(entry.base) > len(base):
-                parent = mozpack.path.dirname(entry.base)
-                relbase = mozpack.path.basename(entry.base)
-                relpath = mozpack.path.join(relbase,
-                                            mozpack.path.basename(path))
+                parent = mozpath.dirname(entry.base)
+                relbase = mozpath.basename(entry.base)
+                relpath = mozpath.join(relbase,
+                                            mozpath.basename(path))
                 FlatFormatter.add_manifest(self, Manifest(parent, relpath))
             self.copier.add(path, ManifestFile(entry.base))
         self.copier[path].add(entry)
 
     def add_interfaces(self, path, content):
         # Interfaces in the same directory are all linked together in an
         # interfaces.xpt file.
-        interfaces_path = mozpack.path.join(mozpack.path.dirname(path),
+        interfaces_path = mozpath.join(mozpath.dirname(path),
                                             'interfaces.xpt')
         if not self.copier.contains(interfaces_path):
             FlatFormatter.add_manifest(self, ManifestInterfaces(
-                mozpack.path.dirname(path), 'interfaces.xpt'))
+                mozpath.dirname(path), 'interfaces.xpt'))
             self.copier.add(interfaces_path, XPTFile())
         self.copier[interfaces_path].add(content)
 
     def contains(self, path):
         assert '*' not in path
         return self.copier.contains(path)
 
 
@@ -147,41 +147,41 @@ class JarFormatter(FlatFormatter):
         self._optimize = optimize
 
     def _chromepath(self, path):
         '''
         Return the chrome base directory under which the given path is. Used to
         detect under which .jar (if any) the path should go.
         '''
         self._frozen_chrome = True
-        return mozpack.path.basedir(path, self._chrome)
+        return mozpath.basedir(path, self._chrome)
 
     def add(self, path, content):
         chrome = self._chromepath(path)
         if chrome:
             jar = chrome + '.jar'
             if not self.copier.contains(jar):
                 self.copier.add(jar, Jarrer(self._compress, self._optimize))
-            if not self.copier[jar].contains(mozpack.path.relpath(path,
+            if not self.copier[jar].contains(mozpath.relpath(path,
                                                                   chrome)):
-                self.copier[jar].add(mozpack.path.relpath(path, chrome),
+                self.copier[jar].add(mozpath.relpath(path, chrome),
                                      content)
         else:
             FlatFormatter.add(self, path, content)
 
     def _jarize(self, entry, relpath):
         '''
         Transform a manifest entry in one pointing to chrome data in a jar.
         Return the corresponding chrome path and the new entry.
         '''
         base = entry.base
-        basepath = mozpack.path.split(relpath)[0]
-        chromepath = mozpack.path.join(base, basepath)
+        basepath = mozpath.split(relpath)[0]
+        chromepath = mozpath.join(base, basepath)
         entry = entry.rebase(chromepath) \
-            .move(mozpack.path.join(base, 'jar:%s.jar!' % basepath)) \
+            .move(mozpath.join(base, 'jar:%s.jar!' % basepath)) \
             .rebase(base)
         return chromepath, entry
 
     def add_manifest(self, entry):
         if isinstance(entry, ManifestChrome) and \
                 not urlparse(entry.relpath).scheme:
             chromepath, entry = self._jarize(entry, entry.relpath)
             assert not self._frozen_chrome
@@ -196,17 +196,17 @@ class JarFormatter(FlatFormatter):
     def contains(self, path):
         assert '*' not in path
         chrome = self._chromepath(path)
         if not chrome:
             return self.copier.contains(path)
         if not self.copier.contains(chrome + '.jar'):
             return False
         return self.copier[chrome + '.jar']. \
-            contains(mozpack.path.relpath(path, chrome))
+            contains(mozpath.relpath(path, chrome))
 
 
 class OmniJarFormatter(JarFormatter):
     '''
     Formatter for the omnijar package format.
     '''
     def __init__(self, copier, omnijar_name, compress=True, optimize=True,
                  non_resources=[]):
@@ -226,58 +226,58 @@ class OmniJarFormatter(JarFormatter):
             if is_resource is None:
                 is_resource = self.is_resource(path, base)
             use_omnijar = is_resource
         if not use_omnijar:
             return super(OmniJarFormatter, self), '', path
         if not base in self.omnijars:
             omnijar = Jarrer(self._compress, self._optimize)
             self.omnijars[base] = FlatFormatter(omnijar)
-            self.copier.add(mozpack.path.join(base, self._omnijar_name),
+            self.copier.add(mozpath.join(base, self._omnijar_name),
                             omnijar)
-        return self.omnijars[base], base, mozpack.path.relpath(path, base)
+        return self.omnijars[base], base, mozpath.relpath(path, base)
 
     def add(self, path, content):
         formatter, base, path = self._get_formatter(path)
         formatter.add(path, content)
 
     def add_manifest(self, entry):
         if isinstance(entry, ManifestBinaryComponent):
             formatter, base = super(OmniJarFormatter, self), ''
         else:
             formatter, base, path = self._get_formatter(entry.base,
                                                         is_resource=True)
-        entry = entry.move(mozpack.path.relpath(entry.base, base))
+        entry = entry.move(mozpath.relpath(entry.base, base))
         formatter.add_manifest(entry)
 
     def add_interfaces(self, path, content):
         formatter, base, path = self._get_formatter(path)
         formatter.add_interfaces(path, content)
 
     def contains(self, path):
         assert '*' not in path
         if self.copier.contains(path):
             return True
         for base, copier in self.omnijars.iteritems():
-            if copier.contains(mozpack.path.relpath(path, base)):
+            if copier.contains(mozpath.relpath(path, base)):
                 return True
         return False
 
     def is_resource(self, path, base=None):
         '''
         Return whether the given path corresponds to a resource to be put in an
         omnijar archive.
         '''
         if base is None:
             base = self._get_base(path)
-        path = mozpack.path.relpath(path, base)
-        if any(mozpack.path.match(path, p.replace('*', '**'))
+        path = mozpath.relpath(path, base)
+        if any(mozpath.match(path, p.replace('*', '**'))
                for p in self._non_resources):
             return False
-        path = mozpack.path.split(path)
+        path = mozpath.split(path)
         if path[0] == 'chrome':
             return len(path) == 1 or path[1] != 'icons'
         if path[0] == 'components':
             return path[-1].endswith(('.js', '.xpt'))
         if path[0] == 'res':
             return len(path) == 1 or \
                 (path[1] != 'cursors' and path[1] != 'MainMenu.nib')
         if path[0] == 'defaults':
--- a/python/mozbuild/mozpack/packager/l10n.py
+++ b/python/mozbuild/mozpack/packager/l10n.py
@@ -3,17 +3,17 @@
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 '''
 Replace localized parts of a packaged directory with data from a langpack
 directory.
 '''
 
 import os
-import mozpack.path
+import mozpack.path as mozpath
 from mozpack.packager.formats import (
     FlatFormatter,
     JarFormatter,
     OmniJarFormatter,
 )
 from mozpack.packager import SimplePackager
 from mozpack.files import ManifestFile
 from mozpack.copier import (
@@ -40,20 +40,20 @@ class LocaleManifestFinder(object):
         assert all(isinstance(m, ManifestFile)
                    for m in manifests.itervalues())
         self.entries = [e for m in manifests.itervalues()
                         for e in m if e.localized]
         # Find unique locales used in these manifest entries.
         self.locales = list(set(e.id for e in self.entries
                                 if isinstance(e, ManifestLocale)))
         # Find all paths whose manifest are included by no other manifest.
-        includes = set(mozpack.path.join(e.base, e.relpath)
+        includes = set(mozpath.join(e.base, e.relpath)
                        for m in manifests.itervalues()
                        for e in m if isinstance(e, Manifest))
-        self.bases = [mozpack.path.dirname(p)
+        self.bases = [mozpath.dirname(p)
                       for p in set(manifests.keys()) - includes]
 
 
 def _repack(app_finder, l10n_finder, copier, formatter, non_chrome=set()):
     app = LocaleManifestFinder(app_finder)
     l10n = LocaleManifestFinder(l10n_finder)
 
     # The code further below assumes there's only one locale replaced with
@@ -67,40 +67,40 @@ def _repack(app_finder, l10n_finder, cop
     # corresponds to.
     # e.g., for the following entry under app/chrome:
     #     locale foo en-US path/to/files
     # keep track that the locale path for foo in app is
     # app/chrome/path/to/files.
     l10n_paths = {}
     for e in l10n.entries:
         if isinstance(e, ManifestChrome):
-            base = mozpack.path.basedir(e.path, app.bases)
+            base = mozpath.basedir(e.path, app.bases)
             l10n_paths.setdefault(base, {})
             l10n_paths[base][e.name] = e.path
 
     # For chrome and non chrome files or directories, store what langpack path
     # corresponds to a package path.
     paths = {}
     for e in app.entries:
         if isinstance(e, ManifestEntryWithRelPath):
-            base = mozpack.path.basedir(e.path, app.bases)
+            base = mozpath.basedir(e.path, app.bases)
             if base not in l10n_paths:
                 errors.fatal("Locale doesn't contain %s/" % base)
                 # Allow errors to accumulate
                 continue
             if e.name not in l10n_paths[base]:
                 errors.fatal("Locale doesn't have a manifest entry for '%s'" %
                     e.name)
                 # Allow errors to accumulate
                 continue
             paths[e.path] = l10n_paths[base][e.name]
 
     for pattern in non_chrome:
         for base in app.bases:
-            path = mozpack.path.join(base, pattern)
+            path = mozpath.join(base, pattern)
             left = set(p for p, f in app_finder.find(path))
             right = set(p for p, f in l10n_finder.find(path))
             for p in right:
                 paths[p] = p
             for p in left - right:
                 paths[p] = None
 
     # Create a new package, with non localized bits coming from the original
@@ -114,53 +114,53 @@ def _repack(app_finder, l10n_finder, cop
         # If the path is one that needs a locale replacement, use the
         # corresponding file from the langpack.
         path = None
         if p in paths:
             path = paths[p]
             if not path:
                 continue
         else:
-            base = mozpack.path.basedir(p, paths.keys())
+            base = mozpath.basedir(p, paths.keys())
             if base:
-                subpath = mozpack.path.relpath(p, base)
-                path = mozpack.path.normpath(mozpack.path.join(paths[base],
+                subpath = mozpath.relpath(p, base)
+                path = mozpath.normpath(mozpath.join(paths[base],
                                                                subpath))
         if path:
             files = [f for p, f in l10n_finder.find(path)]
             if not len(files):
                 if base not in non_chrome:
                     errors.error("Missing file: %s" %
                                  os.path.join(l10n_finder.base, path))
             else:
                 packager.add(path, files[0])
         else:
             packager.add(p, f)
 
     # Add localized manifest entries from the langpack.
     l10n_manifests = []
     for base in set(e.base for e in l10n.entries):
         m = ManifestFile(base, [e for e in l10n.entries if e.base == base])
-        path = mozpack.path.join(base, 'chrome.%s.manifest' % l10n_locale)
+        path = mozpath.join(base, 'chrome.%s.manifest' % l10n_locale)
         l10n_manifests.append((path, m))
     bases = packager.get_bases()
     for path, m in l10n_manifests:
-        base = mozpack.path.basedir(path, bases)
+        base = mozpath.basedir(path, bases)
         packager.add(path, m)
         # Add a "manifest $path" entry in the top manifest under that base.
         m = ManifestFile(base)
-        m.add(Manifest(base, mozpack.path.relpath(path, base)))
-        packager.add(mozpack.path.join(base, 'chrome.manifest'), m)
+        m.add(Manifest(base, mozpath.relpath(path, base)))
+        packager.add(mozpath.join(base, 'chrome.manifest'), m)
 
     packager.close()
 
     # Add any remaining non chrome files.
     for pattern in non_chrome:
         for base in bases:
-            for p, f in l10n_finder.find(mozpack.path.join(base, pattern)):
+            for p, f in l10n_finder.find(mozpath.join(base, pattern)):
                 if not formatter.contains(p):
                     formatter.add(p, f)
 
     # Transplant jar preloading information.
     for path, log in app_finder.jarlogs.iteritems():
         assert isinstance(copier[path], Jarrer)
         copier[path].preload([l.replace(locale, l10n_locale) for l in log])
 
--- a/python/mozbuild/mozpack/packager/unpack.py
+++ b/python/mozbuild/mozpack/packager/unpack.py
@@ -1,13 +1,13 @@
 # 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 mozpack.path
+import mozpack.path as mozpath
 from mozpack.files import (
     FileFinder,
     DeflatedFile,
     ManifestFile,
 )
 from mozpack.chrome.manifest import (
     parse_manifest,
     ManifestEntryWithRelPath,
@@ -45,28 +45,28 @@ class UnpackFinder(FileFinder):
         self.optimizedjars = False
 
         jars = set()
 
         for p, f in FileFinder.find(self, '*'):
             # Skip the precomplete file, which is generated at packaging time.
             if p == 'precomplete':
                 continue
-            base = mozpack.path.dirname(p)
+            base = mozpath.dirname(p)
             # If the file is a zip/jar that is not a .xpi, and contains a
             # chrome.manifest, it is an omnijar. All the files it contains
             # go in the directory containing the omnijar. Manifests are merged
             # if there is a corresponding manifest in the directory.
             if not p.endswith('.xpi') and self._maybe_zip(f) and \
-                    (mozpack.path.basename(p) == self.omnijar or
+                    (mozpath.basename(p) == self.omnijar or
                      not self.omnijar):
                 jar = self._open_jar(p, f)
                 if 'chrome.manifest' in jar:
                     self.kind = 'omni'
-                    self.omnijar = mozpack.path.basename(p)
+                    self.omnijar = mozpath.basename(p)
                     self._fill_with_omnijar(base, jar)
                     continue
             # If the file is a manifest, scan its entries for some referencing
             # jar: urls. If there are some, the files contained in the jar they
             # point to, go under a directory named after the jar.
             if is_manifest(p):
                 m = self.files[p] if self.files.contains(p) \
                     else ManifestFile(base)
@@ -75,20 +75,20 @@ class UnpackFinder(FileFinder):
                 if self.files.contains(p):
                     continue
                 f = m
             if not p in jars:
                 self.files.add(p, f)
 
     def _fill_with_omnijar(self, base, jar):
         for j in jar:
-            path = mozpack.path.join(base, j.filename)
+            path = mozpath.join(base, j.filename)
             if is_manifest(j.filename):
                 m = self.files[path] if self.files.contains(path) \
-                    else ManifestFile(mozpack.path.dirname(path))
+                    else ManifestFile(mozpath.dirname(path))
                 for e in parse_manifest(None, path, j):
                     m.add(e)
                 if not self.files.contains(path):
                     self.files.add(path, m)
                 continue
             else:
                 self.files.add(path, DeflatedFile(j))
 
@@ -107,19 +107,19 @@ class UnpackFinder(FileFinder):
             if self.files.contains(jarpath):
                 jar = self.files[jarpath]
                 self.files.remove(jarpath)
             else:
                 jar = [f for p, f in FileFinder.find(self, jarpath)]
                 assert len(jar) == 1
                 jar = jar[0]
             if not jarpath in jars:
-                base = mozpack.path.splitext(jarpath)[0]
+                base = mozpath.splitext(jarpath)[0]
                 for j in self._open_jar(jarpath, jar):
-                    self.files.add(mozpack.path.join(base,
+                    self.files.add(mozpath.join(base,
                                                      j.filename),
                                    DeflatedFile(j))
             jars.add(jarpath)
             self.kind = 'jar'
         return entry
 
     def _open_jar(self, path, file):
         '''
@@ -149,32 +149,32 @@ class UnpackFinder(FileFinder):
     def _unjarize(self, entry, relpath):
         '''
         Transform a manifest entry pointing to chrome data in a jar in one
         pointing to the corresponding unpacked path. Return the jar path and
         the new entry.
         '''
         base = entry.base
         jar, relpath = urlparse(relpath).path.split('!', 1)
-        entry = entry.rebase(mozpack.path.join(base, 'jar:%s!' % jar)) \
-            .move(mozpack.path.join(base, mozpack.path.splitext(jar)[0])) \
+        entry = entry.rebase(mozpath.join(base, 'jar:%s!' % jar)) \
+            .move(mozpath.join(base, mozpath.splitext(jar)[0])) \
             .rebase(base)
-        return mozpack.path.join(base, jar), entry
+        return mozpath.join(base, jar), entry
 
 
 def unpack_to_registry(source, registry):
     '''
     Transform a jar chrome or omnijar packaged directory into a flat package.
 
     The given registry is filled with the flat package.
     '''
     finder = UnpackFinder(source)
     packager = SimplePackager(FlatFormatter(registry))
     for p, f in finder.find('*'):
-        if mozpack.path.split(p)[0] not in STARTUP_CACHE_PATHS:
+        if mozpath.split(p)[0] not in STARTUP_CACHE_PATHS:
             packager.add(p, f)
     packager.close()
 
 
 def unpack(source):
     '''
     Transform a jar chrome or omnijar packaged directory into a flat package.
     '''
--- a/python/mozbuild/mozpack/test/test_copier.py
+++ b/python/mozbuild/mozpack/test/test_copier.py
@@ -8,17 +8,17 @@ from mozpack.copier import (
     FileRegistry,
     Jarrer,
 )
 from mozpack.files import (
     GeneratedFile,
     ExistingFile,
 )
 from mozpack.mozjar import JarReader
-import mozpack.path
+import mozpack.path as mozpath
 import unittest
 import mozunit
 import os
 import stat
 from mozpack.errors import ErrorMessage
 from mozpack.test.test_files import (
     MockDest,
     MatchTestTemplate,
@@ -147,25 +147,25 @@ class TestFileRegistry(MatchTestTemplate
         self.assertEqual(self.registry.required_directories(), {'x', 'x/y'})
 
 
 class TestFileCopier(TestWithTmpDir):
     def all_dirs(self, base):
         all_dirs = set()
         for root, dirs, files in os.walk(base):
             if not dirs:
-                all_dirs.add(mozpack.path.relpath(root, base))
+                all_dirs.add(mozpath.relpath(root, base))
         return all_dirs
 
     def all_files(self, base):
         all_files = set()
         for root, dirs, files in os.walk(base):
             for f in files:
                 all_files.add(
-                    mozpack.path.join(mozpack.path.relpath(root, base), f))
+                    mozpath.join(mozpath.relpath(root, base), f))
         return all_files
 
     def test_file_copier(self):
         copier = FileCopier()
         copier.add('foo/bar', GeneratedFile('foobar'))
         copier.add('foo/qux', GeneratedFile('fooqux'))
         copier.add('foo/deep/nested/directory/file', GeneratedFile('fooz'))
         copier.add('bar', GeneratedFile('bar'))
--- a/python/mozbuild/mozpack/test/test_files.py
+++ b/python/mozbuild/mozpack/test/test_files.py
@@ -35,17 +35,17 @@ from mozpack.chrome.manifest import (
 )
 import unittest
 import mozfile
 import mozunit
 import os
 import random
 import string
 import sys
-import mozpack.path
+import mozpack.path as mozpath
 from tempfile import mkdtemp
 from io import BytesIO
 from StringIO import StringIO
 from xpt import Typelib
 
 
 class TestWithTmpDir(unittest.TestCase):
     def setUp(self):
@@ -875,17 +875,17 @@ class MatchTestTemplate(object):
                          ['foo/.bar/foo', 'foo/.foo'])
         for pattern in ['foo', '**', '**/*', '**/foo', 'foo/*']:
             self.assertFalse('foo/.foo' in [f for f, c in
                                             finder.find(pattern)])
             self.assertFalse('foo/.bar/foo' in [f for f, c in
                                                 finder.find(pattern)])
             self.assertEqual(sorted([f for f, c in finder.find(pattern)]),
                              sorted([f for f, c in finder
-                                     if mozpack.path.match(f, pattern)]))
+                                     if mozpath.match(f, pattern)]))
 
 
 def do_check(test, finder, pattern, result):
     if result:
         test.assertTrue(finder.contains(pattern))
     else:
         test.assertFalse(finder.contains(pattern))
     test.assertEqual(sorted(list(f for f, c in finder.find(pattern))),
--- a/python/mozbuild/mozpack/test/test_mozjar.py
+++ b/python/mozbuild/mozpack/test/test_mozjar.py
@@ -12,17 +12,17 @@ from mozpack.mozjar import (
     JarLog,
 )
 from collections import OrderedDict
 from mozpack.test.test_files import MockDest
 import unittest
 import mozunit
 from cStringIO import StringIO
 from urllib import pathname2url
-import mozpack.path
+import mozpack.path as mozpath
 import os
 
 
 class TestJarStruct(unittest.TestCase):
     class Foo(JarStruct):
         MAGIC = 0x01020304
         STRUCT = OrderedDict([
             ('foo', 'uint32'),
@@ -283,17 +283,17 @@ class TestJarLog(unittest.TestCase):
             'jar:' + base + '/qux.zip!/omni.ja stuff',
             base + '/bar/baz.jar third',
             'jar:jar:' + base + '/qux.zip!/baz/baz.jar!/omni.ja nested/stuff',
             'jar:jar:jar:' + base + '/qux.zip!/baz/baz.jar!/foo.zip!/omni.ja' +
             ' deeply/nested/stuff',
         ]))
         log = JarLog(fileobj=s)
         canonicalize = lambda p: \
-            mozpack.path.normsep(os.path.normcase(os.path.realpath(p)))
+            mozpath.normsep(os.path.normcase(os.path.realpath(p)))
         baz_jar = canonicalize('bar/baz.jar')
         qux_zip = canonicalize('qux.zip')
         self.assertEqual(set(log.keys()), set([
             baz_jar,
             (qux_zip, 'omni.ja'),
             (qux_zip, 'baz/baz.jar', 'omni.ja'),
             (qux_zip, 'baz/baz.jar', 'foo.zip', 'omni.ja'),
         ]))
--- a/python/mozbuild/mozpack/test/test_packager.py
+++ b/python/mozbuild/mozpack/test/test_packager.py
@@ -18,17 +18,17 @@ from mozpack.chrome.manifest import (
     ManifestContent,
 )
 from mozunit import MockedOpen
 from mozbuild.preprocessor import Preprocessor
 from mozpack.errors import (
     errors,
     ErrorMessage,
 )
-import mozpack.path
+import mozpack.path as mozpath
 
 MANIFEST = '''
 bar/*
 [foo]
 foo/*
 -foo/bar
 chrome.manifest
 [zot destdir="destdir"]
@@ -94,17 +94,17 @@ class TestPreprocessManifest(unittest.Te
 class MockFinder(object):
     def __init__(self, files):
         self.files = files
         self.log = []
 
     def find(self, path):
         self.log.append(path)
         for f in sorted(self.files):
-            if mozpack.path.match(f, path):
+            if mozpath.match(f, path):
                 yield f, self.files[f]
 
     def __iter__(self):
         return self.find('')
 
 
 class MockFormatter(object):
     def __init__(self):
--- a/python/mozbuild/mozpack/unify.py
+++ b/python/mozbuild/mozpack/unify.py
@@ -10,17 +10,17 @@ from mozpack.files import (
     GeneratedFile,
 )
 from mozpack.executables import (
     MACHO_SIGNATURES,
 )
 from mozpack.mozjar import JarReader
 from mozpack.errors import errors
 from tempfile import mkstemp
-import mozpack.path
+import mozpack.path as mozpath
 import struct
 import os
 import subprocess
 from collections import OrderedDict
 
 
 def may_unify_binary(file):
     '''
@@ -78,17 +78,17 @@ class UnifiedFinder(BaseFinder):
     def __init__(self, finder1, finder2, sorted=[], **kargs):
         '''
         Initialize a UnifiedFinder. finder1 and finder2 are BaseFinder
         instances from which files are picked. UnifiedFinder.find() will act as
         FileFinder.find() but will error out when matches can only be found in
         one of the two trees and not the other. It will also error out if
         matches can be found on both ends but their contents are not identical.
 
-        The sorted argument gives a list of mozpack.path.match patterns. File
+        The sorted argument gives a list of mozpath.match patterns. File
         paths matching one of these patterns will have their contents compared
         with their lines sorted.
         '''
         assert isinstance(finder1, BaseFinder)
         assert isinstance(finder2, BaseFinder)
         self._finder1 = finder1
         self._finder2 = finder2
         self._sorted = sorted
@@ -141,17 +141,17 @@ class UnifiedFinder(BaseFinder):
         Given two BaseFiles and the path they were found at, check whether
         their content match and return the first BaseFile if they do.
         '''
         content1 = file1.open().readlines()
         content2 = file2.open().readlines()
         if content1 == content2:
             return file1
         for pattern in self._sorted:
-            if mozpack.path.match(path, pattern):
+            if mozpath.match(path, pattern):
                 if sorted(content1) == sorted(content2):
                     return file1
                 break
         return None
 
 
 class UnifiedBuildFinder(UnifiedFinder):
     '''
@@ -162,17 +162,17 @@ class UnifiedBuildFinder(UnifiedFinder):
     def __init__(self, finder1, finder2, **kargs):
         UnifiedFinder.__init__(self, finder1, finder2,
                                sorted=['**/*.manifest'], **kargs)
 
     def unify_file(self, path, file1, file2):
         '''
         Unify buildconfig.html contents, or defer to UnifiedFinder.unify_file.
         '''
-        if mozpack.path.basename(path) == 'buildconfig.html':
+        if mozpath.basename(path) == 'buildconfig.html':
             content1 = file1.open().readlines()
             content2 = file2.open().readlines()
             # Copy everything from the first file up to the end of its <body>,
             # insert a <hr> between the two files and copy the second file's
             # content beginning after its leading <h1>.
             return GeneratedFile(''.join(
                 content1[:content1.index('</body>\n')] +
                 ['<hr> </hr>\n'] +
--- a/services/common/tests/mach_commands.py
+++ b/services/common/tests/mach_commands.py
@@ -1,16 +1,16 @@
 # 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/.
 
 from __future__ import unicode_literals
 
 import logging
-import mozpack.path
+import mozpack.path as mozpath
 import os
 import sys
 import warnings
 import which
 
 from mozbuild.base import (
     MachCommandBase,
 )
@@ -26,17 +26,16 @@ from mach.registrar import (
 )
 
 from shutil import rmtree
 from subprocess import Popen
 from sys import argv
 from sys import exit
 from tempfile import mkdtemp
 
-import mozpack.path as mozpath
 
 
 DEFAULT_PORT = 8080
 DEFAULT_HOSTNAME = 'localhost'
 
 SRCDIR = mozpath.abspath(mozpath.dirname(__file__))
 
 STORAGE_SERVER_SCRIPT = mozpath.join(SRCDIR, 'run_storage_server.js')
--- a/testing/mochitest/mach_commands.py
+++ b/testing/mochitest/mach_commands.py
@@ -1,17 +1,17 @@
 # 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/.
 
 from __future__ import unicode_literals
 
 import argparse
 import logging
-import mozpack.path
+import mozpack.path as mozpath
 import os
 import sys
 import warnings
 import which
 
 from mozbuild.base import (
     MachCommandBase,
     MachCommandConditions as conditions,
@@ -159,22 +159,22 @@ class MochitestRunner(MozbuildObject):
             import mochitest
             from mochitest_options import B2GOptions
 
         parser = B2GOptions()
         options = parser.parse_args([])[0]
 
         if test_path:
             if chrome:
-                test_root_file = mozpack.path.join(
+                test_root_file = mozpath.join(
                     self.mochitest_dir,
                     'chrome',
                     test_path)
             else:
-                test_root_file = mozpack.path.join(
+                test_root_file = mozpath.join(
                     self.mochitest_dir,
                     'tests',
                     test_path)
             if not os.path.exists(test_root_file):
                 print(
                     'Specified test path does not exist: %s' %
                     test_root_file)
                 return 1
--- a/toolkit/mozapps/installer/packager.py
+++ b/toolkit/mozapps/installer/packager.py
@@ -19,17 +19,17 @@ from mozpack.files import (
     File,
 )
 from mozpack.copier import (
     FileCopier,
     Jarrer,
 )
 from mozpack.errors import errors
 from mozpack.unify import UnifiedBuildFinder
-import mozpack.path
+import mozpack.path as mozpath
 import buildconfig
 from argparse import ArgumentParser
 import os
 from StringIO import StringIO
 import subprocess
 import platform
 import mozinfo
 
@@ -213,17 +213,17 @@ class NoPkgFilesRemover(object):
         else:
             self._error = errors.warn
             self._msg = 'Skipping %s'
 
     def add_base(self, base, *args):
         self._formatter.add_base(base, *args)
 
     def add(self, path, content):
-        if not any(mozpack.path.match(path, spec) for spec in self._files):
+        if not any(mozpath.match(path, spec) for spec in self._files):
             self._formatter.add(path, content)
         else:
             self._error(self._msg % path)
 
     def add_manifest(self, entry):
         self._formatter.add_manifest(entry)
 
     def add_interfaces(self, path, content):
@@ -298,17 +298,17 @@ def main():
     if 'RESPATH' in defines:
         respath = SimpleManifestSink.normalize_path(defines['RESPATH'])
     while respath.startswith('/'):
         respath = respath[1:]
 
     if args.unify:
         def is_native(path):
             path = os.path.abspath(path)
-            return platform.machine() in mozpack.path.split(path)
+            return platform.machine() in mozpath.split(path)
 
         # Invert args.unify and args.source if args.unify points to the
         # native architecture.
         args.source, args.unify = sorted([args.source, args.unify],
                                          key=is_native, reverse=True)
         if is_native(args.source):
             launcher.tooldir = args.source
     elif not buildconfig.substs['CROSS_COMPILE']:
@@ -344,23 +344,23 @@ def main():
         sink.close(args.manifest is not None)
 
         if args.removals:
             lines = [l.lstrip() for l in open(args.removals).readlines()]
             removals_in = StringIO(''.join(lines))
             removals_in.name = args.removals
             removals = RemovedFiles(copier)
             preprocess(removals_in, removals, defines)
-            copier.add(mozpack.path.join(respath, 'removed-files'), removals)
+            copier.add(mozpath.join(respath, 'removed-files'), removals)
 
     # shlibsign libraries
     if launcher.can_launch():
         if not mozinfo.isMac:
             for lib in SIGN_LIBS:
-                libbase = mozpack.path.join(respath, '%s%s') \
+                libbase = mozpath.join(respath, '%s%s') \
                     % (buildconfig.substs['DLL_PREFIX'], lib)
                 libname = '%s%s' % (libbase, buildconfig.substs['DLL_SUFFIX'])
                 if copier.contains(libname):
                     copier.add(libbase + '.chk',
                                LibSignFile(os.path.join(args.destination,
                                                         libname)))
 
     # Setup preloading
@@ -373,23 +373,23 @@ def main():
             key = JarLog.canonicalize(os.path.join(args.destination, p))
             if key in log:
                 f.preload(log[key])
 
     # Fill startup cache
     if isinstance(formatter, OmniJarFormatter) and launcher.can_launch() \
       and buildconfig.substs['MOZ_DISABLE_STARTUPCACHE'] != '1':
         if buildconfig.substs.get('LIBXUL_SDK'):
-            gre_path = mozpack.path.join(buildconfig.substs['LIBXUL_DIST'],
+            gre_path = mozpath.join(buildconfig.substs['LIBXUL_DIST'],
                                          'bin')
         else:
             gre_path = None
         def get_bases():
             for b in sink.packager.get_bases(addons=False):
-                for p in (mozpack.path.join('bin', b), b):
+                for p in (mozpath.join('bin', b), b):
                     if os.path.exists(os.path.join(args.source, p)):
                         yield p
                         break
         for base in sorted(get_bases()):
             if not gre_path:
                 gre_path = base
             base_path = sink.normalize_path(base)
             if base_path in formatter.omnijars:
--- a/tools/mach_commands.py
+++ b/tools/mach_commands.py
@@ -169,27 +169,27 @@ class UUIDProvider(object):
                      help='Base path under which uuids will be searched.')
     @CommandArgument('interfaces', nargs='+',
                      help='Changed interfaces whose UUIDs need to be updated. ' +
                           'Their descendants are updated as well.')
     def update_uuids(self, path, interfaces):
         import os
         import xpidl
         from mozpack.files import FileFinder
-        import mozpack.path
+        import mozpack.path as mozpath
         from tempfile import mkdtemp
 
         finder = FileFinder(path, find_executables=False)
         # Avoid creating xpidllex and xpidlyacc in the current directory.
         tmpdir = mkdtemp()
         try:
             parser = xpidl.IDLParser(outputdir=tmpdir)
             registry = InterfaceRegistry()
             for p, f in finder.find('**/*.idl'):
-                p = mozpack.path.join(path, p)
+                p = mozpath.join(path, p)
                 try:
                     content = f.open().read()
                     idl = parser.parse(content, filename=p)
                 except Exception:
                     continue
                 for prod in idl.productions:
                     if isinstance(prod, xpidl.Interface):
                          registry.add(Interface(p, prod))