-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathsetup.py
More file actions
69 lines (59 loc) · 2.19 KB
/
setup.py
File metadata and controls
69 lines (59 loc) · 2.19 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
from setuptools import setup
import sys
from os.path import dirname, exists, join
import subprocess
base_package = "dslogparser"
setup_dir = dirname(__file__)
git_dir = join(setup_dir, ".git")
version_file = join(setup_dir, base_package, "version.py")
# Automatically generate a version.py based on the git version
if exists(git_dir):
p = subprocess.Popen(
["git", "describe", "--tags", "--long", "--dirty=-dirty"],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
)
out, err = p.communicate()
# Make sure the git version has at least one tag
if err:
print("Error: You need to create a tag for this repo to use the builder")
sys.exit(1)
# Convert git version to PEP440 compliant version
# - Older versions of pip choke on local identifiers, so we can't include the git commit
v, commits, local = out.decode("utf-8").rstrip().split("-", 2)
if commits != "0" or "-dirty" in local:
v = "%s.post0.dev%s" % (v, commits)
# Create the version.py file
with open(version_file, "w") as fp:
fp.write("# Autogenerated by setup.py\n__version__ = '{0}'\n".format(v))
if exists(version_file):
with open(join(setup_dir, base_package, "version.py"), "r") as fp:
exec(fp.read(), globals())
else:
__version__ = "master"
# read the contents of your README file
with open(join(setup_dir, 'README-dslogparser.md'), encoding='utf-8') as f:
long_description = f.read()
setup(
name=base_package,
version=__version__,
description='FIRST FRC Driver Station logs parser',
author='Paul Rensing',
author_email='prensing@ligerbots.org',
long_description=long_description,
long_description_content_type='text/markdown',
url='http://github.com/ligerbots/dslogparser',
license='MIT',
packages=['dslogparser'],
scripts=['dslog2csv.py'],
install_requires=['bitstring'],
keywords=['FRC', 'logfiles'],
classifiers=[
'Development Status :: 5 - Production/Stable',
'Environment :: Console',
'Intended Audience :: Developers',
'Intended Audience :: Education',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python :: 3',
]
)