-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsetup.py
More file actions
executable file
·178 lines (155 loc) · 5.07 KB
/
setup.py
File metadata and controls
executable file
·178 lines (155 loc) · 5.07 KB
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
#!/usr/bin/env python
"""
Parts of this file were taken from the pandas project
(https://github.com/pyData/pandas)
and the pytz which have been permitted for use under the
BSD license. Parts are from lxml (https://github.com/lx)
"""
import os
import warnings
import sys
import re
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
_have_setuptools = True
except ImportError:
# no setuptools installed
from distutils.core import setup
_have_setuptools = False
setuptools_kwargs = {}
DISTNAME = 'finCal'
LONG_DESCRIPTION = '''\
finCal creates calendar for stock and futures exchanges
'''
DESCRIPTION = LONG_DESCRIPTION
LICENSE = 'BSD'
AUTHOR = "The PyData Development Team"
EMAIL = "pydata@googlegroups.com"
URL = "http://pandas.pydata.org"
DOWNLOAD_URL = ''
CLASSIFIERS = [
'Development Status :: 4 - Beta',
'Environment :: Console',
'Operating System :: OS Independent',
'Intended Audience :: Science/Research',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.2',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Cython',
'Topic :: Scientific/Engineering',
]
packages = ['finCal']
MAJOR = 0
MINOR = 0
MICRO = 1
ISRELEASED = False
VERSION = '%d.%d.%d' % (MAJOR, MINOR, MICRO)
QUALIFIER = ''
FULLVERSION = VERSION
write_version = True
min_pandas_ver = '0.14.1'
if sys.version_info[0] >= 3:
setuptools_kwargs = {'install_requires': ['python-dateutil',
'pytz >= 2011k',
'pandas >= %s' % min_pandas_ver]
}
if not _have_setuptools:
sys.exit("need setuptools/distribute for Py3k"
"\n$ pip install distribute")
else:
setuptools_kwargs = {
'install_requires': ['python-dateutil',
'ephem',
'pytz >= 2011k',
'pandas >= %s' % min_pandas_ver],
'zip_safe': True,
}
if not _have_setuptools:
try:
import pandas
import dateutil
setuptools_kwargs = {}
except ImportError:
sys.exit("install requires: 'python-dateutil < 2','pandas'."
" use pip or easy_install."
"\n $ pip install 'python-dateutil < 2' 'pandas'")
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) = pipe.communicate()
if pipe.returncode == 0:
break
except:
pass
if pipe is None or pipe.returncode != 0:
# no git, or not in git dir
if os.path.exists('finCal/version.py'):
warnings.warn("WARNING: Couldn't get git revision" +
"using existing finCal/version.py")
write_version = False
else:
warnings.warn("WARNING: Couldn't get git revision" +
"using generic version string")
else:
# have git, in git dir, but may have used a shallow clone (travis does
# this)
rev = so.strip()
# makes distutils blow up on Python 2.7
if sys.version_info[0] >= 3:
rev = rev.decode('ascii')
if not rev.startswith('v') and re.match("[a-zA-Z0-9]{7,9}", rev):
# partial clone, manually construct version string
# this is the format before we started using git-describe
# to get an ordering on dev version strings.
rev = "v%s.dev-%s" % (VERSION, rev)
# Strip leading v from tags format "vx.y.z" to get th 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__), 'finCal', 'version.py')
a = open(filename, 'w')
try:
a.write(cnt % (FULLVERSION, VERSION))
finally:
a.close()
if write_version:
write_version_py()
if _have_setuptools:
setuptools_kwargs["test_suite"] = "nose.collector"
setup(name=DISTNAME,
version=FULLVERSION,
maintainer=AUTHOR,
packages=['finCal'],
maintainer_email=EMAIL,
description=DESCRIPTION,
license=LICENSE,
url=URL,
download_url=DOWNLOAD_URL,
long_description=LONG_DESCRIPTION,
classifiers=CLASSIFIERS,
platforms='any',
**setuptools_kwargs)