Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
108 lines (90 loc) · 2.69 KB

File metadata and controls

108 lines (90 loc) · 2.69 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
#!/usr/bin/env python
import sys
import os
import os.path
import warnings
from setuptools import setup, Extension
import numpy
platform_supported = False
lib_talib_name = 'ta-lib' # the name as of TA-Lib 0.6.1
if any(s in sys.platform for s in ['darwin', 'linux', 'bsd', 'sunos']):
platform_supported = True
include_dirs = [
'/usr/include',
'/usr/local/include',
'/opt/include',
'/opt/local/include',
'/opt/homebrew/include',
'/opt/homebrew/opt/ta-lib/include',
]
library_dirs = [
'/usr/lib',
'/usr/local/lib',
'/usr/lib64',
'/usr/local/lib64',
'/opt/lib',
'/opt/local/lib',
'/opt/homebrew/lib',
'/opt/homebrew/opt/ta-lib/lib',
]
elif sys.platform == "win32":
platform_supported = True
lib_talib_name = 'ta-lib-static'
include_dirs = [
r"c:\ta-lib\c\include",
r"c:\Program Files\TA-Lib\include",
r"c:\Program Files (x86)\TA-Lib\include",
]
library_dirs = [
r"c:\ta-lib\c\lib",
r"c:\Program Files\TA-Lib\lib",
r"c:\Program Files (x86)\TA-Lib\lib",
]
if 'TA_INCLUDE_PATH' in os.environ:
include_dirs = os.environ['TA_INCLUDE_PATH'].split(os.pathsep)
if 'TA_LIBRARY_PATH' in os.environ:
library_dirs = os.environ['TA_LIBRARY_PATH'].split(os.pathsep)
if not platform_supported:
raise NotImplementedError(sys.platform)
for path in library_dirs:
try:
files = os.listdir(path)
if any(lib_talib_name in f for f in files):
break
except OSError:
pass
else:
warnings.warn('Cannot find ta-lib library, installation may fail.')
# Get the Cython build_ext or fall back to setuptools build_ext
try:
from Cython.Distutils import build_ext
has_cython = True
except ImportError:
from setuptools.command.build_ext import build_ext
has_cython = False
class NumpyBuildExt(build_ext):
"""
Custom build_ext command that adds numpy's include_dir to extensions.
"""
def build_extensions(self):
"""
Add numpy's include directory to Extension includes.
"""
numpy_incl = numpy.get_include()
for ext in self.extensions:
ext.include_dirs.append(numpy_incl)
super().build_extensions()
cmdclass = {'build_ext': NumpyBuildExt}
ext_modules = [
Extension(
'talib._ta_lib',
['talib/_ta_lib.pyx' if has_cython else 'talib/_ta_lib.c'],
include_dirs=include_dirs,
library_dirs=library_dirs,
libraries=[lib_talib_name],
runtime_library_dirs=[] if sys.platform == 'win32' else library_dirs)
]
setup(
ext_modules=ext_modules,
cmdclass=cmdclass,
)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.