forked from CLIVAR-PRP/ENSO_metrics
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
executable file
·49 lines (44 loc) · 1.11 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
from distutils.core import setup
import subprocess
import glob
Version="0.1"
p = subprocess.Popen(
("git",
"describe",
"--tags"),
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
try:
descr = p.stdout.readlines()[0].strip()
Version = "-".join(descr.split("-")[:-2])
if Version == "":
Version = descr
except:
descr = Version
p = subprocess.Popen(
("git",
"log",
"-n1",
"--pretty=short"),
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
try:
commit = p.stdout.readlines()[0].split()[1]
except:
commit = ""
f = open("lib/version.py", "w")
print >>f, "__version__ = '%s'" % Version
print >>f, "__git_tag_describe__ = '%s'" % descr
print >>f, "__git_sha1__ = '%s'" % commit
f.close()
setup (name = "EnsoMetrics",
author="Eric Guilyardi",
version=Version,
description = "Library for ENSO Metrics",
url = "https://github.com/eguil/ENSO_metrics",
packages = ['EnsoMetrics'],
package_dir = {'EnsoMetrics': 'lib'},
scripts= glob.glob("scripts/*.py"),
)