Skip to content

Commit

Permalink
Cancel abi3 changes
Browse files Browse the repository at this point in the history
  • Loading branch information
jschueller committed Mar 15, 2024
1 parent 4ccde87 commit 2a59da1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 32 deletions.
20 changes: 8 additions & 12 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ jobs:
strategy:
fail-fast: False
matrix:
# python-version: [ 3.8, 3.9, '3.10', '3.11' ]
python-version: [ '3.11' ]
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand All @@ -35,12 +34,9 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Install SWIG
run: choco install swig -y

- name: Build wheels
run: |
python -m pip install -U pip numpy wheel setuptools
python -m pip install -U pip numpy swig wheel setuptools
python setup.py bdist_wheel -d dist
ls -al ./dist
Expand All @@ -62,16 +58,16 @@ jobs:
with:
submodules: true

- name: Setup Python 3.6
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: '3.6'
python-version: '3.11'

- name: Build wheels
env:
# only build CPython-3.6+ and skip 32-bit builds and skip windows
CIBW_BUILD: cp36-*
CIBW_SKIP: "*-win* *-manylinux_i686 *-musllinux*"
# only build CPython-3.8+ and skip 32-bit builds
CIBW_BUILD: cp38-* cp39-* cp310-* cp311-* cp312-*
CIBW_SKIP: "*-manylinux_i686 *-musllinux*"
# use latest build
CIBW_MANYLINUX_X86_64_IMAGE: quay.io/pypa/manylinux2014_x86_64
CIBW_BEFORE_ALL_MACOS: brew install swig
Expand All @@ -93,7 +89,7 @@ jobs:
strategy:
matrix:
os: [ windows-latest, ubuntu-latest, macos-latest ]
python-version: [ '3.11' ]
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']

steps:
- name: Checkout repository
Expand Down
8 changes: 1 addition & 7 deletions extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,6 @@ def build_extension(self, ext: Extension):
ext.source_dir.as_posix()
]

if platform.system() == "Windows":
cmd += "-DPYTHON_EXTENSION_MODULE_SUFFIX=.abi3.so"
else:
cmd += "-DPYTHON_EXTENSION_MODULE_SUFFIX=.abi3.pyd"
abi3_flag = "-DPy_LIMITED_API=0x03060000"

if platform.system() == "Windows":
cmd.insert(2, f"-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_{self.config.upper()}={_ed}")

Expand All @@ -71,7 +65,7 @@ def build_extension(self, ext: Extension):
cwd=build_dir,
env={
**os.environ.copy(),
"CXXFLAGS": f'{os.environ.get("CXXFLAGS", "")} -DVERSION_INFO="{self.distribution.get_version()}" {abi3_flag}'
"CXXFLAGS": f'{os.environ.get("CXXFLAGS", "")} -DVERSION_INFO="{self.distribution.get_version()}"'
})

# build the DLL
Expand Down
14 changes: 1 addition & 13 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,10 @@
version = ".".join(version)


class bdist_wheel_abi3(bdist_wheel):
def get_tag(self):
python, abi, plat = super().get_tag()

if python.startswith("cp"):
# on CPython, our wheels are abi3 and compatible back to 3.6
return "cp36", "abi3", plat

return python, abi, plat


setup(
version=version,
install_requires=["numpy >=1.18.5"],
ext_modules=[NLOptBuildExtension("nlopt._nlopt", version)],
cmdclass={"build_ext": NLOptBuild,
"bdist_wheel": bdist_wheel_abi3},
cmdclass={"build_ext": NLOptBuild},
zip_safe=False,
)

0 comments on commit 2a59da1

Please sign in to comment.