forked from ros-infrastructure/superflore
-
Notifications
You must be signed in to change notification settings - Fork 4
/
setup.py
executable file
·93 lines (85 loc) · 3.16 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
#!/usr/bin/env python
import sys
from setuptools import find_packages, setup
"""
Returns <public_version> appended with a PEP-440 compliant local version label
(see https://www.python.org/dev/peps/pep-0440/#local-version-identifiers). The
local version label is based on the output from
"git describe --tags --dirty --broken". Nothing is appended if:
- Git is not available, or
- "git describe" might not be operating on a branch of superflore.git, or
- there is no tag for <public_version>, or
- the HEAD of the current branch is coincident with the tag for <public_version>.
NB. Not using https://pypi.org/project/setuptools-git-version/ because it passes
"--long" to "git describe" and doesn't pass "--broken".
"""
def append_local_version_label(public_version):
try:
from git import Repo
from os import getcwd
from os.path import join, samefile
repo = Repo()
"""
If we're been copied under the working dir of some other Git repo,
"git describe" won't return what we're expecting, so don't append
anything. The test for this case will also fail if, say, we try to
invoke ../setup.py from a subdirectory, but it's better to err on the
side of "least surprises".
"""
if not samefile(repo.git_dir, join(getcwd(), '.git')):
return public_version
# The tags have a "v" prefix.
val = repo.git.describe(
'--match', 'v' + public_version, '--tags', '--dirty', '--broken')
"""
Output from "git describe --tags --dirty --broken" is
<TAG>[-<NR-OF-COMMITS>-g<ABBRE-HASH>][-dirty][-broken]
Convert to a legal Python local version label, dropping the "v" prefix
of the tag.
"""
return val.replace('-', '+', 1).replace('-', '.')[1:]
except:
return public_version
if sys.version_info < (3, 0):
sys.exit('Sorry, Python < 3.0 is not supported')
install_requires = [
'xmltodict',
'termcolor',
'setuptools',
'rosinstall_generator',
'rosdistro >= 0.7.4',
'rosdep >= 0.15.2',
'gitpython',
'requests',
'docker',
'pyyaml',
'pygithub',
'catkin_pkg >= 0.4.10',
'rospkg >= 1.1.8',
]
setup(
name='superflore',
version=append_local_version_label('0.3.3'),
packages=find_packages(exclude=['tests', 'tests.*']),
author='Hunter L. Allen',
author_email='[email protected]',
url='https://github.com/ros-infrastructure/superflore',
keywords=['ROS'],
install_requires=install_requires,
python_requires='>=3',
classifiers=['Programming Language :: Python',
'License :: OSI Approved :: Apache Software License',
'License :: OSI Approved :: MIT License'
],
description='Super Bloom',
license='Apache 2.0',
test_suite='tests',
entry_points={
'console_scripts': [
'superflore-gen-ebuilds = superflore.generators.ebuild:main',
'superflore-gen-oe-recipes = superflore.generators.bitbake:main',
'superflore-gen-nix = superflore.generators.nix:main',
'superflore-check-ebuilds = superflore.test_integration.gentoo:main',
]
}
)