ndtypes 0.2.0dev4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CONTRIBUTING.md +50 -0
- data/Gemfile +2 -0
- data/History.md +0 -0
- data/README.md +19 -0
- data/Rakefile +125 -0
- data/ext/ruby_ndtypes/extconf.rb +55 -0
- data/ext/ruby_ndtypes/gc_guard.c +36 -0
- data/ext/ruby_ndtypes/gc_guard.h +12 -0
- data/ext/ruby_ndtypes/ndtypes/AUTHORS.txt +5 -0
- data/ext/ruby_ndtypes/ndtypes/INSTALL.txt +101 -0
- data/ext/ruby_ndtypes/ndtypes/LICENSE.txt +29 -0
- data/ext/ruby_ndtypes/ndtypes/MANIFEST.in +3 -0
- data/ext/ruby_ndtypes/ndtypes/Makefile.in +87 -0
- data/ext/ruby_ndtypes/ndtypes/README.rst +47 -0
- data/ext/ruby_ndtypes/ndtypes/config.guess +1530 -0
- data/ext/ruby_ndtypes/ndtypes/config.h.in +67 -0
- data/ext/ruby_ndtypes/ndtypes/config.sub +1782 -0
- data/ext/ruby_ndtypes/ndtypes/configure +5260 -0
- data/ext/ruby_ndtypes/ndtypes/configure.ac +161 -0
- data/ext/ruby_ndtypes/ndtypes/doc/Makefile +14 -0
- data/ext/ruby_ndtypes/ndtypes/doc/_static/copybutton.js +66 -0
- data/ext/ruby_ndtypes/ndtypes/doc/conf.py +26 -0
- data/ext/ruby_ndtypes/ndtypes/doc/grammar/grammar.rst +27 -0
- data/ext/ruby_ndtypes/ndtypes/doc/index.rst +56 -0
- data/ext/ruby_ndtypes/ndtypes/doc/libndtypes/context.rst +131 -0
- data/ext/ruby_ndtypes/ndtypes/doc/libndtypes/encodings.rst +68 -0
- data/ext/ruby_ndtypes/ndtypes/doc/libndtypes/fields-values.rst +175 -0
- data/ext/ruby_ndtypes/ndtypes/doc/libndtypes/functions.rst +72 -0
- data/ext/ruby_ndtypes/ndtypes/doc/libndtypes/index.rst +43 -0
- data/ext/ruby_ndtypes/ndtypes/doc/libndtypes/init.rst +48 -0
- data/ext/ruby_ndtypes/ndtypes/doc/libndtypes/io.rst +100 -0
- data/ext/ruby_ndtypes/ndtypes/doc/libndtypes/memory.rst +124 -0
- data/ext/ruby_ndtypes/ndtypes/doc/libndtypes/predicates.rst +110 -0
- data/ext/ruby_ndtypes/ndtypes/doc/libndtypes/typedef.rst +31 -0
- data/ext/ruby_ndtypes/ndtypes/doc/libndtypes/types.rst +594 -0
- data/ext/ruby_ndtypes/ndtypes/doc/libndtypes/util.rst +166 -0
- data/ext/ruby_ndtypes/ndtypes/doc/ndtypes/buffer-protocol.rst +27 -0
- data/ext/ruby_ndtypes/ndtypes/doc/ndtypes/index.rst +21 -0
- data/ext/ruby_ndtypes/ndtypes/doc/ndtypes/pattern-matching.rst +330 -0
- data/ext/ruby_ndtypes/ndtypes/doc/ndtypes/quickstart.rst +144 -0
- data/ext/ruby_ndtypes/ndtypes/doc/ndtypes/types.rst +544 -0
- data/ext/ruby_ndtypes/ndtypes/doc/releases/index.rst +35 -0
- data/ext/ruby_ndtypes/ndtypes/install-sh +527 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/Makefile.in +271 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/Makefile.vc +269 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/alloc.c +230 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/attr.c +268 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/attr.h +109 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/compat/Makefile.in +73 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/compat/Makefile.vc +70 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/compat/README.txt +16 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/compat/bpgrammar.c +2179 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/compat/bpgrammar.h +134 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/compat/bpgrammar.y +428 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/compat/bplexer.c +2543 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/compat/bplexer.h +735 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/compat/bplexer.l +176 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/compat/export.c +543 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/compat/import.c +110 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/context.c +228 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/copy.c +634 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/encodings.c +116 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/equal.c +288 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/grammar.c +3067 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/grammar.h +180 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/grammar.y +417 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/io.c +1658 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/lexer.c +2773 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/lexer.h +734 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/lexer.l +222 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/match.c +1132 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/ndtypes.c +2323 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/ndtypes.h.in +893 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/overflow.h +161 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/parsefuncs.c +473 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/parsefuncs.h +92 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/parser.c +246 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/seq.c +269 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/seq.h +197 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/serialize/Makefile.in +48 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/serialize/Makefile.vc +46 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/serialize/deserialize.c +1007 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/serialize/serialize.c +442 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/slice.h +42 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/substitute.c +238 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/substitute.h +50 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/symtable.c +371 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/symtable.h +100 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/Makefile.in +55 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/Makefile.vc +45 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/alloc_fail.c +82 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/alloc_fail.h +49 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/runtest.c +1657 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/test.h +85 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/test_array.c +115 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/test_buffer.c +137 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/test_indent.c +201 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/test_match.c +2397 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/test_numba.c +57 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/test_parse.c +349 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/test_parse_error.c +27839 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/test_parse_roundtrip.c +350 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/test_record.c +231 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/test_typecheck.c +375 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/test_typedef.c +65 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/valgrind.supp +30 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tools/bench.c +79 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tools/indent.c +94 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tools/print_ast.c +96 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/util.c +474 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/values.c +228 -0
- data/ext/ruby_ndtypes/ndtypes/python/bench.py +49 -0
- data/ext/ruby_ndtypes/ndtypes/python/ndt_randtype.py +409 -0
- data/ext/ruby_ndtypes/ndtypes/python/ndt_support.py +14 -0
- data/ext/ruby_ndtypes/ndtypes/python/ndtypes/__init__.py +70 -0
- data/ext/ruby_ndtypes/ndtypes/python/ndtypes/_ndtypes.c +1332 -0
- data/ext/ruby_ndtypes/ndtypes/python/ndtypes/docstrings.h +319 -0
- data/ext/ruby_ndtypes/ndtypes/python/ndtypes/pyndtypes.h +154 -0
- data/ext/ruby_ndtypes/ndtypes/python/test_ndtypes.py +1977 -0
- data/ext/ruby_ndtypes/ndtypes/setup.py +288 -0
- data/ext/ruby_ndtypes/ndtypes/vcbuild/INSTALL.txt +41 -0
- data/ext/ruby_ndtypes/ndtypes/vcbuild/runtest32.bat +15 -0
- data/ext/ruby_ndtypes/ndtypes/vcbuild/runtest64.bat +13 -0
- data/ext/ruby_ndtypes/ndtypes/vcbuild/vcbuild32.bat +38 -0
- data/ext/ruby_ndtypes/ndtypes/vcbuild/vcbuild64.bat +38 -0
- data/ext/ruby_ndtypes/ndtypes/vcbuild/vcclean.bat +13 -0
- data/ext/ruby_ndtypes/ndtypes/vcbuild/vcdistclean.bat +14 -0
- data/ext/ruby_ndtypes/ruby_ndtypes.c +1003 -0
- data/ext/ruby_ndtypes/ruby_ndtypes.h +37 -0
- data/ext/ruby_ndtypes/ruby_ndtypes_internal.h +28 -0
- data/lib/ndtypes.rb +45 -0
- data/lib/ndtypes/errors.rb +2 -0
- data/lib/ndtypes/version.rb +6 -0
- data/ndtypes.gemspec +47 -0
- data/spec/gc_table_spec.rb +10 -0
- data/spec/ndtypes_spec.rb +289 -0
- data/spec/spec_helper.rb +241 -0
- metadata +242 -0
@@ -0,0 +1,288 @@
|
|
1
|
+
#
|
2
|
+
# BSD 3-Clause License
|
3
|
+
#
|
4
|
+
# Copyright (c) 2017-2018, plures
|
5
|
+
# All rights reserved.
|
6
|
+
#
|
7
|
+
# Redistribution and use in source and binary forms, with or without
|
8
|
+
# modification, are permitted provided that the following conditions are met:
|
9
|
+
#
|
10
|
+
# 1. Redistributions of source code must retain the above copyright notice,
|
11
|
+
# this list of conditions and the following disclaimer.
|
12
|
+
#
|
13
|
+
# 2. Redistributions in binary form must reproduce the above copyright notice,
|
14
|
+
# this list of conditions and the following disclaimer in the documentation
|
15
|
+
# and/or other materials provided with the distribution.
|
16
|
+
#
|
17
|
+
# 3. Neither the name of the copyright holder nor the names of its
|
18
|
+
# contributors may be used to endorse or promote products derived from
|
19
|
+
# this software without specific prior written permission.
|
20
|
+
#
|
21
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
22
|
+
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
23
|
+
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
24
|
+
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
25
|
+
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
26
|
+
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
27
|
+
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
28
|
+
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
29
|
+
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
30
|
+
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
31
|
+
#
|
32
|
+
|
33
|
+
|
34
|
+
import sys, os
|
35
|
+
|
36
|
+
if "bdist_wheel" in sys.argv:
|
37
|
+
from setuptools import setup, Extension
|
38
|
+
else:
|
39
|
+
from distutils.core import setup, Extension
|
40
|
+
|
41
|
+
from distutils.sysconfig import get_python_lib
|
42
|
+
from glob import glob
|
43
|
+
import platform
|
44
|
+
import subprocess
|
45
|
+
import shutil
|
46
|
+
|
47
|
+
try:
|
48
|
+
import sphinx.cmd
|
49
|
+
SPHINX_BUILD = "sphinx.cmd.build"
|
50
|
+
except:
|
51
|
+
SPHINX_BUILD = "sphinx"
|
52
|
+
|
53
|
+
|
54
|
+
DESCRIPTION = """\
|
55
|
+
Dynamic types for data description and in-memory computations.\
|
56
|
+
"""
|
57
|
+
|
58
|
+
LONG_DESCRIPTION = """
|
59
|
+
Overview
|
60
|
+
--------
|
61
|
+
|
62
|
+
The ``ndtypes`` module is the Python interface to the ``libndtypes`` library.
|
63
|
+
``libndtypes`` implements dynamic types relevant for scientific computing.
|
64
|
+
|
65
|
+
These types contain full memory layout information and are used both for type
|
66
|
+
checking and accessing values in memory.
|
67
|
+
|
68
|
+
Types are specified using a close variant of the datashape language.
|
69
|
+
|
70
|
+
``ndtypes`` supports other container modules. It displays types, performs
|
71
|
+
type checking, and the concrete type layout information is used to traverse
|
72
|
+
memory.
|
73
|
+
|
74
|
+
As an example, ``xnd`` is a container module that is based on ``ndtypes``.
|
75
|
+
|
76
|
+
Links
|
77
|
+
-----
|
78
|
+
|
79
|
+
* https://github.com/plures/
|
80
|
+
* http://ndtypes.readthedocs.io/en/latest/
|
81
|
+
* http://xnd.readthedocs.io/en/latest/
|
82
|
+
"""
|
83
|
+
|
84
|
+
|
85
|
+
if sys.platform == "darwin":
|
86
|
+
LIBNAME = "libndtypes.dylib"
|
87
|
+
LIBSONAME = "libndtypes.0.dylib"
|
88
|
+
LIBSHARED = "libndtypes.0.2.0dev3.dylib"
|
89
|
+
else:
|
90
|
+
LIBNAME = "libndtypes.so"
|
91
|
+
LIBSONAME = "libndtypes.so.0"
|
92
|
+
LIBSHARED = "libndtypes.so.0.2.0dev3"
|
93
|
+
|
94
|
+
if "install" in sys.argv or "bdist_wheel" in sys.argv:
|
95
|
+
LIBNDTYPESDIR = "%s/ndtypes" % get_python_lib()
|
96
|
+
INSTALL_LIBS = True
|
97
|
+
else:
|
98
|
+
LIBNDTYPESDIR = "../python/ndtypes"
|
99
|
+
INSTALL_LIBS = False
|
100
|
+
|
101
|
+
PY_MAJOR = sys.version_info[0]
|
102
|
+
PY_MINOR = sys.version_info[1]
|
103
|
+
ARCH = platform.architecture()[0]
|
104
|
+
BUILD_ALL = \
|
105
|
+
"build" in sys.argv or "install" in sys.argv or "bdist_wheel" in sys.argv
|
106
|
+
WITH_VALGRIND = False
|
107
|
+
|
108
|
+
|
109
|
+
if PY_MAJOR < 3:
|
110
|
+
raise NotImplementedError(
|
111
|
+
"python2 support is not implemented")
|
112
|
+
|
113
|
+
|
114
|
+
def get_module_path():
|
115
|
+
pathlist = glob("build/lib.*/")
|
116
|
+
if pathlist:
|
117
|
+
return pathlist[0]
|
118
|
+
raise RuntimeError("cannot find ndtypes module in build directory")
|
119
|
+
|
120
|
+
def copy_ext():
|
121
|
+
if sys.platform == "win32":
|
122
|
+
pathlist = glob("build/lib.*/ndtypes/_ndtypes.*.pyd")
|
123
|
+
else:
|
124
|
+
pathlist = glob("build/lib.*/ndtypes/_ndtypes.*.so")
|
125
|
+
if pathlist:
|
126
|
+
shutil.copy2(pathlist[0], "python/ndtypes")
|
127
|
+
|
128
|
+
def make_symlinks():
|
129
|
+
os.chdir(LIBNDTYPESDIR)
|
130
|
+
os.chmod(LIBSHARED, 0o755)
|
131
|
+
os.system("ln -sf %s %s" % (LIBSHARED, LIBSONAME))
|
132
|
+
os.system("ln -sf %s %s" % (LIBSHARED, LIBNAME))
|
133
|
+
|
134
|
+
|
135
|
+
if "--with-valgrind" in sys.argv:
|
136
|
+
WITH_VALGRIND = True
|
137
|
+
sys.argv.remove("--with-valgrind")
|
138
|
+
|
139
|
+
|
140
|
+
if len(sys.argv) == 3 and sys.argv[1] == "install" and \
|
141
|
+
sys.argv[2].startswith("--local"):
|
142
|
+
localdir = sys.argv[2].split("=")[1]
|
143
|
+
sys.argv = sys.argv[:2] + [
|
144
|
+
"--install-base=" + localdir,
|
145
|
+
"--install-purelib=" + localdir,
|
146
|
+
"--install-platlib=" + localdir,
|
147
|
+
"--install-scripts=" + localdir,
|
148
|
+
"--install-data=" + localdir,
|
149
|
+
"--install-headers=" + localdir]
|
150
|
+
|
151
|
+
LIBNDTYPESDIR = "%s/ndtypes" % localdir
|
152
|
+
|
153
|
+
if sys.platform == "darwin": # homebrew bug
|
154
|
+
sys.argv.append("--prefix=")
|
155
|
+
|
156
|
+
elif len(sys.argv) == 2:
|
157
|
+
if sys.argv[1] == 'module':
|
158
|
+
sys.argv[1] = 'build'
|
159
|
+
if sys.argv[1] == 'module_install':
|
160
|
+
sys.argv[1] = 'install'
|
161
|
+
if sys.argv[1] == 'test':
|
162
|
+
module_path = get_module_path()
|
163
|
+
python_path = os.getenv('PYTHONPATH')
|
164
|
+
path = module_path + ':' + python_path if python_path else module_path
|
165
|
+
env = os.environ.copy()
|
166
|
+
env['PYTHONPATH'] = path
|
167
|
+
ret = subprocess.call([sys.executable, "python/test_ndtypes.py", "--long"], env=env)
|
168
|
+
sys.exit(ret)
|
169
|
+
elif sys.argv[1] == 'doctest':
|
170
|
+
os.chdir("doc")
|
171
|
+
module_path = '../python'
|
172
|
+
python_path = os.getenv('PYTHONPATH')
|
173
|
+
path = module_path + ':' + python_path if python_path else module_path
|
174
|
+
env = os.environ.copy()
|
175
|
+
env['PYTHONPATH'] = path
|
176
|
+
cmd = [sys.executable, "-m", SPHINX_BUILD,
|
177
|
+
"-b", "doctest", "-d", "build/doctrees", ".", "build/html"]
|
178
|
+
ret = subprocess.call(cmd, env=env)
|
179
|
+
sys.exit(ret)
|
180
|
+
elif sys.argv[1] == 'clean':
|
181
|
+
shutil.rmtree("build", ignore_errors=True)
|
182
|
+
os.chdir("python/ndtypes")
|
183
|
+
shutil.rmtree("__pycache__", ignore_errors=True)
|
184
|
+
for f in glob("_ndtypes*.so"):
|
185
|
+
os.remove(f)
|
186
|
+
sys.exit(0)
|
187
|
+
elif sys.argv[1] == 'distclean':
|
188
|
+
if sys.platform == "win32":
|
189
|
+
os.chdir("vcbuild")
|
190
|
+
os.system("vcdistclean.bat")
|
191
|
+
else:
|
192
|
+
os.system("make distclean")
|
193
|
+
sys.exit(0)
|
194
|
+
else:
|
195
|
+
pass
|
196
|
+
|
197
|
+
|
198
|
+
def ndtypes_ext():
|
199
|
+
include_dirs = ["libndtypes"]
|
200
|
+
library_dirs = ["libndtypes"]
|
201
|
+
depends = ["libndtypes/ndtypes.h", "python/ndtypes/pyndtypes.h"]
|
202
|
+
sources = ["python/ndtypes/_ndtypes.c"]
|
203
|
+
|
204
|
+
if sys.platform == "win32":
|
205
|
+
libraries = ["libndtypes-0.2.0dev3.dll"]
|
206
|
+
extra_compile_args = ["/DNDT_IMPORT"]
|
207
|
+
extra_link_args = []
|
208
|
+
runtime_library_dirs = []
|
209
|
+
|
210
|
+
if BUILD_ALL:
|
211
|
+
from distutils.msvc9compiler import MSVCCompiler
|
212
|
+
MSVCCompiler().initialize()
|
213
|
+
os.chdir("vcbuild")
|
214
|
+
if ARCH == "64bit":
|
215
|
+
os.system("vcbuild64.bat")
|
216
|
+
else:
|
217
|
+
os.system("vcbuild32.bat")
|
218
|
+
os.chdir("..")
|
219
|
+
|
220
|
+
else:
|
221
|
+
libraries = [":%s" % LIBSHARED]
|
222
|
+
extra_compile_args = ["-Wextra", "-Wno-missing-field-initializers", "-std=c11"]
|
223
|
+
if sys.platform == "darwin":
|
224
|
+
libraries = ["ndtypes"]
|
225
|
+
extra_link_args = ["-Wl,-rpath,@loader_path"]
|
226
|
+
runtime_library_dirs = []
|
227
|
+
else:
|
228
|
+
libraries = [":%s" % LIBSHARED]
|
229
|
+
extra_link_args = []
|
230
|
+
runtime_library_dirs = ["$ORIGIN"]
|
231
|
+
|
232
|
+
if BUILD_ALL:
|
233
|
+
if WITH_VALGRIND:
|
234
|
+
os.system("./configure --with-valgrind && make")
|
235
|
+
else:
|
236
|
+
os.system("./configure && make")
|
237
|
+
|
238
|
+
return Extension (
|
239
|
+
"ndtypes._ndtypes",
|
240
|
+
include_dirs = include_dirs,
|
241
|
+
library_dirs = library_dirs,
|
242
|
+
depends = depends,
|
243
|
+
sources = sources,
|
244
|
+
libraries = libraries,
|
245
|
+
extra_compile_args = extra_compile_args,
|
246
|
+
extra_link_args = extra_link_args,
|
247
|
+
runtime_library_dirs = runtime_library_dirs
|
248
|
+
)
|
249
|
+
|
250
|
+
setup (
|
251
|
+
name = "ndtypes",
|
252
|
+
version = "0.2.0dev3",
|
253
|
+
description = DESCRIPTION,
|
254
|
+
long_description = LONG_DESCRIPTION,
|
255
|
+
url = "https://github.com/plures/ndtypes",
|
256
|
+
author = 'Stefan Krah',
|
257
|
+
author_email = 'skrah@bytereef.org',
|
258
|
+
license = "BSD License",
|
259
|
+
keywords = ["ndtypes", "array computing", "data description"],
|
260
|
+
platforms = ["Many"],
|
261
|
+
classifiers = [
|
262
|
+
"Development Status :: 4 - Beta",
|
263
|
+
"Intended Audience :: Developers",
|
264
|
+
"Intended Audience :: Education",
|
265
|
+
"Intended Audience :: End Users/Desktop",
|
266
|
+
"Intended Audience :: Financial and Insurance Industry",
|
267
|
+
"Intended Audience :: Science/Research",
|
268
|
+
"License :: OSI Approved :: BSD License",
|
269
|
+
"Programming Language :: C",
|
270
|
+
"Programming Language :: Python :: 3",
|
271
|
+
"Programming Language :: Python :: 3.6",
|
272
|
+
"Programming Language :: Python :: 3.7",
|
273
|
+
"Operating System :: OS Independent",
|
274
|
+
"Topic :: Scientific/Engineering :: Mathematics",
|
275
|
+
"Topic :: Software Development"
|
276
|
+
],
|
277
|
+
package_dir = {"": "python"},
|
278
|
+
packages = ["ndtypes"],
|
279
|
+
package_data = {"ndtypes": ["libndtypes*", "ndtypes.h", "pyndtypes.h"]
|
280
|
+
if INSTALL_LIBS
|
281
|
+
else ["pyndtypes.h"]},
|
282
|
+
ext_modules = [ndtypes_ext()],
|
283
|
+
)
|
284
|
+
|
285
|
+
copy_ext()
|
286
|
+
|
287
|
+
if INSTALL_LIBS and sys.platform != "win32" and not "bdist_wheel" in sys.argv:
|
288
|
+
make_symlinks()
|
@@ -0,0 +1,41 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
libndtypes build instructions for Visual Studio
|
4
|
+
===============================================
|
5
|
+
|
6
|
+
Requirements
|
7
|
+
------------
|
8
|
+
|
9
|
+
- Visual Studio 2015 or later
|
10
|
+
|
11
|
+
|
12
|
+
64-bit build
|
13
|
+
------------
|
14
|
+
|
15
|
+
# Set the build environment
|
16
|
+
vcvarsall.bat x64
|
17
|
+
|
18
|
+
# Build: If successful, the static library, the dynamic library, the
|
19
|
+
# common header file and two executables for running the unit tests
|
20
|
+
# should be in the dist64 directory.
|
21
|
+
vcbuild64.bat
|
22
|
+
|
23
|
+
# Test
|
24
|
+
runtest64.bat
|
25
|
+
|
26
|
+
|
27
|
+
32-bit build
|
28
|
+
------------
|
29
|
+
|
30
|
+
# Set the build environment
|
31
|
+
vcvarsall.bat x86
|
32
|
+
|
33
|
+
# Build: If successful, the static library, the dynamic library, the
|
34
|
+
# common header file and two executables for running the unit tests
|
35
|
+
# should be in the dist32 directory.
|
36
|
+
vcbuild32.bat
|
37
|
+
|
38
|
+
# Test
|
39
|
+
runtest32.bat
|
40
|
+
|
41
|
+
|
@@ -0,0 +1,15 @@
|
|
1
|
+
@ECHO OFF
|
2
|
+
echo.
|
3
|
+
<nul (set /p x="Running static library tests ... ")
|
4
|
+
echo.
|
5
|
+
echo.
|
6
|
+
dist32\runtest.exe
|
7
|
+
IF ERRORLEVEL 1 echo FAIL
|
8
|
+
echo.
|
9
|
+
<nul (set /p x="Running shared library tests ... ")
|
10
|
+
echo.
|
11
|
+
echo.
|
12
|
+
dist32\runtest_shared.exe
|
13
|
+
IF ERRORLEVEL 1 echo FAIL
|
14
|
+
|
15
|
+
|
@@ -0,0 +1,13 @@
|
|
1
|
+
@ECHO OFF
|
2
|
+
echo.
|
3
|
+
<nul (set /p x="Running static library tests ... ")
|
4
|
+
echo.
|
5
|
+
echo.
|
6
|
+
dist64\runtest.exe
|
7
|
+
IF ERRORLEVEL 1 echo FAIL
|
8
|
+
echo.
|
9
|
+
<nul (set /p x="Running shared library tests ... ")
|
10
|
+
echo.
|
11
|
+
echo.
|
12
|
+
dist64\runtest_shared.exe
|
13
|
+
IF ERRORLEVEL 1 echo FAIL
|
@@ -0,0 +1,38 @@
|
|
1
|
+
@ECHO off
|
2
|
+
|
3
|
+
if not exist dist32 mkdir dist32
|
4
|
+
if exist dist32\* del /q dist32\*
|
5
|
+
|
6
|
+
cd ..\libndtypes
|
7
|
+
copy /y Makefile.vc Makefile
|
8
|
+
copy /y ndtypes.h.in ndtypes.h
|
9
|
+
|
10
|
+
cd compat
|
11
|
+
copy /y Makefile.vc Makefile
|
12
|
+
cd ..
|
13
|
+
|
14
|
+
cd serialize
|
15
|
+
copy /y Makefile.vc Makefile
|
16
|
+
cd ..
|
17
|
+
|
18
|
+
nmake /nologo clean
|
19
|
+
nmake /nologo
|
20
|
+
|
21
|
+
copy /y libndtypes-0.2.0dev3.lib ..\vcbuild\dist32
|
22
|
+
copy /y libndtypes-0.2.0dev3.dll ..\vcbuild\dist32
|
23
|
+
copy /y libndtypes-0.2.0dev3.dll.lib ..\vcbuild\dist32
|
24
|
+
copy /y libndtypes-0.2.0dev3.dll.exp ..\vcbuild\dist32
|
25
|
+
copy /y ndtypes.h ..\vcbuild\dist32
|
26
|
+
|
27
|
+
cd tests
|
28
|
+
copy /y Makefile.vc Makefile
|
29
|
+
nmake /nologo clean
|
30
|
+
nmake /nologo
|
31
|
+
|
32
|
+
copy /y runtest.exe ..\..\vcbuild\dist32
|
33
|
+
copy /y runtest_shared.exe ..\..\vcbuild\dist32
|
34
|
+
|
35
|
+
cd ..\..\vcbuild
|
36
|
+
|
37
|
+
|
38
|
+
|
@@ -0,0 +1,38 @@
|
|
1
|
+
@ECHO off
|
2
|
+
|
3
|
+
if not exist dist64 mkdir dist64
|
4
|
+
if exist dist64\* del /q dist64\*
|
5
|
+
|
6
|
+
cd ..\libndtypes
|
7
|
+
copy /y Makefile.vc Makefile
|
8
|
+
copy /y ndtypes.h.in ndtypes.h
|
9
|
+
|
10
|
+
cd compat
|
11
|
+
copy /y Makefile.vc Makefile
|
12
|
+
cd ..
|
13
|
+
|
14
|
+
cd serialize
|
15
|
+
copy /y Makefile.vc Makefile
|
16
|
+
cd ..
|
17
|
+
|
18
|
+
nmake /nologo clean
|
19
|
+
nmake /nologo
|
20
|
+
|
21
|
+
copy /y libndtypes-0.2.0dev3.lib ..\vcbuild\dist64
|
22
|
+
copy /y libndtypes-0.2.0dev3.dll ..\vcbuild\dist64
|
23
|
+
copy /y libndtypes-0.2.0dev3.dll.lib ..\vcbuild\dist64
|
24
|
+
copy /y libndtypes-0.2.0dev3.dll.exp ..\vcbuild\dist64
|
25
|
+
copy /y ndtypes.h ..\vcbuild\dist64
|
26
|
+
|
27
|
+
cd tests
|
28
|
+
copy /y Makefile.vc Makefile
|
29
|
+
nmake /nologo clean
|
30
|
+
nmake /nologo
|
31
|
+
|
32
|
+
copy /y runtest.exe ..\..\vcbuild\dist64
|
33
|
+
copy /y runtest_shared.exe ..\..\vcbuild\dist64
|
34
|
+
|
35
|
+
cd ..\..\vcbuild
|
36
|
+
|
37
|
+
|
38
|
+
|