forked from bluerobotics/BlueOS
/
setup.py
83 lines (70 loc) · 2.33 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
#!/usr/bin/env python3
import pathlib
import ssl
import sys
import time
import urllib.request
from collections import namedtuple
from warnings import warn
import setuptools
from settings import Settings
ssl._create_default_https_context = ssl._create_unverified_context
autopilot_settings = Settings()
defaults_folder = autopilot_settings.defaults_folder
StaticFile = namedtuple("StaticFile", "parent filename url")
static_files = [
StaticFile(
defaults_folder,
"ardupilot_navigator",
"https://firmware.ardupilot.org/Sub/stable-4.1.2/navigator/ardusub",
),
StaticFile(defaults_folder, "ardupilot_pixhawk1", "https://firmware.ardupilot.org/Sub/latest/Pixhawk1/ardusub.apj"),
StaticFile(defaults_folder, "ardupilot_pixhawk4", "https://firmware.ardupilot.org/Sub/latest/Pixhawk4/ardusub.apj"),
]
for file in static_files:
path = pathlib.Path.joinpath(file.parent, file.filename)
path.parent.mkdir(parents=True, exist_ok=True)
number_of_attempts = 0
while number_of_attempts < 5:
number_of_attempts += 1
try:
urllib.request.urlretrieve(file.url, path)
break
except Exception as error:
warn(f"unable to open url {file.url}, error {error}")
time.sleep(5)
else:
sys.exit(1)
with open("README.md", "r", encoding="utf-8") as readme:
long_description = readme.read()
setuptools.setup(
name="ardupilot-manager",
version="0.0.1",
author="Patrick José Pereira",
author_email="patrick@bluerobotics.com",
description="ArduPilot service manager.",
long_description=long_description,
long_description_content_type="text/markdown",
packages=setuptools.find_packages(),
python_requires=">=3.6",
install_requires=[
"appdirs == 1.4.4",
"packaging == 20.4",
"smbus2 == 0.3.0",
"starlette == 0.27.0",
"fastapi == 0.105.0",
# Enforce anyio fastapi subdependency to avoid conflict with starlette
"anyio == 3.7.1",
"uvicorn == 0.13.4",
"python-multipart == 0.0.5",
"validators == 0.18.2",
"fastapi-versioning == 0.9.1",
"aiofiles == 0.6.0",
"loguru == 0.5.3",
"commonwealth == 0.1.0",
"pyelftools == 0.30",
"psutil == 5.7.2",
"pyserial == 3.5",
"pydantic == 1.10.12",
],
)