1. Vinay Sajip
  2. distlib


Vinay Sajip  committed c755876

Added wheel_version to Wheel.build().

  • Participants
  • Parent commits 968fd1f
  • Branches default

Comments (0)

Files changed (4)

File CHANGES.rst

View file
 - wheel
+    - Added wheel_version kwarg to Wheel.build API.
     - Changed Wheel.install API (after consultation on distutils-sig).
     - Added support for PEP 426 JSON metadata (pydist.json).

File distlib/wheel.py

View file
             p = to_posix(os.path.relpath(record_path, base))
             writer.writerow((p, '', ''))
-    def build(self, paths, tags=None):
+    def build(self, paths, tags=None, wheel_version=None):
         Build a wheel from files in specified paths, and use any specified tags
         when determining the name of the wheel.
                 archive_paths.append((ap, p))
         wheel_metadata = [
-            'Wheel-Version: %d.%d' % self.wheel_version,
+            'Wheel-Version: %d.%d' % (wheel_version or self.wheel_version),
             'Generator: distlib %s' % __version__,
             'Root-Is-Purelib: %s' % is_pure,

File docs/reference.rst

View file
                    build of a named project).
       :type spec: str
-   .. method:: build(paths, tags=None)
+   .. method:: build(paths, tags=None, wheel_version=None)
       Build a wheel. The ``name``, ``version`` and ``buildver`` should already
       have been set correctly.
                    ``'pyver'``, ``'abi'`` and ``'arch'`` indicating lists of
                    tags which indicate environments with which the wheel is
+      :param wheel_version: If specified, this is written to the wheel's
+                            "Wheel-Version" metadata. If not specified, the
+                            implementation's latest supported wheel version is
+                            used.
    .. method:: install(self, paths, maker, **kwargs)

File docs/tutorial.rst

View file
 relate to the building Python. You can similarly pass values using the ``abi``
 and ``arch`` keys in the ``tags`` dictionary.
+Specifying a wheel's version
+You can also specify a particular "Wheel-Version" to be written to the wheel
+metadata of a wheel you're building. Simply pass a (major, minor) tuple in
+the ``wheel_version`` keyword argument to :meth:`~Wheel.build`. If not
+specified, the most recent version supported is written.
 Installing from wheels