зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset b01876f4f16e (bug 1498215) for bustages on test_pathutils.py. CLOSED TREE
This commit is contained in:
Родитель
291f6c1361
Коммит
e8f62dbf84
|
@ -31,6 +31,7 @@ mozilla.pth:third_party/python/pystache
|
|||
mozilla.pth:third_party/python/pyyaml/lib
|
||||
mozilla.pth:third_party/python/requests
|
||||
mozilla.pth:third_party/python/requests-unixsocket
|
||||
mozilla.pth:third_party/python/scandir
|
||||
mozilla.pth:third_party/python/slugid
|
||||
mozilla.pth:third_party/python/py
|
||||
mozilla.pth:third_party/python/pytest/src
|
||||
|
|
|
@ -9,13 +9,10 @@ import os
|
|||
from mozpack import path as mozpath
|
||||
from mozpack.files import FileFinder
|
||||
|
||||
|
||||
def get_scandir_functions():
|
||||
try:
|
||||
from os import scandir, walk
|
||||
except ImportError:
|
||||
from scandir import scandir, walk
|
||||
return scandir, walk
|
||||
try:
|
||||
from os import scandir, walk
|
||||
except ImportError:
|
||||
from scandir import scandir, walk
|
||||
|
||||
|
||||
class FilterPath(object):
|
||||
|
@ -90,9 +87,6 @@ def collapse(paths, base=None, dotfiles=False):
|
|||
:returns: The smallest set of paths (files and directories) that contain
|
||||
the original set of paths and only the original set.
|
||||
"""
|
||||
# Import scandir locally because this file can be imported before we
|
||||
# have created a correctly configured environment
|
||||
scandir, walk = get_scandir_functions()
|
||||
if not paths:
|
||||
if not base:
|
||||
return []
|
||||
|
|
|
@ -18,6 +18,12 @@ from mach.decorators import (
|
|||
Command,
|
||||
)
|
||||
|
||||
try:
|
||||
from os import scandir
|
||||
except ImportError:
|
||||
from scandir import scandir
|
||||
|
||||
|
||||
here = os.path.abspath(os.path.dirname(__file__))
|
||||
GLOBAL_EXCLUDES = [
|
||||
'tools/lint/test/files',
|
||||
|
@ -30,11 +36,6 @@ def setup_argument_parser():
|
|||
|
||||
|
||||
def get_global_excludes(topsrcdir):
|
||||
try:
|
||||
from os import scandir
|
||||
except ImportError:
|
||||
from scandir import scandir
|
||||
|
||||
excludes = GLOBAL_EXCLUDES[:]
|
||||
excludes.extend([e.name for e in scandir(topsrcdir)
|
||||
if e.name.startswith('obj') and e.is_dir()])
|
||||
|
@ -51,21 +52,6 @@ class MachCommands(MachCommandBase):
|
|||
def lint(self, *runargs, **lintargs):
|
||||
"""Run linters."""
|
||||
self._activate_virtualenv()
|
||||
try:
|
||||
from os import scandir # noqa
|
||||
except ImportError:
|
||||
# Install scandir from the source tree into the virtualenv
|
||||
# This is different to the way that most packages are installed,
|
||||
# to ensure that we get the C helper built where possible; the normal
|
||||
# approach of a pointer into the source directory doesn't work for this
|
||||
# case.
|
||||
self.virtualenv_manager.install_pip_package(
|
||||
os.path.join(here,
|
||||
os.path.pardir,
|
||||
os.path.pardir,
|
||||
'third_party',
|
||||
'python',
|
||||
'scandir'), vendored=True)
|
||||
from mozlint import cli
|
||||
|
||||
lintargs.setdefault('root', self.topsrcdir)
|
||||
|
|
Загрузка…
Ссылка в новой задаче