-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetup.py
82 lines (68 loc) · 2.5 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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# setup.py
"""Install script for this package."""
import os
from setuptools import setup, find_packages
try:
from _version import Version
# Utility function to read the README file.
# Used for the long_description. It's nice, because now 1) we have a top level
# README file and 2) it's easier to type in the README file than to put a raw
# string in below ...
#def read(fname):
# return open(os.path.join(os.path.dirname(__file__), fname)).read()
VERSION = str(Version(os.popen("git describe --tags --dirty --always").read()[1:-1]))
if os.path.exists("VERSION"):
STORED = open("VERSION", "r").read()
if ".dev" in VERSION:
_len = len(VERSION[:VERSION.index(".dev")+4])
else:
_len = len(VERSION)
if STORED[:_len] == VERSION[:_len] and ".dev" in VERSION:
# Obtain dev number
VERSION = VERSION + str(int(STORED[_len:]) + 1)
else:
if ".dev" in VERSION:
VERSION = VERSION + "0"
else:
if ".dev" in VERSION:
VERSION = VERSION + "0"
with open("VERSION", "w") as file:
file.write(VERSION)
# Also store the version to be seen from the code
with open("./autopsy/version.py", "w") as file:
file.write("__version__ = '%s'" % VERSION)
except:
# When not building the wheel use the package version
VERSION=str(os.popen("grep '<version>' package.xml | grep -o '[0-9\.]*'").read()[:-1])
with open("./autopsy/version.py", "w") as file:
file.write("__version__ = '%s'" % VERSION)
setup(
name = "autopsy",
version = VERSION,
author = "Jaroslav Klapálek",
author_email = "[email protected]",
description = ("A set of Python utils for F1Tenth project."),
license = "GPLv3",
keywords = "f1tenth autonomous car ros robot",
#url = "http://packages.python.org/an_example_pypi_project",
packages=find_packages(),
#long_description=read('README'),
data_files=[
("share/ament_index/resource_index/packages",
["resource/autopsy"]),
("share/autopsy", ["package.xml"]),
],
install_requires=["setuptools"],
classifiers=[
"Development Status :: 4 - Beta",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Programming Language :: Python",
"Topic :: Scientific/Engineering",
],
extras_require={
"ros1": "rospy",
"ros2": "rclpy",
},
)