mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Add more directories into './mach grep' command.
This commit is contained in:
parent
27943c0ea5
commit
bed9fc101b
1 changed files with 12 additions and 3 deletions
|
@ -1,5 +1,5 @@
|
||||||
from __future__ import print_function, unicode_literals
|
from __future__ import print_function, unicode_literals
|
||||||
from os import path, getcwd
|
from os import path, getcwd, listdir
|
||||||
|
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
|
@ -86,6 +86,15 @@ class MachCommands(CommandBase):
|
||||||
def grep(self, params):
|
def grep(self, params):
|
||||||
if not params:
|
if not params:
|
||||||
params = []
|
params = []
|
||||||
grep_paths = [path.join(self.context.topdir, 'components'),
|
# get all directories under tests/
|
||||||
path.join(self.context.topdir, 'ports')]
|
tests_dirs = listdir('tests')
|
||||||
|
# Remove 'wpt' from obtained dir list
|
||||||
|
tests_dirs = filter(lambda dir: dir != 'wpt', tests_dirs)
|
||||||
|
# Set of directories in project root
|
||||||
|
root_dirs = ['components', 'ports', 'python', 'etc', 'resources']
|
||||||
|
# Generate absolute paths for directories in tests/ and project-root/
|
||||||
|
tests_dirs_abs = [path.join(self.context.topdir, 'tests', s) for s in tests_dirs]
|
||||||
|
root_dirs_abs = [path.join(self.context.topdir, s) for s in root_dirs]
|
||||||
|
# Absolute paths for all directories to be considered
|
||||||
|
grep_paths = root_dirs_abs + tests_dirs_abs
|
||||||
return subprocess.call(["git"] + ["grep"] + params + ['--'] + grep_paths, env=self.build_env())
|
return subprocess.call(["git"] + ["grep"] + params + ['--'] + grep_paths, env=self.build_env())
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue