-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
95 lines (71 loc) · 2.56 KB
/
setup.py
File metadata and controls
95 lines (71 loc) · 2.56 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
from setuptools import setup, find_packages
import os
# Taken from setup.py in seaborn.
# temporarily redirect config directory to prevent matplotlib importing
# testing that for writeable directory which results in sandbox error in
# certain easy_install versions
os.environ["MPLCONFIGDIR"]="."
DESCRIPTION = 'Package for analysis of ESPRESSO experiments'
LONG_DESCRIPTION = """\
This Python package enables analysis of feeding experiments done on the
ESPRESSO rigs, and monitored via CRITTA.
For use in the Claridge-Chang lab.
"""
# Modified from from setup.py in seaborn.
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
def need_to_install(module, version):
desired_major_version = int(version.split('.')[0])
desired_minor_version = int(version.split('.')[1])
try:
desired_patch = int(version.split('.')[2])
patch_stated = True
except IndexError:
patch_stated = False
INSTALLED_VERSION_MAJOR = int(module.__version__.split('.')[0])
INSTALLED_VERSION_MINOR = int(module.__version__.split('.')[1])
try:
INSTALLED_VERSION_PATCH = int(version.split('.')[2])
except IndexError:
pass
if INSTALLED_VERSION_MAJOR < desired_major_version:
return True
elif INSTALLED_VERSION_MAJOR == desired_major_version and \
INSTALLED_VERSION_MINOR < desired_minor_version:
return True
elif patch_stated is True and INSTALLED_VERSION_PATCH < desired_patch:
return True
else:
return False
def check_dependencies():
from importlib import import_module
modules = {'numpy' : '1.15',
'scipy' : '1.2',
'pandas' : '0.24',
'matplotlib' : '3.0',
'seaborn' : '0.9',
'dabest' : '0.2.2'}
to_install = []
for module, version in modules.items():
try:
my_module = import_module(module)
if need_to_install(my_module, version):
to_install.append("{}>={}".format(module, version))
except ImportError:
to_install.append("{}>={}".format(module, version))
return to_install
if __name__=="__main__":
installs=check_dependencies()
setup(
name='espresso',
author='Joses Ho',
author_email='joseshowh@gmail.com',
version='0.7.3',
description=DESCRIPTION,
long_description=LONG_DESCRIPTION,
packages=find_packages(),
install_requires=installs,
url='https://www.github.com/ACCLAB/espresso',
)