Skip to content

Commit

Permalink
Fix setup script for setuptools 70 and newer
Browse files Browse the repository at this point in the history
  • Loading branch information
sunqm committed Oct 31, 2024
1 parent 6367ade commit 5e7e941
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,27 @@ def run(self):
else:
# 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

setup(
include_package_data=True,
packages=modules + ['pyscf.lib'],
Expand Down

0 comments on commit 5e7e941

Please sign in to comment.