Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f104762

Browse files
committed
Merge pull request #2 from kpurdon/master
get rid of pathlib changes and pyc
2 parents 84c242c + 813412f commit f104762

File tree

3 files changed

+9
-14
lines changed

3 files changed

+9
-14
lines changed

python/pymr/__init__.pyc

-132 Bytes
Binary file not shown.

python/pymr/pymr.py

+9-14
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import fnmatch
44
from subprocess import call
55

6-
import pathlib
76
import click
87

98

@@ -42,19 +41,15 @@ def run(command, basepath, tag, dryrun):
4241
run a given command in matching sub-directories
4342
'''
4443

45-
for fn in pathlib.Path(basepath).glob('**/.pymr'):
46-
47-
with fn.open(mode='rb') as f:
48-
cur_tags = pickle.load(f)
49-
50-
parent_dir = str(fn.parent)
51-
52-
if tag in cur_tags:
53-
if dryrun:
54-
print('Would run {0} in {1}'.format(command, parent_dir))
55-
else:
56-
os.chdir(parent_dir)
57-
call(command, shell=True)
44+
for root, _, fns in os.walk(basepath):
45+
for fn in fnmatch.filter(fns, '.pymr'):
46+
cur_tags = pickle.load(open(os.path.join(root, fn)))
47+
if tag in cur_tags:
48+
if dryrun:
49+
print('Would run {0} in {1}'.format(command, root))
50+
else:
51+
os.chdir(root)
52+
call(command, shell=True)
5853

5954

6055
if __name__ == '__main__':

python/pymr/pymr.pyc

-1.91 KB
Binary file not shown.

0 commit comments

Comments
 (0)