-
Notifications
You must be signed in to change notification settings - Fork 5
/
setup.py
79 lines (69 loc) · 2.71 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
# -*- encoding: utf-8 -*-
import os
import sys
from setuptools import setup, find_packages
from setuptools.command.build_ext import build_ext
import codecs
import os.path
def read(rel_path):
here = os.path.abspath(os.path.dirname(__file__))
with codecs.open(os.path.join(here, rel_path), 'r') as fp:
return fp.read()
def get_version(rel_path):
for line in read(rel_path).splitlines():
if line.startswith('__version__'):
delim = '"' if '"' in line else "'"
return line.split(delim)[1]
else:
raise RuntimeError("Unable to find version string.")
if sys.version_info < (3, 5):
raise ValueError(
'Unsupported Python version %d.%d.%d found. Mosaic requires Python '
'3.5 or higher.' % (sys.version_info.major, sys.version_info.minor, sys.version_info.micro)
)
class BuildExt(build_ext):
""" build_ext command for use when numpy headers are needed.
SEE tutorial: https://stackoverflow.com/questions/2379898
SEE fix: https://stackoverflow.com/questions/19919905
"""
def finalize_options(self):
build_ext.finalize_options(self)
# Prevent numpy from thinking it is still in its setup process:
# __builtins__.__NUMPY_SETUP__ = False
import numpy
self.include_dirs.append(numpy.get_include())
HERE = os.path.abspath(os.path.dirname(__file__))
setup_reqs = ['Cython', 'numpy']
with open(os.path.join(HERE, 'requirements.txt')) as fp:
install_reqs = [r.rstrip() for r in fp.readlines()
if not r.startswith('#') and not r.startswith('git+')]
setup(
name='mosaic',
author='Herilalaina Rakotoarison',
author_email='herilalaina.rakotoarison@inria.fr',
description='Monte-Carlo Tree Search for Algorithm Configuration.',
version=get_version("mosaic/__init__.py"),
cmdclass={'build_ext': BuildExt},
packages=find_packages(exclude=['examples']),
setup_requires=setup_reqs,
install_requires=install_reqs,
include_package_data=True,
license='BSD',
platforms=['Linux'],
classifiers=[
"Environment :: Console",
"Intended Audience :: Developers",
"Intended Audience :: Education",
"Intended Audience :: Science/Research",
"Intended Audience :: Information Technology",
"License :: OSI Approved :: BSD License",
"Natural Language :: English",
"Operating System :: OS Independent",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
"Topic :: Scientific/Engineering :: Information Analysis",
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
],
python_requires='>=3.5.*',
)