-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup.py
122 lines (107 loc) · 3.82 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# -*- coding: utf-8 -*-
import os
import sys
import shutil
from shutil import which
from setuptools import setup
setup_file_path = os.path.dirname(os.path.realpath(__file__))
project_root = setup_file_path
package_folder = os.path.join(project_root, "build", "lib", "phase")
python_version_lower = \
str(sys.version_info.major) + '.' + str(sys.version_info.minor)
python_version_upper = \
str(sys.version_info.major) + '.' + str(sys.version_info.minor + 1)
def load_long_description():
global project_root
readme_path = os.path.join(project_root, "description.md")
with open(readme_path, "r") as fh:
long_description = fh.read()
return long_description
def load_version():
global project_root
with open(os.path.join(project_root, "version.txt"), "r") as fh:
version = fh.read()
return version
def find_package_data():
package_data = {
"phase":
[
'*',
'pyphase/*',
'pyphase/calib/*',
'pyphase/stereocamera/*',
'pyphase/stereomatcher/*',
'pyphase/types/*',
]
}
return package_data
def gen_stubs():
global project_root
python_path = os.path.abspath(os.path.join(package_folder, ".."))
if which("pybind11-stubgen") is None:
raise Exception("Failed to find pybind11-stubgen")
stubgen_cmd = 'pybind11-stubgen phase.pyphase -o "' + python_path + \
'" --ignore-invalid all --no-setup-py'
exit_code = os.system(stubgen_cmd)
if exit_code != 0:
raise Exception("Failed to generate stubs")
if os.path.exists(os.path.join(python_path, "phase", "pyphase")):
shutil.rmtree(os.path.join(python_path, "phase", "pyphase"))
os.rename(
os.path.join(python_path, "phase", "pyphase-stubs"),
os.path.join(python_path, "phase", "pyphase")
)
try:
from wheel.bdist_wheel import bdist_wheel as _bdist_wheel
class bdist_wheel(_bdist_wheel):
def finalize_options(self):
_bdist_wheel.finalize_options(self)
self.root_is_pure = False
except ImportError:
bdist_wheel = None
gen_stubs()
setup(
name="phase",
version=load_version(),
author="Ben Knight",
author_email="[email protected]",
description="Python API for I3DR's Phase Library",
long_description=load_long_description(),
long_description_content_type="text/markdown",
url="https://i3drobotics.github.io/phase/python/html/index.html",
project_urls={
"Documentation":
"https://i3drobotics.github.io/phase/python/html/index.html",
"Issues":
"https://github.com/i3drobotics/phase/issues",
},
license_files=('LICENSE'),
cmdclass={'bdist_wheel': bdist_wheel},
zip_safe=False,
packages=['phase'],
python_requires='>=3.6',
install_requires=[
'numpy>=1.13.3; python_version<"3.7"',
'numpy>=1.14.5; python_version>="3.7"',
'numpy>=1.17.3; python_version>="3.8"',
'numpy>=1.19.3; python_version>="3.9"',
'numpy>=1.21.2; python_version>="3.10"',
'numpy>=1.19.3; python_version>="3.6"'
' and platform_system=="Linux" and platform_machine=="aarch64"',
'numpy>=1.21.2; python_version>="3.6"'
' and platform_system=="Darwin" and platform_machine=="arm64"',
],
classifiers=[
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
'Programming Language :: Python',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10'
],
keywords='Industrial 3D Robotics I3DR stereo camera',
package_dir={'phase': package_folder},
package_data=find_package_data()
)