forked from soft-matter/trackpy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
106 lines (91 loc) · 2.78 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# This downloads and install setuptools if it is not installed.
from ez_setup import use_setuptools
use_setuptools()
import os
import sys
import warnings
# try bootstrapping setuptools if it doesn't exist
try:
import pkg_resources
try:
pkg_resources.require("setuptools>=0.6c5")
except pkg_resources.VersionConflict:
from ez_setup import use_setuptools
use_setuptools(version="0.6c5")
from setuptools import setup, Extension
_have_setuptools = True
except ImportError:
# no setuptools installed
from numpy.distutils.core import setup
_have_setuptools = False
MAJOR = 0
MINOR = 2
MICRO = 1
ISRELEASED = True
VERSION = '%d.%d.%d' % (MAJOR, MINOR, MICRO)
QUALIFIER = ''
FULLVERSION = VERSION
print FULLVERSION
if not ISRELEASED:
import subprocess
FULLVERSION += '.dev'
pipe = None
for cmd in ['git', 'git.cmd']:
try:
pipe = subprocess.Popen([cmd, "describe", "--always",
"--match", "v[0-9\/]*"],
stdout=subprocess.PIPE)
(so, serr) = pip.communicate()
if pipe.returncode == 0:
break
except:
pass
if pipe is None or pipe.returncode != 0:
warnings.warn("WARNING: Couldn't get git revision, "
"using generic version string")
else:
rev = so.strip()
# makes distutils blow up on Python 2.7
if sys.version_info[0] >= 3:
rev = rev.decode('ascii')
# use result of git describe as version string
FULLVERSION = rev.lstrip('v')
else:
FULLVERSION += QUALIFIER
def write_version_py(filename=None):
cnt = """\
version = '%s'
short_version = '%s'
"""
if not filename:
filename = os.path.join(
os.path.dirname(__file__), 'trackpy', 'version.py')
a = open(filename, 'w')
try:
a.write(cnt % (FULLVERSION, VERSION))
finally:
a.close()
write_version_py()
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
# In some cases, the numpy include path is not present by default.
# Let's try to obtain it.
try:
import numpy
except ImportError:
ext_include_dirs = []
else:
ext_include_dirs = [numpy.get_include(),]
setup_parameters = dict(
name = "trackpy",
version = FULLVERSION,
description = "particle-tracking toolkit",
author = "Daniel Allan and Thomas Caswell",
author_email = "[email protected]",
url = "https://github.com/soft-matter/trackpy",
install_requires = ['numpy', 'scipy', 'six', 'pandas',
'pyyaml', 'matplotlib', 'pims'],
packages = ['trackpy'],
long_description = read('README.md'),
)
setup(**setup_parameters)