[Distutils] A smaller step towards de-specializing setuptools/distutils

Marius Gedminas marius at gedmin.as
Fri Oct 30 04:06:54 EDT 2015


On Thu, Oct 29, 2015 at 05:11:52PM -0400, Donald Stufft wrote:
> On October 29, 2015 at 5:09:45 PM, Marcus Smith (qwcode at gmail.com) wrote:
> > help me out here... how can we dynamically construct dependencies as we're
> > building wheels today?
> 
> I’m not sure I understand the confusion… since a wheel is created by
> executing setup.py, you’d just have your build tool dynamically output
> different wheels based on the system you’re building on (or whatever
> axis is causing the dynamic dependencies). An example is like:
> 
> https://github.com/pypa/twine/blob/a0c87357d9d5d588082c9a59f6efc6f6bc3d3498/setup.py#L28-L31

    install_requires = [
        "pkginfo >= 1.0",
        "requests >= 2.3.0",
        "requests-toolbelt >= 0.4.0",
        "setuptools >= 0.7.0",
    ]

    if sys.version_info[:2] < (2, 7):
        install_requires += [
            "argparse",
        ]

    setup(
        ...
        install_requires=install_requires,
    )

But code like this doesn't work!  You build a wheel on Python 2.7, you
get a twine-1.6.4-py2.py3-none-any.whl[*] in your pip wheel cache, and when
you try to install it on Python 2.6, pip tries to use the same wheel,
with install_requires computed for Python 2.7 instead of 2.6.  Unless
you override the wheel dependencies completely in setup.cfg[+].

[*] https://github.com/pypa/twine/blob/master/setup.cfg#L2:

      [wheel]
      universal = 1

[+] https://github.com/pypa/twine/blob/master/setup.cfg#L9-L15

      [metadata]
      requires-dist =
          requests >= 2.3.0
          requests-toolbelt >= 0.4.0
          pkginfo >= 1.0
          setuptools >= 0.7.0
          argparse; python_version == '2.6'

Marius Gedminas
-- 
   Since this protocol deals with Firewalls there are no real security
   considerations.
                -- RFC 3093
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 173 bytes
Desc: Digital signature
URL: <http://mail.python.org/pipermail/distutils-sig/attachments/20151030/8729d1f3/attachment-0001.sig>


More information about the Distutils-SIG mailing list