forked from hthiery/python-lacrosse
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
79 lines (73 loc) · 2.73 KB
/
setup.py
File metadata and controls
79 lines (73 loc) · 2.73 KB
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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
import os
import re
import subprocess
name = 'pylacrosse'
version_py = os.path.join(os.path.dirname(__file__), name, 'version.py')
def get_version():
"""Get version from git tags or provide fallback."""
try:
git_version = subprocess.check_output(
['git', 'describe', '--tags', '--always', '--dirty'],
stderr=subprocess.STDOUT).rstrip().decode('ascii')
# Check if we got a tag (contains '-') or just a commit hash
if '-' in git_version or git_version.startswith('v'):
return git_version
else:
# No tags found, return development version
return '0.4.0.dev0+' + git_version
except (OSError, subprocess.CalledProcessError):
return None
try:
version = get_version()
if version:
with open(version_py, 'w') as f:
f.write('# This file was autogenerated by setup.py\n')
f.write('__version__ = \'%s\'\n' % (version,))
else:
raise IOError("Could not get version from git")
except (OSError, IOError) as e:
try:
with open(version_py, 'r') as f:
for line in f.readlines():
val = re.findall("__version__ = '([^']+)'", line)
version = val[0]
except (IOError, IndexError):
version = '0.4.0'
with open('README.rst') as f:
readme = f.read()
setup(name = name,
version = version,
description = 'LaCrosse sensor library',
long_description = readme,
author = 'Heiko Thiery',
author_email = 'heiko.thiery@gmail.com',
packages = find_packages(exclude=('tests', 'tests.*')),
url = 'http://github.com/hthiery/python-lacrosse',
license = 'LGPLv2+',
classifiers = [
'Development Status :: 3 - Alpha',
'Environment :: Console',
'License :: OSI Approved :: GNU Lesser General Public License v2 or later (LGPLv2+)',
'Natural Language :: English',
'Operating System :: OS Independent',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Topic :: Software Development :: Libraries :: Python Modules',
],
python_requires='>=3.8',
entry_points = {
'console_scripts': [
'pylacrosse= pylacrosse.cli_tool:main',
]
},
test_suite = 'tests',
include_package_data = True,
install_requires=['pyserial'],
)