-
-
Notifications
You must be signed in to change notification settings - Fork 171
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
Raise exception on trying to compute MD5 sum of directory. #256
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.
So what was happening when passing a directory?
Can we have a separate unit-test?
@@ -36,6 +36,9 @@ def get_file_md5(path): | |||
@param path: (string) file path | |||
@return: (string) md5 | |||
""" | |||
if os.path.isdir(path): |
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.
actually this is probably not a good location for doing this check. check_modified
was carefully implemented to avoid getting file_stat
more than once. since this is a relatively expensive operation.
Before, I'd get this stack trace:
The use case here is that in the font world, the UFO format is a directory with all data for one font contained within in separate files and subdirectories. I originally wanted to pass in the path to the directory in the hope that doit will know when something within the directory changed. So where would that check be better kept? |
on Some use-cases have thousands of file_dep, so performance need to be taken into account. [1] https://docs.python.org/3/library/stat.html#stat.S_ISDIR |
Yep, that's our use-case ;)
You mean in |
@madig so what the status on this? About checking path vs catching exception. I see you get a permission denied exception and the goal was to give a clear error message... need to be careful not to say a folder is not supported when permission is the real problem. I think all code changes should go in |
Didn't have time yet, still on my todo list. |
Closing this as there is no activity for a long time... feel free to reopen if fix the pending issues. |
For clarity.