forked from ap--/python-seabreeze
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
60 lines (56 loc) · 1.99 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
# -*- coding: utf-8 -*-
from setuptools import setup
from distutils.extension import Extension
from distutils.version import LooseVersion
import platform
import sys
import warnings
if "--without-cseabreeze" in sys.argv:
sys.argv.remove("--without-cseabreeze") # this is a hack...
# user requests to not install cython wrapper
_extensions = []
else:
# default to building the cython wrapper
try:
# try to import cython
import Cython
# We require at least version 0.18
if LooseVersion(Cython.__version__) < LooseVersion("0.18"):
raise ImportError("Cython version < 0.18")
except ImportError:
# if not installed or too old fall back to the provided C file
cythonize = lambda x: x
fn_ext = "c"
else:
from Cython.Build import cythonize
fn_ext = "pyx"
# The windows version of the cython wrapper depends on winusb
if platform.system() == "Windows":
libs = ['seabreeze', 'winusb']
elif platform.system() == "Darwin":
libs = ['seabreeze']
else:
libs = ['seabreeze', 'usb']
# define extension
extensions = [Extension('seabreeze.cseabreeze.wrapper',
['./seabreeze/cseabreeze/wrapper.%s' % fn_ext],
libraries=libs,
)]
_extensions = cythonize(extensions)
setup(
name='seabreeze',
version='0.5.3',
author='Andreas Poehlmann',
author_email='mail@andreaspoehlmann.de',
packages=['seabreeze',
'seabreeze.cseabreeze',
'seabreeze.pyseabreeze',
'seabreeze.pyseabreeze.interfaces'],
scripts=['scripts/seabreeze-compare'],
description=('Python interface module for oceanoptics spectrometers. '
'This software is not associated with Ocean Optics. '
'Use it at your own risk.'),
long_description=open('README.md').read(),
requires=['python (>= 2.7)', 'pyusb (>= 1.0)', 'numpy'],
ext_modules=_extensions,
)