-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetup_pip.py
70 lines (59 loc) · 2.39 KB
/
setup_pip.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
"""
C2 DATA VIEWER is distributed subject to a Software License Agreement found
in the file LICENSE that is included with this distribution.
SPDX-License-Identifier: EPICS
"""
import subprocess
import re
from setuptools import setup, find_packages
def get_version():
"""
Get version from the git repository in the following format (This should be compatible with PEP440):
- If the current commit has a tag and no uncommitted changes function will return only tag as a string.
- If the current commit doesn't have a tag or there are uncommitted changes, version string will look like:
<last tag in the current development line>_<offset of the last commit from the last tag>_<last commit>[<_dirty if there are uncommitted changes>]
"""
try:
version_git = subprocess.check_output(["git", "describe", "--tags", "--long", "--dirty"]).rstrip()
match = re.search(r'(.*)-(\d+)-g([0-9,a-f]{7})-?(dirty)?', version_git.decode())
version = match[1]
tagOffset = int(match[2])
hash = match[3]
dirty = match[4]
if tagOffset == 0 and not dirty:
VERSION = version
else:
VERSION = f"{version}+{tagOffset}.{hash}{'.' if dirty else ''}{dirty if dirty else ''}"
except:
print(f"Error: Can not determinate version from git. Using default value of '0.0.1'")
VERSION = "0.0.1"
return VERSION
with open('README.md', 'r', encoding='utf-8') as f:
long_description = f.read()
setup (
name = "c2dataviewer",
version = get_version(),
author = "G. Shen",
author_email = "[email protected]",
description = "Python based data viewer for next generation of APS control system (C2)",
long_description = long_description,
long_description_content_type = "text/markdown",
url = "https://github.com/epics-extensions/c2dataviewer",
license = "EPICS",
packages = find_packages(),
package_data = {'c2dataviewer': ['c2dv.cfg', '**/*.ui']},
include_package_data = True,
install_requires=[
'psutil',
'pvapy',
'pyqtgraph==0.12.4',
'PyQt5',
],
extras_require = {
'blosc-compression' : ['blosc'],
'lz4-compression' : ['lz4'],
'bslz4-compression' : ['bitshuffle'],
'all' : ['blosc', 'lz4', 'bitshuffle'],
},
entry_points = {'console_scripts': ['c2dv=c2dataviewer.c2dv:main']},
)