-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathsetup.py
52 lines (44 loc) · 1.57 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
#!/usr/bin/env python
from setuptools import setup, find_packages
import os
import subprocess
name = 'osccap'
version_py = os.path.join(os.path.dirname(__file__), 'osccap', 'version.py')
def git_pep440_version():
full = subprocess.check_output(
['git', 'describe', '--tags', '--always', '--dirty=.dirty'],
stderr=subprocess.STDOUT).decode().strip()
tag = subprocess.check_output(
['git', 'describe', '--tags', '--always', '--abbrev=0'],
stderr=subprocess.STDOUT).decode().strip()
tail = full[len(tag):]
return tag + tail.replace('-', '.dev', 1).replace('-', '+', 1)
try:
version = git_pep440_version()
with open(version_py, 'w') as f:
f.write('# This file was autogenerated by setup.py\n')
f.write('__version__ = \'%s\'\n' % (version,))
except (OSError, subprocess.CalledProcessError, IOError):
try:
with open(version_py, 'r') as f:
d = dict()
exec(f.read(), d)
version = d['__version__']
except IOError:
version = 'unknown'
setup(name=name,
version=version,
description='Capture screenshot from digital oscilloscopes.',
author_email='[email protected]',
options={
'bdist_wininst': {'install_script': 'osccap_postinstall.py'},
'bdist_msi': {'install_script': 'osccap_postinstall.py'},
},
install_requires=[
'wxpython',
'numpy'
],
packages=find_packages(),
package_data={'osccap': ['data/*.png', 'data/osccap.ico']},
scripts=['osccap_postinstall.py'],
)