Author lars.gustaebel
Recipients lars.gustaebel, markgrandi, pitrou, r.david.murray
Date 2014-08-20.07:37:22
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1408520242.57.0.698042295293.issue22208@psf.upfronthosting.co.za>
In-reply-to
Content
I don't have an idea how to make it easier and still meet all/most requirements and without cluttering up the api. The way it currently works allows the programmer to control every tiny aspect of a tar member. Maybe it's best to simply add a new entry to the Examples section of the tarfile documentation.


import tarfile, io

with tarfile.open("sample.tar", mode="w") as tar:
    t = tarfile.TarInfo("foo")
    t.type = tarfile.DIRTYPE
    tar.addfile(t)

    b = "Hello world!".encode("ascii")

    t = tarfile.TarInfo("foo/bar")
    t.size = len(b)
    tar.addfile(t, io.BytesIO(b))
History
Date User Action Args
2014-08-20 07:37:22lars.gustaebelsetrecipients: + lars.gustaebel, pitrou, r.david.murray, markgrandi
2014-08-20 07:37:22lars.gustaebelsetmessageid: <1408520242.57.0.698042295293.issue22208@psf.upfronthosting.co.za>
2014-08-20 07:37:22lars.gustaebellinkissue22208 messages
2014-08-20 07:37:22lars.gustaebelcreate