Skip to content

Commit

Permalink
fix: add support for AIX (scikit-build#988)
Browse files Browse the repository at this point in the history
* fix: add support for AIX

* fix: Update README.rst with known issue on AIX

AIX support requires a version of CMake newer than the 3.22.0 version that
IBM supplies in their AIX Toolbox for Open Source Software.  IBM is aware
of the issue and will be providing a newer build soon, but for now we
should note that users will need to build their own copy of a newer CMake
on AIX at this time.
  • Loading branch information
bhuntsman authored May 30, 2023
1 parent 03fa85c commit 36c7a9c
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 1 deletion.
3 changes: 3 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ already addressed in `scikit-build-core`_.
currently.
* The cache directory (``_skbuild``) may need to be deleted between builds in
some cases (like rebuilding with a different Python interpreter).
* AIX requires a newer version of CMake than the IBM-supplied CMake 3.22.0
from the AIX Toolbox for Open Source Software. We currently recommend
building CMake from source on AIX.

We are also working on improving scikit-build, so there are some upcoming
changes and deprecations:
Expand Down
8 changes: 8 additions & 0 deletions docs/skbuild.platform_specifics.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,14 @@ skbuild.platform\_specifics.osx module
:undoc-members:
:show-inheritance:

skbuild.platform\_specifics.aix module
----------------------------------------

.. automodule:: skbuild.platform_specifics.aix
:members:
:undoc-members:
:show-inheritance:

skbuild.platform\_specifics.platform\_factory module
----------------------------------------------------

Expand Down
28 changes: 28 additions & 0 deletions skbuild/platform_specifics/aix.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
"""This module defines object specific to AIX platform."""

from __future__ import annotations

import sys
import textwrap

from . import unix


class AIXPlatform(unix.UnixPlatform):
"""AIX implementation of :class:`.abstract.CMakePlatform`."""

@property
def generator_installation_help(self) -> str:
"""Return message guiding the user for installing a valid toolchain."""
return (
textwrap.dedent(
"""
Building AIX wheels for Python {pyver} requires IBM XL C/C++.
Get it here:
https://www.ibm.com/products/xl-c-aix-compiler-power
"""
)
.format(pyver=".".join(str(v) for v in sys.version_info[:2]))
.strip()
)
5 changes: 5 additions & 0 deletions skbuild/platform_specifics/platform_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,10 @@ def get_platform() -> abstract.CMakePlatform:

return sunos.SunOSPlatform()

if this_platform == "aix":
from . import aix

return aix.AIXPlatform()

msg = f"Unsupported platform: {this_platform:s}. Please contact the scikit-build team."
raise RuntimeError(msg)
3 changes: 2 additions & 1 deletion tests/test_platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def test_generator_cleanup():


@pytest.mark.parametrize(
"supported_platform", ["darwin", "freebsd", "openbsd", "linux", "windows", "os400", "cygwin", "sunos"]
"supported_platform", ["darwin", "freebsd", "openbsd", "linux", "windows", "os400", "cygwin", "sunos", "aix"]
)
def test_known_platform(supported_platform, mocker):
mocker.patch("platform.system", return_value=supported_platform)
Expand All @@ -96,6 +96,7 @@ def test_known_platform(supported_platform, mocker):
"os400": "BSD",
"cygwin": "Cygwin",
"sunos": "SunOS",
"aix": "AIX",
}
expected_platform_classname = f"{platforms[supported_platform]}Platform"
assert get_platform().__class__.__name__ == expected_platform_classname
Expand Down

0 comments on commit 36c7a9c

Please sign in to comment.