Bug 1147283 - Replace mozpack.path with mozpath. r=mshal
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")
This commit is contained in:
@@ -7,7 +7,7 @@ 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
|
||||
|
||||
@@ -71,7 +71,7 @@ class MachCommands(MachCommandBase):
|
||||
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
|
||||
@@ -79,8 +79,8 @@ class MachCommands(MachCommandBase):
|
||||
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',
|
||||
|
||||
Reference in New Issue
Block a user