Skip to content

bpo-37592: sysconfig no longer relies on sys.version #14776

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions Lib/sysconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,12 @@
_SCHEME_KEYS = ('stdlib', 'platstdlib', 'purelib', 'platlib', 'include',
'scripts', 'data')

# FIXME don't rely on sys.version here, its format is an implementation detail
# of CPython, use sys.version_info or sys.hexversion
_PY_VERSION = sys.version.split()[0]
if sys.version_info.releaselevel == "final":
_PY_VERSION = "{}.{}.{}".format(*sys.version_info[:3])
else:
major, minor, micro, releaselevel, serial = sys.version_info
releasetoken = "rc" if releaselevel == "candidate" else releaselevel[0]
_PY_VERSION = f"{major}.{minor}.{micro}{releasetoken}{serial}"
_PY_VERSION_SHORT = '%d.%d' % sys.version_info[:2]
_PY_VERSION_SHORT_NO_DOT = '%d%d' % sys.version_info[:2]
_PREFIX = os.path.normpath(sys.prefix)
Expand Down