Skip to content

Commit

Permalink
added bdist_wheel change.
Browse files Browse the repository at this point in the history
  • Loading branch information
nickjbrowning committed Dec 18, 2024
1 parent 2e28a8f commit 97378d6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
15 changes: 15 additions & 0 deletions sphericart-jax/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,26 @@
from setuptools import Extension, setup
from setuptools.command.bdist_egg import bdist_egg
from setuptools.command.build_ext import build_ext
from wheel.bdist_wheel import bdist_wheel


ROOT = os.path.realpath(os.path.dirname(__file__))
SPHERICART_ARCH_NATIVE = os.environ.get("SPHERICART_ARCH_NATIVE", "ON")


class universal_wheel(bdist_wheel):
# When building the wheel, the `wheel` package assumes that if we have a
# binary extension then we are linking to `libpython.so`; and thus the wheel
# is only usable with a single python version. This is not the case for
# here, and the wheel will be compatible with any Python >=3. This is
# tracked in https://github.com/pypa/wheel/issues/185, but until then we
# manually override the wheel tag.
def get_tag(self):
tag = bdist_wheel.get_tag(self)
# tag[2:] contains the os/arch tags, we want to keep them
return ("py3", "none") + tag[2:]


class cmake_ext(build_ext):
"""Build the native library using cmake"""

Expand Down Expand Up @@ -88,6 +102,7 @@ def run(self):
cmdclass={
"build_ext": cmake_ext,
"bdist_egg": bdist_egg if "bdist_egg" in sys.argv else bdist_egg_disabled,
"bdist_wheel": universal_wheel,
},
package_data={
"sphericart-jax": [
Expand Down
1 change: 1 addition & 0 deletions sphericart-torch/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ def run(self):
cmdclass={
"build_ext": cmake_ext,
"bdist_egg": bdist_egg if "bdist_egg" in sys.argv else bdist_egg_disabled,
"bdist_wheel": universal_wheel,
},
package_data={
"sphericart-torch": [
Expand Down

0 comments on commit 97378d6

Please sign in to comment.