-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathsetup.py
165 lines (146 loc) · 5.37 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
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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Setup script for pyfli.
"""
import numpy as np
import os
import platform
from distutils.core import setup
from distutils.extension import Extension
from distutils.command.build_ext import build_ext
system = platform.system()
flicom = "libfli-1.104"
fliwin = os.path.join(flicom, "windows")
fliunx = os.path.join(flicom, "unix")
flilin = os.path.join(fliunx, "linux")
flibsd = os.path.join(fliunx, "bsd")
fliosx = os.path.join(fliunx, "osx")
comsrc = [
os.path.join(flicom, "libfli.c"),
os.path.join(flicom, "libfli-camera.c"),
os.path.join(flicom, "libfli-camera-parport.c"),
os.path.join(flicom, "libfli-camera-usb.c"),
os.path.join(flicom, "libfli-filter-focuser.c"),
os.path.join(flicom, "libfli-mem.c")
]
unxsrc = [
os.path.join(fliunx, "libfli-serial.c"),
os.path.join(fliunx, "libfli-debug.c"),
os.path.join(fliunx, "libfli-usb.c"),
os.path.join(fliunx, "libfli-sys.c")
]
winsrc = [
os.path.join(fliwin, "libfli-serial.c"),
os.path.join(fliwin, "libfli-debug.c"),
os.path.join(fliwin, "libfli-usb.c"),
os.path.join(fliwin, "libfli-windows.c"),
os.path.join(fliwin, "libfli-windows-parport.c"),
os.path.join(flicom, "libfli-raw.c")
]
linsrc = [
os.path.join(flilin, "libfli-usb-sys.c"),
os.path.join(flilin, "libfli-parport.c")
]
bsdsrc = [
os.path.join(flibsd, "libfli-usb-sys.c")
]
osxsrc = [
]
modpth = "pyfli"
modsrc = [os.path.join(modpth, "pyfli.c")]
if system == "Linux":
src = modsrc + comsrc + unxsrc + linsrc
inc = [np.get_include(), modpth, flicom, fliunx, flilin]
lib = []
mac = []
elif system == "BSD":
# not certain that BSD is the correct identifier
src = modsrc + comsrc + unxsrc + bsdsrc
inc = [np.get_include(), modpth, flicom, fliunx, flibsd]
lib = []
mac = []
elif system == "Darwin":
src = modsrc + comsrc + unxsrc + osxsrc
inc = [np.get_include(), modpth, flicom, fliunx, fliosx]
lib = []
mac = []
elif system == "Windows":
src = modsrc + comsrc + winsrc
inc = [np.get_include(), modpth, flicom, fliwin]
lib = ["setupapi", "msvcrt" , "ws2_32", "Advapi32"]
mac = [("_LIB", None)]
else:
raise RuntimeError("Unrecognized system")
compiler_settings = {
'libraries' : lib,
'include_dirs' : inc,
'library_dirs' : [],
'define_macros' : mac,
'export_symbols' : None
}
package_data = {'pyfli': ['*.pyx']}
ext_modules = [Extension('pyfli', src, **compiler_settings)]
setup(
name = "pyfli",
version = "0.1",
author = "Charles R. Harris",
author_email = "[email protected]",
download_url = " ",
keywords = ["FLI", "fli"],
description = "Python wrapper for Finger Lakes Instrumention SDK",
package_data = package_data,
ext_modules = ext_modules,
requires = ['numpy (>=1.5)'],
cmdclass = {'build_ext': build_ext},
classifiers = [
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: BSD License",
"Operating System :: POSIX :: Linux",
"Operating System :: Microsoft :: Windows",
"Operating System :: Microsoft :: Windows :: Windows 7",
"Programming Language :: Python",
"Programming Language :: Python :: 2.6",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Cython",
"Topic :: Scientific/Engineering",
"Topic :: Scientific/Engineering :: Astronomy",
"Topic :: Software Development :: Libraries :: Python Modules"
],
long_description = """\
This package supplies Python wrappers for the functions in the Finger Lakes
Instrumentation SDK libfli-1.104 on Linux and Windows. It exposes all the
public functions and macros with the following exceptions:
FLICreateList
FLIDeleteList
FLIListFirst
FLIListNext
FLISetDAC
FLIDebug
The wrapper for FLIUsbBulkIO is currently set to raise an error as I don't
yet understand the implications of the function and it looks potentially
dangerous.
The wrapper signatures are not precisely the same as the Finger Lakes
functions. For instance, functions that fill user supplied buffers return
numpy arrays instead, C strings are returned as Python strings, and some
arguments are passed as strings instead of C macro values. In addition, the
wrapper function names generally drop the 'FLI' prefix and lowercase the
first letter. The function correspondence is tabulate in the module
documentation.
All the wrappers have document strings that follow the numpy documentation
standard. Some of the functions in the SDK were undocumented and
FLIGrabFrame was a stub. In the first case the lack of documentation is
noted, and in the second, FLIGrabFrame was implemented in a way that
seemed appropriate to its name.
Some of the functions require knowledge of the ADC precision and may
segfault if it is incorrectly specified. Finger Lakes doesn't currently
provide a way to determine the operative precision, so it is up to the user
to be careful and track the precision in use. The default value of the
relevant argument has been set to 16 bits, which is safe but will not
provide the expected results for 8 bit devices.
The required numpy version is conservative and earlier versions
will probably work, but they haven't been tested.
"""
)