Skip to content

Commit

Permalink
Fix macos pypi wheel
Browse files Browse the repository at this point in the history
  • Loading branch information
sunqm committed Oct 17, 2023
1 parent ea8a451 commit 3ecc029
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 8 deletions.
35 changes: 30 additions & 5 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,16 @@ jobs:
packages-dir: ${{ github.workspace }}/dist
verbose: true

release-pypi-macos:
name: Build wheels on macos
runs-on: macos-latest
release-pypi-macos-x86:
name: Build wheels for macos
runs-on: macosx_x86_64
steps:
- uses: actions/checkout@v3
- name: Build wheels
uses: pypa/[email protected]
env:
CIBW_BUILD: cp39-macosx_x86_64 cp39-macosx_arm64
CIBW_BUILD: cp311-macosx_x86_64
CIBW_BUILD_VERBOSITY: "1"
CMAKE_CONFIGURE_ARGS: "-DWITH_F12=OFF"
with:
output-dir: mac-wheels
Expand All @@ -117,7 +118,31 @@ jobs:
pip install twine
export TWINE_USERNAME=__token__
export TWINE_PASSWORD="${{ secrets.PYPI_API_TOKEN }}"
twine upload --verbose /mac-wheels/*
twine upload --verbose mac-wheels/*
release-pypi-macos-arm64:
name: Build wheels for Apple M chips
runs-on: macosx_x86_64
steps:
- uses: actions/checkout@v3
- name: Build wheels
uses: pypa/[email protected]
env:
CIBW_BUILD: cp311-macosx_arm64
CIBW_BUILD_VERBOSITY: "1"
CMAKE_CONFIGURE_ARGS: "-DWITH_F12=OFF"
CMAKE_OSX_ARCHITECTURES: arm64
with:
output-dir: mac-wheels
- name: List available wheels
run: |
ls mac-wheels
- name: Publish to PyPI
run: |
pip install twine
export TWINE_USERNAME=__token__
export TWINE_PASSWORD="${{ secrets.PYPI_API_TOKEN }}"
twine upload --verbose mac-wheels/*
release-conda-linux:
runs-on: ubuntu-latest
Expand Down
4 changes: 2 additions & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ include pyscf/lib/*.so pyscf/lib/config.h.in

# macos dynamic libraries
include pyscf/lib/*.dylib
include pyscf/lib/deps/lib*/libcint.[45].dylib
include pyscf/lib/deps/lib*/libcint.[4-9].dylib
include pyscf/lib/deps/lib*/libxc.*.dylib
include pyscf/lib/deps/lib*/libxcfun.[23].dylib
include pyscf/lib/deps/lib*/libxcfun.[2-9].dylib

include pyscf/geomopt/log.ini

Expand Down
24 changes: 23 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,29 @@ def run(self):
initialize_options = bdist_wheel.initialize_options
def initialize_with_default_plat_name(self):
initialize_options(self)
self.plat_name = get_platform()
arch = os.getenv('CMAKE_OSX_ARCHITECTURES')
if sys.platform == 'darwin' and arch:
# Based on name convention in cibuildwheel
# if config_is_arm64:
# # macOS 11 is the first OS with arm64 support, so the wheels
# # have that as a minimum.
# env.setdefault("_PYTHON_HOST_PLATFORM", "macosx-11.0-arm64")
# env.setdefault("ARCHFLAGS", "-arch arm64")
# elif config_is_universal2:
# env.setdefault("_PYTHON_HOST_PLATFORM", "macosx-10.9-universal2")
# env.setdefault("ARCHFLAGS", "-arch arm64 -arch x86_64")
# elif python_configuration.identifier.endswith("x86_64"):
# # even on the macos11.0 Python installer, on the x86_64 side it's
# # compatible back to 10.9.
# env.setdefault("_PYTHON_HOST_PLATFORM", "macosx-10.9-x86_64")
# env.setdefault("ARCHFLAGS", "-arch x86_64")
osname = get_platform().rsplit('-', 1)[0]
if ';' in arch:
self.plat_name = f'{osname}-universal2'
else:
self.plat_name = f'{osname}-{arch}'
else:
self.plat_name = get_platform()
bdist_wheel.initialize_options = initialize_with_default_plat_name

# scipy bugs
Expand Down

0 comments on commit 3ecc029

Please sign in to comment.