This repository has been archived by the owner on Sep 11, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
setup.py
executable file
·52 lines (43 loc) · 1.67 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
#!/usr/bin/env python3
from os.path import dirname, exists, join
import sys, subprocess
from setuptools import setup
setup_dir = dirname(__file__)
base_package = 'nivision'
version_file = join(setup_dir, base_package, 'version.py')
# Automatically generate a version.py based on the git version
if exists(join(setup_dir, '.git')):
p = subprocess.Popen(["git", "describe", "--tags", "--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)
# Create the version.py file
with open(version_file, 'w') as fp:
fp.write("# Autogenerated by setup.py\n__version__ = '{0}'".format(out.decode('utf-8').rstrip()))
if exists(version_file):
with open(version_file, 'r') as fp:
exec(fp.read(), globals())
else:
__version__ = "master"
# Check for generated files
core_file = join(setup_dir, base_package, 'core.py')
if not exists(core_file):
print("Error: You need to run generate.sh or gen_wrap.py")
sys.exit(1)
with open(join(setup_dir, 'README.rst'), 'r') as readme_file:
long_description = readme_file.read()
setup(name='pynivision',
version=__version__,
description='Python Wrappers for NI Vision and IMAQdx',
long_description=long_description,
author='Peter Johnson',
author_email='robotpy@googlegroups.com',
url='https://github.com/robotpy/pynivision',
keywords='frc first robotics wpilib nivision imaqdx vision imaq',
packages=[base_package],
license='BSD',
)