Skip to content

bpo-36588: For AIX remove major version from sys.platform #12787

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

Merged
merged 4 commits into from
Apr 12, 2019
Merged
Show file tree
Hide file tree
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
11 changes: 10 additions & 1 deletion Doc/library/sys.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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'``
Expand All @@ -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
Expand Down
5 changes: 5 additions & 0 deletions Doc/whatsnew/3.8.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
-------------------------
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
16 changes: 2 additions & 14 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -783,7 +783,6 @@ infodir
docdir
oldincludedir
includedir
runstatedir
localstatedir
sharedstatedir
sysconfdir
Expand Down Expand Up @@ -895,7 +894,6 @@ datadir='${datarootdir}'
sysconfdir='${prefix}/etc'
sharedstatedir='${prefix}/com'
localstatedir='${prefix}/var'
runstatedir='${localstatedir}/run'
includedir='${prefix}/include'
oldincludedir='/usr/include'
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
Expand Down Expand Up @@ -1148,15 +1146,6 @@ do
| -silent | --silent | --silen | --sile | --sil)
silent=yes ;;

-runstatedir | --runstatedir | --runstatedi | --runstated \
| --runstate | --runstat | --runsta | --runst | --runs \
| --run | --ru | --r)
ac_prev=runstatedir ;;
-runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
| --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
| --run=* | --ru=* | --r=*)
runstatedir=$ac_optarg ;;

-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
ac_prev=sbindir ;;
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
Expand Down Expand Up @@ -1294,7 +1283,7 @@ fi
for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
datadir sysconfdir sharedstatedir localstatedir includedir \
oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
libdir localedir mandir runstatedir
libdir localedir mandir
do
eval ac_val=\$$ac_var
# Remove trailing slashes.
Expand Down Expand Up @@ -1447,7 +1436,6 @@ Fine tuning of the installation directories:
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
--runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run]
--libdir=DIR object code libraries [EPREFIX/lib]
--includedir=DIR C header files [PREFIX/include]
--oldincludedir=DIR C header files for non-gcc [/usr/include]
Expand Down Expand Up @@ -3293,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";;
Expand Down Expand Up @@ -10211,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.
Expand Down
1 change: 1 addition & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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";;
Expand Down