diff --git a/setup.py b/setup.py index a4c9c1fb..4a2985de 100755 --- a/setup.py +++ b/setup.py @@ -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'],