Skip to content

Commit

Permalink
Metadata 2.1 updates (#232)
Browse files Browse the repository at this point in the history
Updated metadata version to 2.1 and dropped DESCRIPTION.rst from the list of created files.
  • Loading branch information
di authored and agronholm committed Mar 21, 2018
1 parent 27f3273 commit 4fcc31d
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 14 deletions.
2 changes: 2 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ Unreleased
- Fixed displaying of errors on Python 3
- Fixed single digit versions in wheel files not being properly recognized
- Enabled Zip64 support in wheels by default
- Metadata-Version is now 2.1
- Don't create a DESCRIPTION.RST anymore.

0.30.0
======
Expand Down
2 changes: 1 addition & 1 deletion tests/pydist-schema.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "http://www.python.org/dev/peps/pep-0426/",
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Metadata for Python Software Packages 2.0",
"title": "Metadata for Python Software Packages 2.1",
"type": "object",
"properties": {
"metadata_version": {
Expand Down
2 changes: 1 addition & 1 deletion tests/test_pkginfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
def test_pkginfo_mangle_from(tmpdir):
"""Test that write_pkginfo() will not prepend a ">" to a line starting with "From"."""
metadata = """\
Metadata-Version: 2.0
Metadata-Version: 2.1
Name: foo
From blahblah
Expand Down
10 changes: 2 additions & 8 deletions wheel/bdist_wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -426,14 +426,8 @@ def adios(p):
distribution=self.distribution)

if 'description' in pymeta:
description_filename = 'DESCRIPTION.rst'
description_text = pymeta.pop('description')
description_path = os.path.join(distinfo_path,
description_filename)
with open(description_path, "wb") as description_file:
description_file.write(description_text.encode('utf-8'))
pymeta['extensions']['python.details']['document_names']['description'] = \
description_filename
# Don't include `description` in JSON metadata
pymeta.pop('description')

# XXX heuristically copy any LICENSE/LICENSE.txt?
license = self.license_file()
Expand Down
7 changes: 3 additions & 4 deletions wheel/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from .pkginfo import read_pkg_info
from .util import OrderedDefaultDict

METADATA_VERSION = "2.0"
METADATA_VERSION = "2.1"

PLURAL_FIELDS = {"classifier": "classifiers",
"provides_dist": "provides",
Expand Down Expand Up @@ -265,11 +265,10 @@ def generate_requirements(extras_require):

def pkginfo_to_metadata(egg_info_path, pkginfo_path):
"""
Convert .egg-info directory with PKG-INFO to the Metadata 1.3 aka
old-draft Metadata 2.0 format.
Convert .egg-info directory with PKG-INFO to the Metadata 2.1 format
"""
pkg_info = read_pkg_info(pkginfo_path)
pkg_info.replace_header('Metadata-Version', '2.0')
pkg_info.replace_header('Metadata-Version', '2.1')
requires_path = os.path.join(egg_info_path, 'requires.txt')
if os.path.exists(requires_path):
with open(requires_path) as requires_file:
Expand Down

0 comments on commit 4fcc31d

Please sign in to comment.