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:
@@ -10,7 +10,7 @@ from mozpack.files import (
|
||||
BaseFile,
|
||||
Dest,
|
||||
)
|
||||
import mozpack.path
|
||||
import mozpack.path as mozpath
|
||||
import errno
|
||||
from collections import (
|
||||
Counter,
|
||||
@@ -41,7 +41,7 @@ class FileRegistry(object):
|
||||
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
|
||||
@@ -73,13 +73,13 @@ class FileRegistry(object):
|
||||
'''
|
||||
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):
|
||||
'''
|
||||
|
||||
Reference in New Issue
Block a user