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

Skip to content

get rid of pathlib changes and pyc #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 21, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed python/pymr/__init__.pyc
Binary file not shown.
23 changes: 9 additions & 14 deletions python/pymr/pymr.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import fnmatch
from subprocess import call

import pathlib
import click


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

for fn in pathlib.Path(basepath).glob('**/.pymr'):

with fn.open(mode='rb') as f:
cur_tags = pickle.load(f)

parent_dir = str(fn.parent)

if tag in cur_tags:
if dryrun:
print('Would run {0} in {1}'.format(command, parent_dir))
else:
os.chdir(parent_dir)
call(command, shell=True)
for root, _, fns in os.walk(basepath):
for fn in fnmatch.filter(fns, '.pymr'):
cur_tags = pickle.load(open(os.path.join(root, fn)))
if tag in cur_tags:
if dryrun:
print('Would run {0} in {1}'.format(command, root))
else:
os.chdir(root)
call(command, shell=True)


if __name__ == '__main__':
Expand Down
Binary file removed python/pymr/pymr.pyc
Binary file not shown.