Releases: MrMino/wheelfile
v0.0.9
0.0.9 - 2024-07-19
Changed
- Dropped support of Python versions lower than Python 3.9.
- The
WheelFile.writestr_*
methods will now preserve asZipInfo
attributes,
if aZipInfo
object has been passed instead of the filename. WheelFile.from_wheelfile
constructor will now preserveZipInfo
attributes of the files from distinfo and data directories of the original
archive. This includes file permissions.- Unconstrained
packaging
requirement. At the time of writing this, all
versions up topackaging==24.1
pass the tests on Linux.
Fixed
- Lazy mode will no longer confuse corrupted wheeldata with metadata - if
WHEEL
file is corrupted or wrong, the.wheeldata
will be set toNone
,
as opposed to.metadata
as was the case previously. Thanks to
mboisson for spotting this and the fix. - Writing a
.dist-info/RECORD
file in a subdirectory of the archive will no
longer trigger anAssertionError
. This should help with vendoring packages
inside wheels. Thanks to mboisson for
providing a fix.
v0.0.8
0.0.8 - 2021-08-03
Changed
-
Since
WheelFile
write methods now haveskipdir=True
default (see below),
writing recursively from a directory will no longer produce entries for
directories. This also means, that attempting to write an empty directory (or
any directory, even withrecursive=False
) is no longer possible, unless
skipdir=False
is specified.This does not apply to
writestr_*
methods - attempting to write to an
arcname
ending in/
will produce an entry that is visible as a
directory. -
WheelFile.validate
will now fail and raiseValueError
ifWHEEL
build
tag field (.wheeldata.build
) contains a value that is different from the
wheel name (.build_tag
).
Added
WheelFile.from_wheelfile
- a constructor class-method that makes it
possible to recreate a wheel and: rename it (change distname, version,
buildnumber and/or tags), append files to it, change its metadata, etc.WheelFile.METADATA_FILENAMES
- a static field with a set of names of
metadata files managed by this class.WheelFile.writestr_distinfo
- similar towrite_distinfo
, this is a safe
shortcut for writing into.dist-info
directory.WheelFile.__init__
now takes configuration arguments known fromZipFile
:
compression
,compression
,allowZip64
, andstrict_timestamps
. They
work the same way, except that they are keyword only inWheelFile
, and the
default value forcompression
iszipfile.ZIP_DEFLATED
.WheelFile
write methods now take optionalcompress_type
and
compresslevel
arguments known fromZipFile
.- New
skipdir
argument inWheelFile
write methods:write
,write_data
,
andwrite_distinfo
. WhenTrue
(which is the default), these methods will
not write ZIP entries for directories into the archive.
Fixed
- Docstring of the
WheelFile.filename
property, which was innacurate. MetaData.from_str
will now correctly unpackKeywords
field into a list of
strings, instead of a one-element list with a string containing
comma-separated tags.
v0.0.7
0.0.7 - 2021-07-19
Changed
-
Default compression method is now set to
zipfile.ZIP_DEFLATED
. -
Wheels with directory entries in their
RECORD
files will now make
WheelFile
raiseRecordContainsDirectoryError
. -
Lazy mode is now allowed, in a very limited version - most methods will still
raise exceptions, even when the documentation states that lazy mode
suppresses them.Use it by specifying
l
in themode
argument, e.g.
WheelFile("path/to/wheel", mode='rl')
. This may be used to read wheels
generated with previous version of wheelfile, which generated directory
entries inRECORD
, making them incompatible with this release. -
In anticipation of an actual implementation,
WheelFile.open()
raises
NotImplementedError
now, as it should. Previously only adef ...: pass
stub was present.
Added
- Implemented
WheelFile.namelist()
, which, similarily toZipFile.namelist()
,
returns a list of archive members, but omits the metadata files which should
not be written manually:RECORD
,WHEEL
andMETADATA
. - Added
WheelFile.infolist()
. Similarily to thenamelist()
above - it
returns aZipInfo
for each member, but omits the ones corresponding to
metadata files. RecordContainsDirectoryError
exception class.distinfo_dirname
anddata_dirname
properties, for easier browsing.
Fixed
- Wheel contents written using
write(..., recursive=True)
no longer contain
entries corresponding to directories in theirRECORD
. - Removed a bunch of cosmetic mistakes from exception messages.
v0.0.6
0.0.6 - 2021-07-01
This release introduces backwards-incompatible changes in WheelFile.write
.
Overall, it makes the method safer and easier to use. One will no longer create
a wheel-bomb by calling write('./')
.
If you were passing relative paths as filename
without setting arcname
, you
probably want to set resolve=False
for retaining compatibility with this
release. See the "Changed" section.
Added
WheelFile.write
andWheelFile.write_data
now have a new, keyword-only
resolve
argument, that substitutes the defaultarcname
with the name of
the file the path infilename
points to. This is set toTrue
by default
now.- New
WheelFile.write_distinfo
method, as a safe shorthand for writing to
.dist-info/
. - New
resolved
utility function. - New
ProhibitedWriteError
exception class.
Changed
WheelMeta
no longer prohibits reading metadata in versions other than v2.1.
It uses2.1
afterwards, and its still not changeable though.- Since
WheelFile.write
andWheelFile.write_data
methods haveresolve
argument set toTrue
by default now, paths are no longer being put verbatim
into the archive, only the filenames they point to. Setresolve
toFalse
to get the old behavior, the one exhibited byZipFile.write
. - Parts of
WheelFile.__init__
have been refactored for parity between "named"
and "unnamed" modes, i.e. it no longer raises different exceptions based on
whether it is given a file, path to a directory, path to a file, or an io
buffer. - Wheels generated by
WheelFile
are now reproducible. The modification times
written into the resulting archives using.write(...)
no longer differ
between builds consisting of the same, unchanged files - they are taken from
the files itself.
Fixed
WheelFile
no longer accepts arguments of types other thanVersion
and
str
in itsversion
argument, when an io buffer is given.TypeError
is
raised instead.MetaData
started accepting keywords given via single string (comma
separated). Previously this support was documented, but missing.- The
wheelfile
package itself should now have the keywords set properly ;).
v0.0.5
v0.0.4
0.0.4 - 2021-05-05
Added
WheelFile.write
andWheelFile.write_data
now accept arecursive
keyword-only argument, which makes both of them recursively add the whole
directory subtree, if thefilename
argument was pointing at one.
Changed
WheelFile.write
andWheelFile.write_data
are recursive by default.- Backported support to python 3.6 (thanks,
e2thenegpii!)
v0.0.3
0.0.3 - 2021-03-28
Big thanks to e2thenegpii for their contributions - both of the fixes below came from them.
Changed
- Fixed an issue breaking causing long METADATA lines to be broken into
multiple shorter lines - Fixed the production of RECORD files to encode file hashes with base64
per PEP 376
v0.0.2
0.0.2 - 2021-01-24
Added
- Read mode (
'r'
) now works. - Added
write_data
andwritestr_data
methods toWheelFile
class. Use
these methods to write files to.data/
directory of the wheel. - Added
build_tag
andlanguage_tag
,abi_tag
, andplatform_tag
parameters toWheelFile.__init__
, with their respective properties. - Tag attributes mentioned above can also be inferred from the filename of the
specified file. - Accessing the mode with which the wheelfile was opened is now possible using
mode
attribute.
Changed
- Default tag set of
WheelData
class is now['py3-none-any']
. Previously,
universal tag ("py2.py3-none-any"
) was used. - Fixed issues with comparing
MetaData
objects that have empty descriptions.
After parsing a metadata text with empty payload, the returned object has an
empty string inside description, instead ofNone
, which is used by
MetaData.__init__
to denote that no description was provided. This means
that these two values are the effectively the same thing in this context.
MetaData.__eq__
now refelcts that.
v0.0.1
First version. Writing wheels from scratch is supported.