This repository has been archived by the owner on Oct 10, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
/
setup.py
101 lines (83 loc) · 2.86 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
"""
Standard setup.py file.
The installation performs the following:
1. Install all dependencies
2. Create the top level "ncl_rovers" directory
3. Copy sources
4. Copy some additional files
The code is then runnable by executing the top level directory::
python -m ncl_rovers
Of course, alternatively, you can execute the code pulled from github.
"""
import setuptools
import os
# Fetch the root folder to specify absolute paths to the files to include
ROOT = os.path.normpath(os.path.dirname(__file__))
# Specify which directories and files should be added to the installation
DIRS = [
os.path.join(ROOT, "assets"),
]
FILES = [
os.path.join(ROOT, "log", "README.md"),
os.path.join(ROOT, "LICENSE"),
os.path.join(ROOT, "README.md")
]
def _get_package_data() -> list:
"""
Helper function used to fetch the relevant files to add to the package.
:return: List of file paths
"""
data = []
# Recursively copy the directories to include
for _ in DIRS:
for root_dir, _, files in os.walk(_):
for file in files:
path = os.path.join(root_dir, file)
if "__pycache__" not in path:
data.append(path)
# Copy the files to include
for file in FILES:
data.append(file)
return data
# Treat the contents of the readme as long description
with open(os.path.join(ROOT, "README.md"), encoding="utf-8") as f:
long_description = f.read()
# By renaming the packages, the correct structure is ensured
packages_renamed = ["ncl_rovers"] + [package.replace("src", "ncl_rovers.src") for package in setuptools.find_packages()]
package_dirs_renamed = {package: package.replace("ncl_rovers.", "").replace(".", "/") for package in packages_renamed}
package_dirs_renamed["ncl_rovers"] = "."
package_dirs_renamed.__delitem__("tests")
# Non-packaged files which will be included in the global package
package_data = _get_package_data()
setuptools.setup(
name="ncl_rovers",
description="ROV project for MATE competition",
version="1.0.dev2",
author="Newcastle University Engineering Projects Society (surface)",
maintainer="Florianski Kacper",
maintainer_email="[email protected]",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/ncl-ROVers",
license="MIT License",
packages=packages_renamed,
package_dir=package_dirs_renamed,
package_data={"ncl_rovers": package_data},
include_package_data=True,
classifiers=[
"Programming Language :: Python :: 3.8",
"License :: OSI Approved :: MIT License",
],
install_requires=[
"filelock",
"inputs",
"PySide2",
"pyautogui",
"pytest",
"pandas",
"sklearn",
"opencv-python",
"psutil"
],
python_requires=">=3.8.1",
)