-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup.py
120 lines (102 loc) · 3.81 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
import os
import codecs
import os.path
from setuptools import find_packages, setup
from setuptools.command.develop import develop
from setuptools.command.install import install
classifiers = [
"Development Status :: 2 - Pre-Alpha",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: BSD License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Topic :: Scientific/Engineering",
"Topic :: Software Development",
]
def read(rel_path):
here = os.path.abspath(os.path.dirname(__file__))
with codecs.open(os.path.join(here, rel_path), "r") as fp:
return fp.read()
def get_version(rel_path):
for line in read(rel_path).splitlines():
if line.startswith("__version__"):
delim = '"' if '"' in line else "'"
return line.split(delim)[1]
else:
raise RuntimeError("Unable to find version string.")
def try_download_configuration_file():
"""Download configuration file if it does not exist."""
home_dir = os.getenv("HOME")
configuration_file = (
home_dir + "/uos_aruco_detector/configuration/configuration.yaml"
)
if os.path.exists(configuration_file):
os.system(
"wget https://raw.githubusercontent.com/ocean-perception/uos_aruco_detector/main/src/uos_aruco_detector/configuration/configuration.yaml -O {}".format(
configuration_file
)
)
class PostDevelopCommand(develop):
"""Post-installation for development mode."""
def run(self):
develop.run(self)
try_download_configuration_file()
class PostInstallCommand(install):
"""Post-installation for installation mode."""
def run(self):
install.run(self)
try_download_configuration_file()
def run_setup():
"""Get version from git, then install."""
# load long description from README.md
readme_file = "README.md"
if os.path.exists(readme_file):
long_description = open(readme_file, encoding="utf-8", errors="ignore").read()
else:
print("Could not find readme file to extract long_description.")
long_description = ""
setup(
name="uos_aruco_detector",
version=get_version("src/uos_aruco_detector/version.py"),
install_requires=[
"pyyaml==6.0",
"pandas==1.4.2",
"numpy==1.23.4",
"matplotlib==3.5.1",
"scipy==1.8.0",
"opencv-contrib-python==4.5.5.62",
],
cmdclass={
"develop": PostDevelopCommand,
"install": PostInstallCommand,
},
author="Ocean Perception - University of Southampton",
author_email="[email protected]",
description="Aruco marker external localisation system using OpenCV capture", # noqa
long_description=long_description,
url="https://github.com/ocean-perception/uos_aruco_detector",
packages=find_packages(where="src"),
package_dir={"": "src"},
classifiers=classifiers,
license="BSD",
entry_points={ # Optional
"console_scripts": [
"uos_aruco_detector = uos_aruco_detector.aruco_localisation:main",
"uos_aruco_detector_client = uos_aruco_detector.client_example:main",
"uos_aruco_camera_calibration = uos_aruco_detector.camera_calibration:main",
],
},
include_package_data=True,
package_data={
"uos_aruco_detector": [
"src/uos_aruco_detector/configuration/*.yaml",
]
},
)
if __name__ == "__main__":
run_setup()