1. Daniel Holth
  2. wheel

Commits

Daniel Holth  committed ccb8d95

use & support setuptools extras:markers syntax.

  • Participants
  • Parent commits 668ef50
  • Branches default

Comments (0)

Files changed (3)

File setup.cfg

View file
  • Ignore whitespace
 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]

File setup.py

View file
  • Ignore whitespace
           ],
       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': []
           },

File wheel/metadata.py

View file
  • Ignore whitespace
 
 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):
 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()
     """
         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