Use sys.version_info instead of sys.version in packaging.
The contents of this attribute are an implementation detail, as
documented for #9442, so we should not parse it, to support non-CPython
VMs with distutils2 in the future.
Unfortunately, one use comes directly from PEP 345, so an edit will have
to be agreed before fixing the code (see comment in p7g.markers).
Other remaining uses are found in p7g.compiler and could be replaced by
the platform module (which also parses sys.version, but then it wouldn’t
be my fault :)
diff --git a/Lib/packaging/command/install_dist.py b/Lib/packaging/command/install_dist.py
index c54da6f..8388dc9 100644
--- a/Lib/packaging/command/install_dist.py
+++ b/Lib/packaging/command/install_dist.py
@@ -242,7 +242,7 @@
# $platbase in the other installation directories and not worry
# about needing recursive variable expansion (shudder).
- py_version = sys.version.split()[0]
+ py_version = '%s.%s' % sys.version_info[:2]
prefix, exec_prefix, srcdir, projectbase = get_config_vars(
'prefix', 'exec_prefix', 'srcdir', 'projectbase')