[Python-checkins] bpo-36588: On AIX, remove major version from sys.platform (GH-12787)

Victor Stinner webhook-mailer at python.org
Fri Apr 12 10:15:36 EDT 2019


https://github.com/python/cpython/commit/9d949f7796da612f1b588d18c6f041376992a9fc
commit: 9d949f7796da612f1b588d18c6f041376992a9fc
branch: master
author: Michael Felt <aixtools at users.noreply.github.com>
committer: Victor Stinner <vstinner at redhat.com>
date: 2019年04月12日T16:15:32+02:00
summary:
bpo-36588: On AIX, remove major version from sys.platform (GH-12787)
On AIX, sys.platform doesn't contain the major version anymore.
Always return 'aix', instead of 'aix3' .. 'aix7'. Since
older Python versions include the version number, it is recommended to
always use sys.platform.startswith('aix').
files:
A Misc/NEWS.d/next/Core and Builtins/2019-04-11-14-36-55.bpo-36588.wejLoC.rst
M Doc/library/sys.rst
M Doc/whatsnew/3.8.rst
M configure
M configure.ac
diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst
index 52026f6a2bce..591972e9b783 100644
--- a/Doc/library/sys.rst
+++ b/Doc/library/sys.rst
@@ -1014,7 +1014,7 @@ always available.
 This string contains a platform identifier that can be used to append
 platform-specific components to :data:`sys.path`, for instance.
 
- For Unix systems, except on Linux, this is the lowercased OS name as
+ For Unix systems, except on Linux and AIX, this is the lowercased OS name as
 returned by ``uname -s`` with the first part of the version as returned by
 ``uname -r`` appended, e.g. ``'sunos5'`` or ``'freebsd8'``, *at the time
 when Python was built*. Unless you want to test for a specific system
@@ -1024,12 +1024,15 @@ always available.
 # FreeBSD-specific code here...
 elif sys.platform.startswith('linux'):
 # Linux-specific code here...
+ elif sys.platform.startswith('aix'):
+ # AIX-specific code here...
 
 For other systems, the values are:
 
 ================ ===========================
 System ``platform`` value
 ================ ===========================
+ AIX ``'aix'``
 Linux ``'linux'``
 Windows ``'win32'``
 Windows/Cygwin ``'cygwin'``
@@ -1042,6 +1045,12 @@ always available.
 older Python versions include the version number, it is recommended to
 always use the ``startswith`` idiom presented above.
 
+ .. versionchanged:: 3.8
+ On AIX, :attr:`sys.platform` doesn't contain the major version anymore.
+ It is always ``'aix'``, instead of ``'aix5'`` or ``'aix7'``. Since
+ older Python versions include the version number, it is recommended to
+ always use the ``startswith`` idiom presented above.
+
 .. seealso::
 
 :attr:`os.name` has a coarser granularity. :func:`os.uname` gives
diff --git a/Doc/whatsnew/3.8.rst b/Doc/whatsnew/3.8.rst
index aa75beeabe70..bf28e5ff4b06 100644
--- a/Doc/whatsnew/3.8.rst
+++ b/Doc/whatsnew/3.8.rst
@@ -700,6 +700,11 @@ Changes in Python behavior
 raised when getting the attribute from the type dictionary are no longer
 ignored. (Contributed by Serhiy Storchaka in :issue:`35459`.)
 
+* On AIX, :attr:`sys.platform` doesn't contain the major version anymore.
+ It is always ``'aix'``, instead of ``'aix3'`` .. ``'aix7'``. Since
+ older Python versions include the version number, it is recommended to
+ always use the ``sys.platform.startswith('aix')``.
+ (Contributed by M. Felt in :issue:`36588`.)
 
 Changes in the Python API
 -------------------------
diff --git a/Misc/NEWS.d/next/Core and Builtins/2019-04-11-14-36-55.bpo-36588.wejLoC.rst b/Misc/NEWS.d/next/Core and Builtins/2019-04-11-14-36-55.bpo-36588.wejLoC.rst
new file mode 100644
index 000000000000..77d2fa4e299b
--- /dev/null
+++ b/Misc/NEWS.d/next/Core and Builtins/2019-04-11-14-36-55.bpo-36588.wejLoC.rst	
@@ -0,0 +1,5 @@
+On AIX, :attr:`sys.platform` doesn't contain the major version anymore.
+Always return ``'aix'``, instead of ``'aix3'`` .. ``'aix7'``. Since
+older Python versions include the version number, it is recommended to
+always use ``sys.platform.startswith('aix')``.
+Contributed by M. Felt.
diff --git a/configure b/configure
index fcfa71496e40..72589fdb78c5 100755
--- a/configure
+++ b/configure
@@ -3281,6 +3281,7 @@ then
 MACHDEP="$ac_md_system$ac_md_release"
 
 case $MACHDEP in
+	aix*) MACHDEP="aix";;
 	linux*) MACHDEP="linux";;
 	cygwin*) MACHDEP="cygwin";;
 	darwin*) MACHDEP="darwin";;
@@ -10199,7 +10200,6 @@ fi
 
 
 
-
 if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
 	if test -n "$ac_tool_prefix"; then
 # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
diff --git a/configure.ac b/configure.ac
index 880e47f70fb3..30e8587cb08f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -404,6 +404,7 @@ then
 MACHDEP="$ac_md_system$ac_md_release"
 
 case $MACHDEP in
+	aix*) MACHDEP="aix";;
 	linux*) MACHDEP="linux";;
 	cygwin*) MACHDEP="cygwin";;
 	darwin*) MACHDEP="darwin";;


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /