- minor cleanup in Metadata
- trigger creation of the sysconfig._CONFIG_VARS dict
- home_page is used over home-page: it’s not a compound word, it’s an
escaped space
Distutils2 is now synchronized with Packaging.
PEP 370 features and sys.dont_write_bytecode are always available
in 3.3; the distutils2 backport still has the conditionals.
I also renamed an internal misnamed method and fixed a few things
(“packaging2” name, stray print, unused import, fd leak).
This method was supposed to return only the file under the dist-info
directory, but it actually returned all installed files.
The tests didn’t catch this because they were flawed; I updated them.
Thanks to Nadeem Vawda and Jeremy Kloth for testing.
As a bonus, the removal of os.path.relpath use should also fix the
Windows buildbots.
The command without arguments already prints all installed distributions
found.
In addition, change “releases” for “projects” in the description of the
list action. Strictly speaking, one installed distribution satisfies
the requirement for a release (i.e. version) of a project, but as
currently only one release per project can be installed at a time, the
two are somewhat equivalent, and “project” is more understandable in
help texts (which call their argument “dist”, by the way..)
This is copied from the namesake distutils command; there is no
automated test, so buildbots won’t call for my head this time, but it
should be okay as Python 3 users have tested the distutils command.
In dry-run mode, packaging commands should log the same info as in real
operation and should collect the same files in self.outputs, so that
users can run a command in verbose and dry-run mode to see exactly what
operations will be done in the real run.
New tests were added in test_metadata and old tests inherited from
distutils were still in test_dist, so I moved them into test_metadata
(except for one which was more at home in test_run) and merged
duplicates.
I also added some skips to lure contributors <wink>, optimized the
Metadata.update method a trifle, and added notes about a number of
issues.
A note: The tests in test_dist used to dump the Metadata objects to a
file in the METADATA format and look for strings in its contents; I
updated them to use the mapping API of Metadata instead. For some
fields with special writing rules, I have added tests to ensure my
conversion did not lose anything.
The right-hand part in [extension: foo] is now used as the name of the
extension module. (I changed the separator from = to : and allowed
whitespace to make the sections look nicer.)
This huge module is the heir of six distutils modules, and contains
a number of miscellaneous functions. I have attempted to help readers
of the source code with an annoted __all__. Removed or deprecated
functions have been removed from the documentation; I’m working on
another patch to document the remaining public functions.
For the curious:
The unzip_file and untar_file were used by (or intended to be used by)
“pysetup install path/to/archive.tar.gz”, but the code presently used
shutil.unpack_archive and an helper function, so I just deleted them.
They’re still in the repository if we need them in the future.
The find_packages function is not used anymore but I want to discuss
module and package auto-discovery (in “pysetup create”) again before
removing it.
subst_vars now lives in sysconfig; rfc822_escape is inlined in
packaging.metadata. Other functions are for internal use only, or
deprecated; I have left them out of __all__ and sprinkled TODO notes
for future cleanups.
There was already a test for this, but it was complicated and had a
subtle bug (custom command objects need to be put in dist.command_obj so
that other command objects may see them) that rendered it moot.
Packaging uses the shutil.make_archive function copied from distutils,
which does not support compress. There is no test to check that
“bdist --format whatever” works, so this slipped by.
These options were used to implement “setup.py --name”,
“setup.py --version”, etc. which are now handled by the pysetup metadata
action or direct parsing of the setup.cfg file.
As a side effect, the Distribution class no longer accepts a 'url' key
in its *attrs* argument: it has to be 'home-page' to be recognized as a
valid metadata field and passed down to the dist.metadata object.
I cleaned up some comments, docstrings and code along the way.
When called without option (“-f field” or “--all”), “pysetup metadata”
didn’t do anything useful. Now it prints out all metadata fields. The
“--all” option is removed.
* Use str.startswith(tuple): I didn't know this Python feature, Python rocks!
* Replace sometimes sys.platform.startswith('linux') with
sys.platform == 'linux'
* sys.platform doesn't contain the major version on Cygwin on Mac OS X
(it's just 'cygwin' and 'darwin')
The existing test_record is not easily extendable to add script files or
extension modules: it collects all files from fake_dists and generates a
RECORD file at runtime. I felt more comfortable adding a new test
written from scratch more self-contained (just one project with
well-defined files) and more stupid (the checksums and sizes are
computed once and hard-coded).
- Rename an attribute and create it in initialize_options instead of
finalize_options to match the other install_* classes
- Remove unnecessary method call in tests