-
Notifications
You must be signed in to change notification settings - Fork 8
/
setup.py
executable file
·116 lines (96 loc) · 3.31 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
107
108
109
110
111
112
113
114
115
116
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
from setuptools import setup
from setuptools.command.test import test as TestCommand
import codecs
import os
import re
here = os.path.abspath(os.path.dirname(__file__))
def read(*parts):
# intentionally *not* adding an encoding option to open
return codecs.open(os.path.join(here, *parts), 'r').read()
def read(*parts):
# intentionally *not* adding an encoding option to open
return codecs.open(os.path.join(here, *parts), 'r').read()
def find_version(*file_paths):
version_file = read(*file_paths)
version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]",
version_file, re.M)
if version_match:
return version_match.group(1)
raise RuntimeError("Unable to find version string.")
long_description = read('README.rst')
def check_dependencies():
import os
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
if on_rtd:
return
# Just make sure dependencies exist, I haven't rigorously
# tested what the minimal versions that will work are
# (help on that would be awesome)
try:
import numpy
except ImportError:
raise ImportError("pambox requires numpy")
try:
import scipy
except ImportError:
raise ImportError("pambox requires scipy")
try:
import matplotlib
except ImportError:
raise ImportError("pambox requires matplotlib")
try:
import pandas
except ImportError:
raise ImportError("pambox requires pandas")
class PyTest(TestCommand):
def finalize_options(self):
TestCommand.finalize_options(self)
self.test_args = ['--runslow', 'pambox/tests']
self.test_suite = True
def run_tests(self):
import pytest
errcode = pytest.main(self.test_args)
sys.exit(errcode)
if __name__ == '__main__':
import sys
if not (len(sys.argv) >= 2 and ('--help' in sys.argv[1:] or
sys.argv[1] in ('--help-commands', 'egg_info', '--version',
'clean'))):
check_dependencies()
setup(
name='pambox',
description='A Python toolbox for auditory modeling',
author='Alexandre Chabot-Leclerc',
author_email='pambox@alex.alexchabot.net',
version=find_version('pambox', '__init__.py'),
url='https://bitbucket.org/achabotl/pambox',
license='Modified BSD License',
tests_require=['pytest'],
install_requires=[
'six>=1.4.1',
],
cmdclass={'test': PyTest},
long_description=long_description,
packages=['pambox'],
include_package_data=True,
platforms='any',
test_suite='pambox.tests',
classifiers=[
'Development Status :: 3 - Alpha',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: BSD License',
'Natural Language :: English',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.4',
'Topic :: Scientific/Engineering',
'Operating System :: POSIX',
'Operating System :: Unix',
'Operating System :: MacOS'
],
extras_require={
'testing': ['pytest']
}
)