-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathsetup.py
65 lines (56 loc) · 2.13 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# Copyright (c) 2018, Skolkovo Institute of Science and Technology (Skoltech)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
# setup.py
#
# Created on: Jan 22, 2020
# Author: Lyubov Miloserdova
#
import setuptools
try:
from wheel.bdist_wheel import bdist_wheel as _bdist_wheel
import platform, os, ctypes
class bdist_wheel(_bdist_wheel):
def finalize_options(self):
_bdist_wheel.finalize_options(self)
if platform.system() == "Darwin":
self.root_is_pure = False
def get_tag(self):
python, abi, plat = _bdist_wheel.get_tag(self)
if platform.system() == "Darwin":
python, abi = 'py3', 'none'
name = plat[:plat.find("_")]
for i in range(3):
plat = plat[plat.find("_") + 1:] # skip name and version of OS
arch = plat
version = os.getenv('MACOSX_DEPLOYMENT_TARGET').replace('.', '_')
plat = name + "_" + version + "_" + arch
elif platform.system() == "Windows":
if ctypes.sizeof(ctypes.c_voidp) * 8 > 32:
plat = "win_" + platform.machine().lower()
else:
plat = "win32"
return python, abi, plat
except ImportError:
bdist_wheel = None
setuptools.setup(
version_config={
"dev_template": "{tag}.{branch}.post{ccount}+git.{sha}",
"dirty_template": "{tag}.{branch}.post{ccount}+git.{sha}.dirty",
},
setup_requires=['setuptools-git-versioning'],
cmdclass={'bdist_wheel': bdist_wheel}
)