Issue
Apparently, Python 3.10 / 3.12 is going to deprecate / remove distutils (cpython/issues/92584).
Unfortunately, I have not been able to find a replacement for the one and only function I am using from it; distutils.util.get_platform()
. What is the replacement for this?
Note that platform
is NOT an answer. I need a function that returns the complete string that is used when building a binary wheel¹, e.g. macosx-12-x86_64
. Note particularly that there appears to be platform-specific logic embedded in this (e.g. the only other way I know to get the macos version is with a macos-specific API).
(¹ As noted in a comment, distutils.util.get_platform()
is, strictly speaking, not that function. However, PEP 425 specifies that "the platform tag is simply distutils.util.get_platform()
with all hyphens -
and periods .
replaced with underscore _
." Ergo, it is straight-forward and platform-agnostic to derive the tag from distutils.util.get_platform()
. An acceptable answer may therefore give an approved, public API which produces the platform tag directly, or a compatible replacement for distutils.util.get_platform()
.)
Solution
For your use-case, sysconfig
has a replacement
import sysconfig
sysconfig.get_platform()
This is what the wheel project itself used as a replacement for distutils.util.get_platform()
when removing distutils from the code in Replaced all uses of distutils with setuptools #428.
Answered By - wim
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.