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
Split file and directory cleaning patterns. #56
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for tackling this. My main concern is there seems to be a lot of code duplication now.
python/lsst/sconsUtils/builders.py
Outdated
(files_expr, file_action) | ||
filesExpr += "-name %s" % re.sub(r"(^|[^\\])([\[*])", r"\1\\\2", filePattern) | ||
action = "find %s" % directory | ||
action += r" \( -name .svn -prune -o -name .git -prune -o -name \* \) " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a lot of duplication in these two cases. Same pruning, same regex substitution. Can there be a little helper function that you can create here to reduce code duplication?
python/lsst/sconsUtils/builders.py
Outdated
filesExpr += "-name %s" % re.sub(r"(^|[^\\])([\[*])", r"\1\\\2", filePattern) | ||
action = "find %s" % directory | ||
action += r" \( -name .svn -prune -o -name .git -prune -o -name \* \) " | ||
action += r" \( %s \) -exec rm -f {} \;" % filesExpr |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be safer to use -type f
here and -type d
below?
56b7370
to
22a372d
Compare
Better now? Should I add |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great. Adding the python cache directory to the clean seems reasonable.
No description provided.