Skip to content

Commit

Permalink
Fix wheel build for setuptools 70 (pyscf#2278)
Browse files Browse the repository at this point in the history
* Fix platform issue in bdist_wheel

* In case fail to import bdist_wheel
  • Loading branch information
sunqm authored Jun 20, 2024
1 parent b6bfced commit 6512c8b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PySCF 2.6.2 (2024-06-19)
------------------------
* Fixes
- Compatibility issues due for NumPy 2.0 release.
- Compatibility issues for NumPy 2.0 release.


PySCF 2.6.1 (2024-06-17)
Expand All @@ -10,7 +10,7 @@ PySCF 2.6.1 (2024-06-17)
- Allow for custom options for opening h5py file.
- Linear dependency threshold for density fitting auxiliary basis.
* Fixes
- Compatibility issues due for NumPy 2.0 release.
- Compatibility issues due to NumPy 2.0 release.


PySCF 2.6.0 (2024-06-01)
Expand Down
18 changes: 16 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,27 @@ def run(self):

# build_py will produce plat_name = 'any'. Patch the bdist_wheel to change the
# platform tag because the C extensions are platform dependent.
# For setuptools<70
from wheel.bdist_wheel import bdist_wheel
initialize_options = bdist_wheel.initialize_options
initialize_options_1 = bdist_wheel.initialize_options
def initialize_with_default_plat_name(self):
initialize_options(self)
initialize_options_1(self)
self.plat_name = get_platform()
self.plat_name_supplied = True
bdist_wheel.initialize_options = initialize_with_default_plat_name

# For setuptools>=70
try:
from setuptools.command.bdist_wheel import bdist_wheel
initialize_options_2 = bdist_wheel.initialize_options
def initialize_with_default_plat_name(self):
initialize_options_2(self)
self.plat_name = get_platform()
self.plat_name_supplied = True
bdist_wheel.initialize_options = initialize_with_default_plat_name
except ImportError:
pass

# scipy bugs
# https://github.com/scipy/scipy/issues/12533
_scipy_version = 'scipy!=1.5.0,!=1.5.1'
Expand Down

0 comments on commit 6512c8b

Please sign in to comment.