-
-
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
allow setting uid and gid when creating tar files #51105
Comments
I am proposing this feature for an issue we have in Distutils: being Here's what I am proposing:
|
TarInfo does not need set_uid() or set_gid() methods, both can be set tar = tarfile.open("foo.tar.gz", "w:gz")
for filename in filenames:
tarinfo = tar.gettarinfo(filename)
if tarinfo.isreg():
fobj = open(filename)
else:
fobj = None
tarinfo.uid = 0
tarinfo.gid = 0
tar.addfile(tarinfo, fobj)
tar.close() I am not against adding a new option. Although, it's too bad that I |
I was thinking about the set_ methods to be able to use
Maybe we could add the "filter" option for 2.7/3.2 together with the We could also add an exclude callable in the module, as an example |
I do not quite see the benefit from the set_* methods. Although the The filter argument is actually a nice idea. I have attached a patch |
The only benefit I can see for the set_* method is to hide In Distutils, I'd like to provide a uid and gid option So it seems that working per TarInfo is the wrong approach,
The patch looks nice to me small typo in the doc :
should be "How to create" |
I applied the patch with some more small fixes to the trunk (r74750) and |
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: