[issue35227] [RFE] tarfile: support adding file objects without prior known size

2018-12-02 Thread Martin Panter
Martin Panter added the comment: Yeah, the TarFile class would fix up the header when the user calls “close”. I think this is how it was done for ZipFile (implemented in Issue 26039). Yes currently you would have to build the tarinfo object by hand. I think a helper function would be nice,

[issue35227] [RFE] tarfile: support adding file objects without prior known size

2018-12-02 Thread Rémi Lapeyre
Rémi Lapeyre added the comment: Thanks, this looks interesting. How will the file writer know the whole file has been read? The override of the Tar header is done on `close`? Are `download_tarinfo` and `svgz_tarinfo` built by hand if we don't make changes in `gettarinfo`? --

[issue35227] [RFE] tarfile: support adding file objects without prior known size

2018-12-02 Thread Martin Panter
Martin Panter added the comment: If something like your “addbuffer” method existed, then you won’t need to get the size first, right? We don’t need the changes in “gettarinfo” for “addbuffer” to be useful. BTW have you considered returning a file writer rather than accepting a file reader?

[issue35227] [RFE] tarfile: support adding file objects without prior known size

2018-11-27 Thread Rémi Lapeyre
Rémi Lapeyre added the comment: I came across this thread while working on the PR, creating tarinfo as Lars Gustäbel suggests does not work since you still need to get the size before reading. Do you think the API should be different? -- ___

[issue35227] [RFE] tarfile: support adding file objects without prior known size

2018-11-27 Thread Martin Panter
Martin Panter added the comment: The changes at have various other behaviour changes which are not discussed here. They seem to be there just so that you can use the TCP socket from “urlopen” with “gettarinfo”. But “gettarinfo” is

[issue35227] [RFE] tarfile: support adding file objects without prior known size

2018-11-26 Thread Michał Górny
Michał Górny added the comment: Thanks a lot! I've left a few comments based on eyeball review. I'm going to test it later today. -- ___ Python tracker ___

[issue35227] [RFE] tarfile: support adding file objects without prior known size

2018-11-26 Thread Rémi Lapeyre
Rémi Lapeyre added the comment: Hi @mgorny, the changeset in PR 10714 should do what you are looking for. -- ___ Python tracker ___

[issue35227] [RFE] tarfile: support adding file objects without prior known size

2018-11-26 Thread Rémi Lapeyre
Change by Rémi Lapeyre : -- keywords: +patch pull_requests: +9963 stage: -> patch review ___ Python tracker ___ ___

[issue35227] [RFE] tarfile: support adding file objects without prior known size

2018-11-21 Thread Rémi Lapeyre
Rémi Lapeyre added the comment: Yes, but in the same way that there is the add method to conveniently build the TarInfo object for the user, shouldn't we provide a new convenience method to TarFile to support this (in addition to modifying TarInfo)? --

[issue35227] [RFE] tarfile: support adding file objects without prior known size

2018-11-21 Thread Michał Górny
Michał Górny added the comment: > Adding this API would require to provide a way to set file status like mode, > uid, gid, mtime, type, linkname, uname and gname. That's why I mentioned addfile() -- it takes TarInfo object for that purpose. I suppose the new function should have the same

[issue35227] [RFE] tarfile: support adding file objects without prior known size

2018-11-21 Thread Rémi Lapeyre
Rémi Lapeyre added the comment: Adding this API would require to provide a way to set file status like mode, uid, gid, mtime, type, linkname, uname and gname. Adding a new argument to gettarinfo looks weird to me, adding a new method may be better. I will try to propose a working

[issue35227] [RFE] tarfile: support adding file objects without prior known size

2018-11-21 Thread Rémi Lapeyre
Change by Rémi Lapeyre : -- nosy: +remi.lapeyre ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue35227] [RFE] tarfile: support adding file objects without prior known size

2018-11-13 Thread Michał Górny
New submission from Michał Górny : Currently, the tarfile module only supports adding files if their size is known prior to adding. However, I think it'd be helpful to be able to store large dynamically generated streams straight into the (uncompressed) .tar file without being able to