-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Try overriding bdist_wheel default behavior
- Loading branch information
Showing
6 changed files
with
41 additions
and
305 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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -2,10 +2,12 @@ | |
# -*- coding: utf-8 -*- | ||
|
||
import os | ||
import re | ||
import sys | ||
from distutils.text_file import TextFile | ||
|
||
from skbuild import setup | ||
from wheel.bdist_wheel import bdist_wheel as _bdist_wheel_base | ||
|
||
# Add current folder to path | ||
# This is required to import versioneer in an isolated pip build | ||
|
@@ -29,11 +31,49 @@ def parse_requirements(filename): | |
test_requirements = parse_requirements('requirements-test.txt') | ||
|
||
|
||
def fixup_platform_tag(plat): | ||
if sys.platform.startswith("darwin"): | ||
platforms = [plat] | ||
# first, get the target macOS deployment target from the wheel | ||
match = re.match(r"^macosx_(\d+)_(\d+)_.*$", plat) | ||
assert match is not None, "Couldn't match on {}".format(plat) | ||
target = tuple(map(int, match.groups())) | ||
# given pip support for universal2 was added after x86_64 introduction | ||
# let's also add x86_64 platform. | ||
platforms.append("macosx_{}_{}_x86_64".format(*target)) | ||
# given pip support for universal2 was added after arm64 introduction | ||
# let's also add arm64 platform. | ||
arm64_target = target | ||
if arm64_target < (11, 0): | ||
arm64_target = (11, 0) | ||
platforms.append("macosx_{}_{}_arm64".format(*arm64_target)) | ||
if target < (11, 0): | ||
# They're were also issues with pip not picking up some universal2 wheels, tag twice | ||
platforms.append("macosx_11_0_universal2") | ||
return ".".join(platforms) | ||
return plat | ||
|
||
|
||
class bdist_wheel(_bdist_wheel_base): | ||
def finalize_options(self): | ||
_bdist_wheel_base.finalize_options(self) | ||
self.root_is_pure = False | ||
|
||
def get_tag(self): | ||
_, _, plat = _bdist_wheel_base.get_tag(self) | ||
python, abi, plat = "py2.py3", "none", fixup_platform_tag(plat) | ||
return python, abi, plat | ||
|
||
|
||
cmdclass = {"bdist_wheel": bdist_wheel} | ||
for k, v in versioneer.get_cmdclass().items(): | ||
cmdclass[k] = v | ||
|
||
setup( | ||
name='ninja', | ||
|
||
version=versioneer.get_version(), | ||
cmdclass=versioneer.get_cmdclass(), | ||
cmdclass=cmdclass, | ||
|
||
author='Jean-Christophe Fillion-Robin', | ||
author_email='[email protected]', | ||
|