[Python-Dev] Is distutils.util.get_platform() the "current" or the "target" platform

Gregory P. Smith greg at krypto.org
Fri Feb 15 17:23:09 EST 2019


On Fri, Feb 15, 2019 at 2:02 PM Steve Dower <steve.dower at python.org> wrote:

> On 14Feb2019 1147, Gregory P. Smith wrote:
> > To alleviate confusion long term I'd love it if we could deprecate the
> > unqualified get_platform() API and point people towards always being
> > explicit about get_target_platform() vs get_current_platform().
>
> This is an option too, though it doesn't reduce the code churn. I
> personally want to consider distutils deprecated as a whole anyway, and
> only maintained for the sake of our core needs.
>
> > There are valid reasons for people to be expecting either target or
> > current return values from get_platform(), but I agree with you, having
> > it return the target platform /feels/ more likely to be what people
> > want.  It'd be worth auditing a random sample of people's calls of this
> > API in open source projects to confirm that intuition.
>
> I took a random sample of about 50 uses from GitHub and 100% of them
> were copies of our distutils/tests/test_util.py (not even kidding:
> https://github.com/search?q=distutils+get_platform&type=Code)
>
> If you go far enough down the results, they're all copies of wheel's (or
> pip's) pep425tags.py, which import distutils.util but don't seem to use
> get_platform
>
> I'm inclined to say that nobody but us uses this API :) Does that make
> it seem more okay to "clarify" that it's returning target platform?
>

All of the instances of its use that I can find in a quick search
(excluding copies/clones/forks of other code) are using it to mean target
platform as well.

So yeah, I'd just go with that assumption.

-gps
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20190215/bca2dd8c/attachment-0001.html>


More information about the Python-Dev mailing list