summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Holth <dholth@fastmail.fm>2014-04-22 12:43:12 -0400
committerDaniel Holth <dholth@fastmail.fm>2014-04-22 12:43:12 -0400
commitc869b11d5df2356e4a91192f3c6a6152c229bde9 (patch)
tree06126888c6873fa25564640757eaef5a955e9381
parent35dbd30e62779dab7ac660a37f8bf12c7a3c3bf9 (diff)
parented34f5557ff732b322e37ad6862599fc44a0fbf5 (diff)
downloadwheel-c869b11d5df2356e4a91192f3c6a6152c229bde9.tar.gz
merge
-rw-r--r--docs/index.rst24
-rw-r--r--setup.cfg9
-rw-r--r--setup.py21
-rw-r--r--wheel/__init__.py2
-rw-r--r--wheel/bdist_wheel.py6
-rw-r--r--wheel/metadata.py36
-rw-r--r--wheel/test/pydist-schema.json195
7 files changed, 164 insertions, 129 deletions
diff --git a/docs/index.rst b/docs/index.rst
index fde43da..5b1b157 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -140,6 +140,30 @@ or::
[bdist_wheel]
python-tag = py32
+Defining conditional dependencies
+---------------------------------
+
+In wheel, the only way to have conditional dependencies (that might only be
+needed on certain platforms) is to use environment markers as defined by
+PEP 426.
+
+As of wheel 0.24.0, the recommended way to do this is in the setuptools
+`extras_require` parameter. A `:` separates the extra name from the marker.
+Wheel's own setup.py has an example::
+ extras_require={
+ ':python_version=="2.6"': ['argparse'],
+ 'signatures': ['keyring'],
+ 'signatures:sys_platform!="win32"': ['pyxdg'],
+ 'faster-signatures': ['ed25519ll'],
+ 'tool': []
+ },
+
+The extra named '' signifies a default requirement, as if it was passed to
+`install_requires`.
+
+Older versions of bdist_wheel supported passing requirements in a
+now-deprecated [metadata] section in setup.cfg.
+
Automatically sign wheel files
------------------------------
diff --git a/setup.cfg b/setup.cfg
index 9a562c0..99207b9 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -2,15 +2,6 @@
addopts=--ignore=dist --ignore=build --cov=wheel
[metadata]
-provides-extra =
- tool
- signatures
- faster-signatures
-requires-dist =
- argparse; python_version == '2.6'
- keyring; extra == 'signatures'
- pyxdg; sys.platform != 'win32' and extra == 'signatures'
- ed25519ll; extra == 'faster-signatures'
license-file = LICENSE.txt
[bdist_wheel]
diff --git a/setup.py b/setup.py
index 643840c..a055a0b 100644
--- a/setup.py
+++ b/setup.py
@@ -1,4 +1,4 @@
-import os.path, sys, codecs, re
+import os.path, codecs, re
from setuptools import setup
@@ -10,17 +10,6 @@ with codecs.open(os.path.join(os.path.dirname(__file__), 'wheel', '__init__.py')
encoding='utf8') as version_file:
metadata = dict(re.findall(r"""__([a-z]+)__ = "([^"]+)""", version_file.read()))
-#
-# All these requirements are overridden by setup.cfg when wheel is built
-# as a wheel:
-#
-signature_reqs = ['keyring']
-if sys.platform != 'win32':
- signature_reqs.append('pyxdg')
-install_requires = []
-if sys.version_info[:2] < (2, 7):
- install_requires.append('argparse')
-
setup(name='wheel',
version=metadata['version'],
description='A built-package format for Python.',
@@ -35,10 +24,11 @@ setup(name='wheel',
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.2",
"Programming Language :: Python :: 3.3",
+ "Programming Language :: Python :: 3.4",
],
author='Daniel Holth',
author_email='dholth@fastmail.fm',
- url='http://bitbucket.org/dholth/wheel/',
+ url='http://bitbucket.org/pypa/wheel/',
keywords=['wheel', 'packaging'],
license='MIT',
packages=[
@@ -47,9 +37,10 @@ setup(name='wheel',
'wheel.tool',
'wheel.signatures'
],
- install_requires=install_requires,
extras_require={
- 'signatures': signature_reqs,
+ ':python_version=="2.6"': ['argparse'],
+ 'signatures': ['keyring'],
+ 'signatures:sys_platform!="win32"': ['pyxdg'],
'faster-signatures': ['ed25519ll'],
'tool': []
},
diff --git a/wheel/__init__.py b/wheel/__init__.py
index df7d28d..11c7a39 100644
--- a/wheel/__init__.py
+++ b/wheel/__init__.py
@@ -1,2 +1,2 @@
# __variables__ with double-quoted values will be available in setup.py:
-__version__ = "0.23.0"
+__version__ = "0.24.0"
diff --git a/wheel/bdist_wheel.py b/wheel/bdist_wheel.py
index 37ebfae..df3575c 100644
--- a/wheel/bdist_wheel.py
+++ b/wheel/bdist_wheel.py
@@ -399,16 +399,14 @@ class bdist_wheel(Command):
description_filename)
with open(description_path, "wb") as description_file:
description_file.write(description_text.encode('utf-8'))
- pymeta['document_names'] = pymeta.get('document_names', {})
- pymeta['document_names']['description'] = description_filename
+ pymeta['extensions']['python.details']['document_names']['description'] = description_filename
# XXX heuristically copy any LICENSE/LICENSE.txt?
license = self.license_file()
if license:
license_filename = 'LICENSE.txt'
shutil.copy(license, os.path.join(self.distinfo_dir, license_filename))
- pymeta['document_names'] = pymeta.get('document_names', {})
- pymeta['document_names']['license'] = license_filename
+ pymeta['extensions']['python.details']['document_names']['license'] = license_filename
with open(metadata_json_path, "w") as metadata_json:
json.dump(pymeta, metadata_json)
diff --git a/wheel/metadata.py b/wheel/metadata.py
index 423d9b4..b2318d4 100644
--- a/wheel/metadata.py
+++ b/wheel/metadata.py
@@ -49,7 +49,7 @@ def unique(iterable):
def handle_requires(metadata, pkg_info, key):
"""
- Place the runtime requirements from pkg_info into metadata.
+ Place the runtime requirements from pkg_info into metadata.
"""
may_requires = defaultdict(list)
for value in pkg_info.get_all(key):
@@ -85,15 +85,16 @@ def handle_requires(metadata, pkg_info, key):
def pkginfo_to_dict(path, distribution=None):
"""
Convert PKG-INFO to a prototype Metadata 2.0 (PEP 426) dict.
-
- The description is included under the key ['description'] rather than
+
+ The description is included under the key ['description'] rather than
being written to a separate file.
-
+
path: path to PKG-INFO file
distribution: optional distutils Distribution()
"""
- metadata = {"generator":"bdist_wheel (" + wheel.__version__ + ")"}
+ metadata = defaultdict(lambda: defaultdict(lambda: defaultdict(dict)))
+ metadata["generator"] = "bdist_wheel (" + wheel.__version__ + ")"
try:
unicode
pkg_info = read_pkg_info(path)
@@ -141,7 +142,10 @@ def pkginfo_to_dict(path, distribution=None):
metadata['extras'].extend(pkg_info.get_all(key))
elif low_key == 'home_page':
- metadata['project_urls'] = {'Home':pkg_info[key]}
+ metadata['extensions']['python.details']['project_urls'] = {'Home':pkg_info[key]}
+
+ elif low_key == 'keywords':
+ metadata['keywords'] = KEYWORDS_RE.split(pkg_info[key])
else:
metadata[low_key] = pkg_info[key]
@@ -173,7 +177,7 @@ def pkginfo_to_dict(path, distribution=None):
contact['role'] = role
contacts.append(contact)
if contacts:
- metadata['contacts'] = contacts
+ metadata['extensions']['python.details']['contacts'] = contacts
# convert entry points to exports
try:
@@ -186,17 +190,17 @@ def pkginfo_to_dict(path, distribution=None):
name, export = str(item).split(' = ', 1)
exports[group][name] = export
if exports:
- metadata['exports'] = exports
+ metadata['extensions']['python.exports'] = exports
except IOError:
pass
# copy console_scripts entry points to commands
- if 'exports' in metadata:
+ if 'python.exports' in metadata['extensions']:
for (ep_script, wrap_script) in (('console_scripts', 'wrap_console'),
('gui_scripts', 'wrap_gui')):
- if ep_script in metadata['exports']:
- metadata['commands'] = metadata.get('commands', {})
- metadata['commands'][wrap_script] = metadata['exports'][ep_script]
+ if ep_script in metadata['extensions']['python.exports']:
+ metadata['extensions']['python.commands'][wrap_script] = \
+ metadata['extensions']['python.exports'][ep_script]
return metadata
@@ -231,9 +235,15 @@ def pkginfo_to_metadata(egg_info_path, pkginfo_path):
requires = open(requires_path).read()
for extra, reqs in pkg_resources.split_sections(requires):
condition = ''
+ if extra and ':' in extra: # setuptools extra:condition syntax
+ extra, condition = extra.split(':', 1)
if extra:
pkg_info['Provides-Extra'] = extra
- condition = '; extra == %s' % repr(extra)
+ if condition:
+ condition += " and "
+ condition += 'extra == %s' % repr(extra)
+ if condition:
+ condition = '; ' + condition
for new_req in convert_requirements(reqs):
pkg_info['Requires-Dist'] = new_req + condition
diff --git a/wheel/test/pydist-schema.json b/wheel/test/pydist-schema.json
index fc350bf..566f3a4 100644
--- a/wheel/test/pydist-schema.json
+++ b/wheel/test/pydist-schema.json
@@ -38,63 +38,6 @@
"description": "A one-line summary of what the distribution does.",
"type": "string"
},
- "document_names": {
- "description": "Names of supporting metadata documents",
- "type": "object",
- "properties": {
- "description": {
- "type": "string",
- "$ref": "#/definitions/document_name"
- },
- "changelog": {
- "type": "string",
- "$ref": "#/definitions/document_name"
- },
- "license": {
- "type": "string",
- "$ref": "#/definitions/document_name"
- }
- },
- "additionalProperties": false
- },
- "keywords": {
- "description": "A list of additional keywords to be used to assist searching for the distribution in a larger catalog.",
- "type": "array",
- "items": {
- "type": "string"
- }
- },
- "license": {
- "description": "A string indicating the license covering the distribution.",
- "type": "string"
- },
- "classifiers": {
- "description": "A list of strings, with each giving a single classification value for the distribution.",
- "type": "array",
- "items": {
- "type": "string"
- }
- },
- "contacts": {
- "description": "A list of contributor entries giving the recommended contact points for getting more information about the project.",
- "type": "array",
- "items": {
- "type": "object",
- "$ref": "#/definitions/contact"
- }
- },
- "contributors": {
- "description": "A list of contributor entries for other contributors not already listed as current project points of contact.",
- "type": "array",
- "items": {
- "type": "object",
- "$ref": "#/definitions/contact"
- }
- },
- "project_urls": {
- "description": "A mapping of arbitrary text labels to additional URLs relevant to the project.",
- "type": "object"
- },
"extras": {
"description": "A list of optional sets of dependencies that may be used to define conditional dependencies in \"may_require\" and similar fields.",
"type": "array",
@@ -152,16 +95,6 @@
"$ref": "#/definitions/qualified_name"
}
},
- "commands": {
- "description": "Command line interfaces provided by this distribution",
- "type": "object",
- "$ref": "#/definitions/commands"
- },
- "exports": {
- "description": "Other exported interfaces provided by this distribution",
- "type": "object",
- "$ref": "#/definitions/exports"
- },
"obsoleted_by": {
"description": "A string that indicates that this project is no longer being developed. The named project provides a substitute or replacement.",
"type": "string",
@@ -248,6 +181,76 @@
"required": ["requires"],
"additionalProperties": false
},
+ "extensions": {
+ "type": "object",
+ "patternProperties": {
+ "^[A-Za-z][0-9A-Za-z_]*([.][0-9A-Za-z_]*)*$": {}
+ },
+ "properties": {
+ "python.details" : {
+ "description": "More information regarding the distribution.",
+ "type": "object",
+ "properties": {
+ "document_names": {
+ "description": "Names of supporting metadata documents",
+ "type": "object",
+ "properties": {
+ "description": {
+ "type": "string",
+ "$ref": "#/definitions/document_name"
+ },
+ "changelog": {
+ "type": "string",
+ "$ref": "#/definitions/document_name"
+ },
+ "license": {
+ "type": "string",
+ "$ref": "#/definitions/document_name"
+ }
+ },
+ "additionalProperties": false
+ },
+ "keywords": {
+ "description": "A list of additional keywords to be used to assist searching for the distribution in a larger catalog.",
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "license": {
+ "description": "A string indicating the license covering the distribution.",
+ "type": "string"
+ },
+ "classifiers": {
+ "description": "A list of strings, with each giving a single classification value for the distribution.",
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "python.project" : {
+ "description": "More information regarding the creation and maintenance of the distribution.",
+ "$ref": "#/definitions/project_or_integrator"
+ },
+ "python.integrator" : {
+ "description": "More information regarding the downstream redistributor of the distribution.",
+ "$ref": "#/definitions/project_or_integrator"
+ },
+ "python.commands" : {
+ "description": "Command line interfaces provided by this distribution",
+ "type": "object",
+ "$ref": "#/definitions/commands"
+ },
+ "python.exports" : {
+ "description": "Other exported interfaces provided by this distribution",
+ "type": "object",
+ "$ref": "#/definitions/exports"
+ }
+ },
+ "additionalProperties": false
+ },
"commands": {
"type": "object",
"properties": {
@@ -285,13 +288,6 @@
},
"additionalProperties": false
},
- "extensions": {
- "type": "object",
- "patternProperties": {
- "^[A-Za-z][0-9A-Za-z_]*([.][0-9A-Za-z_]*)*$": {}
- },
- "additionalProperties": false
- },
"command_map": {
"type": "object",
"patternProperties": {
@@ -302,40 +298,65 @@
},
"additionalProperties": false
},
+ "project_or_integrator" : {
+ "type": "object",
+ "properties" : {
+ "contacts": {
+ "description": "A list of contributor entries giving the recommended contact points for getting more information about the project.",
+ "type": "array",
+ "items": {
+ "type": "object",
+ "$ref": "#/definitions/contact"
+ }
+ },
+ "contributors": {
+ "description": "A list of contributor entries for other contributors not already listed as current project points of contact.",
+ "type": "array",
+ "items": {
+ "type": "object",
+ "$ref": "#/definitions/contact"
+ }
+ },
+ "project_urls": {
+ "description": "A mapping of arbitrary text labels to additional URLs relevant to the project.",
+ "type": "object"
+ }
+ }
+ },
"distribution_name": {
- "type": "string",
- "pattern": "^[0-9A-Za-z]([0-9A-Za-z_.-]*[0-9A-Za-z])?$"
+ "type": "string",
+ "pattern": "^[0-9A-Za-z]([0-9A-Za-z_.-]*[0-9A-Za-z])?$"
},
"requirement": {
- "type": "string"
+ "type": "string"
},
"provides_declaration": {
- "type": "string"
+ "type": "string"
},
"environment_marker": {
- "type": "string"
+ "type": "string"
},
"document_name": {
- "type": "string"
+ "type": "string"
},
"extra_name" : {
- "type": "string",
- "pattern": "^[0-9A-Za-z]([0-9A-Za-z_.-]*[0-9A-Za-z])?$"
+ "type": "string",
+ "pattern": "^[0-9A-Za-z]([0-9A-Za-z_.-]*[0-9A-Za-z])?$"
},
"relative_path" : {
- "type": "string"
+ "type": "string"
},
"export_specifier": {
"type": "string",
"pattern": "^([A-Za-z_][A-Za-z_0-9]*([.][A-Za-z_][A-Za-z_0-9]*)*)(:[A-Za-z_][A-Za-z_0-9]*([.][A-Za-z_][A-Za-z_0-9]*)*)?(\\[[0-9A-Za-z]([0-9A-Za-z_.-]*[0-9A-Za-z])?\\])?$"
},
"qualified_name" : {
- "type": "string",
- "pattern": "^[A-Za-z_][A-Za-z_0-9]*([.][A-Za-z_][A-Za-z_0-9]*)*$"
+ "type": "string",
+ "pattern": "^[A-Za-z_][A-Za-z_0-9]*([.][A-Za-z_][A-Za-z_0-9]*)*$"
},
"prefixed_name" : {
- "type": "string",
- "pattern": "^[A-Za-z_][A-Za-z_0-9]*([.][A-Za-z_0-9]*)*$"
+ "type": "string",
+ "pattern": "^[A-Za-z_][A-Za-z_0-9]*([.][A-Za-z_0-9]*)*$"
}
}
}