Skip to content

Commit 6512c8b

Browse files
authored
Fix wheel build for setuptools 70 (pyscf#2278)
* Fix platform issue in bdist_wheel * In case fail to import bdist_wheel
1 parent b6bfced commit 6512c8b

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

CHANGELOG

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PySCF 2.6.2 (2024-06-19)
22
------------------------
33
* Fixes
4-
- Compatibility issues due for NumPy 2.0 release.
4+
- Compatibility issues for NumPy 2.0 release.
55

66

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

1515

1616
PySCF 2.6.0 (2024-06-01)

setup.py

+16-2
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,27 @@ def run(self):
8383

8484
# build_py will produce plat_name = 'any'. Patch the bdist_wheel to change the
8585
# platform tag because the C extensions are platform dependent.
86+
# For setuptools<70
8687
from wheel.bdist_wheel import bdist_wheel
87-
initialize_options = bdist_wheel.initialize_options
88+
initialize_options_1 = bdist_wheel.initialize_options
8889
def initialize_with_default_plat_name(self):
89-
initialize_options(self)
90+
initialize_options_1(self)
9091
self.plat_name = get_platform()
92+
self.plat_name_supplied = True
9193
bdist_wheel.initialize_options = initialize_with_default_plat_name
9294

95+
# For setuptools>=70
96+
try:
97+
from setuptools.command.bdist_wheel import bdist_wheel
98+
initialize_options_2 = bdist_wheel.initialize_options
99+
def initialize_with_default_plat_name(self):
100+
initialize_options_2(self)
101+
self.plat_name = get_platform()
102+
self.plat_name_supplied = True
103+
bdist_wheel.initialize_options = initialize_with_default_plat_name
104+
except ImportError:
105+
pass
106+
93107
# scipy bugs
94108
# https://github.com/scipy/scipy/issues/12533
95109
_scipy_version = 'scipy!=1.5.0,!=1.5.1'

0 commit comments

Comments
 (0)