[Python-Dev] Is distutils.util.get_platform() the "current" or the "target" platform
Steve Dower
steve.dower at python.org
Fri Feb 15 17:02:43 EST 2019
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?
Cheers,
Steve
More information about the Python-Dev
mailing list