-
-
Notifications
You must be signed in to change notification settings - Fork 30.9k
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
make zipfile.PyZipFile more usable #63473
Comments
zipfile.PyZipFile needs a filter function. Reason: Use case: With this little addition, it becomes very easy to create a zip file |
Here is my use case as an example. This was no longer possible at all, after revision 17558, """This is a test""" def f(x):
def g(y):
return x + y
return g print f(2)(4) |
Looks fine but -- as a new feature -- is 3.4 only, and needs docs and tests. |
Hi Georg, And a general question: About feature or fix: Well, I need this for python2.7, because without Anyway, tell me and I'l add test, docs and put it into dev. cheers - chris |
I don't think this is needed. You can walk a tree and call writepy() for files and directories which you want. |
@serhiy.storchaka
What exactly do mean by "this" and "needed"? Running PyZipFile on a package dir of the standard lib _does_ traverse |
"this" is a filter function. "Not needed" means that you can got what you want without adding a filter function to zipfile.PyZipFile. Just don't call writepy() on directories which contains files which shouldn't be zipped. |
Ah, I understand: The case that does not compile comes from the toplevel "test" folder, But it is not a complete solution:
contains
Your hint to just not call writepy() on directories which contain files |
New changeset 34fb83421119 by Christian Tismer in branch 'default': |
Hi Chris, your commit is a bit hard to review due to all the unrelated spacing changes. I assume this is done automatically by your editor? It's probably best to switch off that feature for CPython development :) |
While reviewing: is it intended that the filter is only called for directories and not for individual files? |
New changeset 2d39b3555951 by Georg Brandl in branch 'default': |
ah, I just see that. |
Not really. I will add this, later. Just wanted to see if this makes |
added that with tests. |
For future reference, the update Christian refers to in the previous message is 4f1121ae1cb5. |
New changeset 064ee489982e by R David Murray in branch 'default': |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: