-
Notifications
You must be signed in to change notification settings - Fork 189
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* do not include .so in sdist * set the tag * Add link to imagemagick install info for other linux distros * call get_abi_tag() from wheel._bdist_wheel * wheel is no longer the canonical location for bdist_wheel for latest setuptools * wheel formatting --------- Co-authored-by: Adam Taranto <adam.p.taranto@gmail.com>
- Loading branch information
1 parent
b3438a1
commit 517f937
Showing
4 changed files
with
43 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,25 @@ | ||
import subprocess | ||
|
||
from hatchling.builders.hooks.plugin.interface import BuildHookInterface | ||
from setuptools.command.bdist_wheel import get_abi_tag, get_platform, tags | ||
|
||
|
||
class CustomBuildHook(BuildHookInterface): | ||
def initialize(self, version, build_data): | ||
# Set the custom wheel tag | ||
build_data["tag"] = self._get_wheel_tag() | ||
print(f"Using custom wheel tag: {build_data['tag']}") | ||
# Run setup.py build_ext before main build | ||
subprocess.check_call(["python", "setup.py", "build_ext", "--inplace"]) | ||
return super().initialize(version, build_data) | ||
|
||
def _get_wheel_tag(self): | ||
# Without the tag, the wheel will be named jcvi-0.0.0-py3-none-any.whl | ||
impl_name = tags.interpreter_name() | ||
impl_ver = tags.interpreter_version() | ||
abi_tag = get_abi_tag() | ||
plat_tag = get_platform(None) | ||
plat_tag = ( # macosx_11.0 => macosx_11_0 | ||
plat_tag.lower().replace("-", "_").replace(".", "_").replace(" ", "_") | ||
) | ||
return f"{impl_name}{impl_ver}-{abi_tag}-{plat_tag}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters