Cython 3.2.0__cp39-abi3-win32.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- Cython/Build/BuildExecutable.py +169 -0
- Cython/Build/Cache.py +199 -0
- Cython/Build/Cythonize.py +350 -0
- Cython/Build/Dependencies.py +1314 -0
- Cython/Build/Distutils.py +1 -0
- Cython/Build/Inline.py +463 -0
- Cython/Build/IpythonMagic.py +560 -0
- Cython/Build/SharedModule.py +94 -0
- Cython/Build/Tests/TestCyCache.py +194 -0
- Cython/Build/Tests/TestCythonizeArgsParser.py +481 -0
- Cython/Build/Tests/TestDependencies.py +133 -0
- Cython/Build/Tests/TestInline.py +177 -0
- Cython/Build/Tests/TestIpythonMagic.py +287 -0
- Cython/Build/Tests/TestRecythonize.py +212 -0
- Cython/Build/Tests/TestStripLiterals.py +155 -0
- Cython/Build/Tests/__init__.py +1 -0
- Cython/Build/__init__.py +11 -0
- Cython/CodeWriter.py +815 -0
- Cython/Compiler/AnalysedTreeTransforms.py +97 -0
- Cython/Compiler/Annotate.py +328 -0
- Cython/Compiler/AutoDocTransforms.py +320 -0
- Cython/Compiler/Buffer.py +680 -0
- Cython/Compiler/Builtin.py +984 -0
- Cython/Compiler/CmdLine.py +263 -0
- Cython/Compiler/Code.pxd +149 -0
- Cython/Compiler/Code.py +3746 -0
- Cython/Compiler/Code.pyd +0 -0
- Cython/Compiler/CodeGeneration.py +33 -0
- Cython/Compiler/CythonScope.py +191 -0
- Cython/Compiler/Dataclass.py +864 -0
- Cython/Compiler/DebugFlags.py +24 -0
- Cython/Compiler/Errors.py +297 -0
- Cython/Compiler/ExprNodes.py +15562 -0
- Cython/Compiler/FlowControl.pxd +97 -0
- Cython/Compiler/FlowControl.py +1451 -0
- Cython/Compiler/FlowControl.pyd +0 -0
- Cython/Compiler/FusedNode.py +971 -0
- Cython/Compiler/FusedNode.pyd +0 -0
- Cython/Compiler/Future.py +16 -0
- Cython/Compiler/Interpreter.py +57 -0
- Cython/Compiler/Lexicon.py +421 -0
- Cython/Compiler/LineTable.py +114 -0
- Cython/Compiler/LineTable.pyd +0 -0
- Cython/Compiler/Main.py +857 -0
- Cython/Compiler/MatchCaseNodes.py +259 -0
- Cython/Compiler/MemoryView.py +905 -0
- Cython/Compiler/ModuleNode.py +4235 -0
- Cython/Compiler/Naming.py +363 -0
- Cython/Compiler/Nodes.py +10831 -0
- Cython/Compiler/Optimize.py +5288 -0
- Cython/Compiler/Options.py +843 -0
- Cython/Compiler/ParseTreeTransforms.pxd +78 -0
- Cython/Compiler/ParseTreeTransforms.py +4638 -0
- Cython/Compiler/Parsing.pxd +9 -0
- Cython/Compiler/Parsing.py +4775 -0
- Cython/Compiler/Parsing.pyd +0 -0
- Cython/Compiler/Pipeline.py +439 -0
- Cython/Compiler/PyrexTypes.py +5870 -0
- Cython/Compiler/Pythran.py +232 -0
- Cython/Compiler/Scanning.pxd +48 -0
- Cython/Compiler/Scanning.py +701 -0
- Cython/Compiler/Scanning.pyd +0 -0
- Cython/Compiler/StringEncoding.py +298 -0
- Cython/Compiler/Symtab.py +3073 -0
- Cython/Compiler/Tests/TestBuffer.py +105 -0
- Cython/Compiler/Tests/TestBuiltin.py +72 -0
- Cython/Compiler/Tests/TestCmdLine.py +586 -0
- Cython/Compiler/Tests/TestCode.py +144 -0
- Cython/Compiler/Tests/TestFlowControl.py +65 -0
- Cython/Compiler/Tests/TestGrammar.py +202 -0
- Cython/Compiler/Tests/TestMemView.py +71 -0
- Cython/Compiler/Tests/TestParseTreeTransforms.py +285 -0
- Cython/Compiler/Tests/TestScanning.py +134 -0
- Cython/Compiler/Tests/TestSignatureMatching.py +73 -0
- Cython/Compiler/Tests/TestStringEncoding.py +21 -0
- Cython/Compiler/Tests/TestTreeFragment.py +63 -0
- Cython/Compiler/Tests/TestTreePath.py +103 -0
- Cython/Compiler/Tests/TestTypes.py +75 -0
- Cython/Compiler/Tests/TestUtilityLoad.py +112 -0
- Cython/Compiler/Tests/TestVisitor.py +61 -0
- Cython/Compiler/Tests/Utils.py +36 -0
- Cython/Compiler/Tests/__init__.py +1 -0
- Cython/Compiler/TreeFragment.py +278 -0
- Cython/Compiler/TreePath.py +303 -0
- Cython/Compiler/TypeInference.py +591 -0
- Cython/Compiler/TypeSlots.py +1174 -0
- Cython/Compiler/UFuncs.py +311 -0
- Cython/Compiler/UtilNodes.py +389 -0
- Cython/Compiler/UtilityCode.py +344 -0
- Cython/Compiler/Version.py +8 -0
- Cython/Compiler/Visitor.pxd +53 -0
- Cython/Compiler/Visitor.py +861 -0
- Cython/Compiler/Visitor.pyd +0 -0
- Cython/Compiler/__init__.py +1 -0
- Cython/Coverage.py +448 -0
- Cython/Debugger/Cygdb.py +177 -0
- Cython/Debugger/DebugWriter.py +82 -0
- Cython/Debugger/Tests/TestLibCython.py +275 -0
- Cython/Debugger/Tests/__init__.py +1 -0
- Cython/Debugger/Tests/cfuncs.c +8 -0
- Cython/Debugger/Tests/codefile +49 -0
- Cython/Debugger/Tests/test_libcython_in_gdb.py +578 -0
- Cython/Debugger/Tests/test_libpython_in_gdb.py +90 -0
- Cython/Debugger/__init__.py +1 -0
- Cython/Debugger/libcython.py +1548 -0
- Cython/Debugger/libpython.py +2821 -0
- Cython/Debugging.py +20 -0
- Cython/Distutils/__init__.py +2 -0
- Cython/Distutils/build_ext.py +139 -0
- Cython/Distutils/extension.py +96 -0
- Cython/Distutils/old_build_ext.py +351 -0
- Cython/Includes/cpython/__init__.pxd +173 -0
- Cython/Includes/cpython/array.pxd +178 -0
- Cython/Includes/cpython/bool.pxd +37 -0
- Cython/Includes/cpython/buffer.pxd +112 -0
- Cython/Includes/cpython/bytearray.pxd +33 -0
- Cython/Includes/cpython/bytes.pxd +200 -0
- Cython/Includes/cpython/cellobject.pxd +35 -0
- Cython/Includes/cpython/ceval.pxd +8 -0
- Cython/Includes/cpython/codecs.pxd +121 -0
- Cython/Includes/cpython/complex.pxd +60 -0
- Cython/Includes/cpython/contextvars.pxd +145 -0
- Cython/Includes/cpython/conversion.pxd +36 -0
- Cython/Includes/cpython/datetime.pxd +395 -0
- Cython/Includes/cpython/descr.pxd +26 -0
- Cython/Includes/cpython/dict.pxd +187 -0
- Cython/Includes/cpython/exc.pxd +263 -0
- Cython/Includes/cpython/fileobject.pxd +57 -0
- Cython/Includes/cpython/float.pxd +47 -0
- Cython/Includes/cpython/function.pxd +65 -0
- Cython/Includes/cpython/genobject.pxd +25 -0
- Cython/Includes/cpython/getargs.pxd +12 -0
- Cython/Includes/cpython/instance.pxd +25 -0
- Cython/Includes/cpython/iterator.pxd +36 -0
- Cython/Includes/cpython/iterobject.pxd +24 -0
- Cython/Includes/cpython/list.pxd +92 -0
- Cython/Includes/cpython/long.pxd +149 -0
- Cython/Includes/cpython/longintrepr.pxd +14 -0
- Cython/Includes/cpython/mapping.pxd +63 -0
- Cython/Includes/cpython/marshal.pxd +66 -0
- Cython/Includes/cpython/mem.pxd +120 -0
- Cython/Includes/cpython/memoryview.pxd +50 -0
- Cython/Includes/cpython/method.pxd +49 -0
- Cython/Includes/cpython/module.pxd +208 -0
- Cython/Includes/cpython/number.pxd +258 -0
- Cython/Includes/cpython/object.pxd +433 -0
- Cython/Includes/cpython/pycapsule.pxd +143 -0
- Cython/Includes/cpython/pylifecycle.pxd +68 -0
- Cython/Includes/cpython/pyport.pxd +8 -0
- Cython/Includes/cpython/pystate.pxd +95 -0
- Cython/Includes/cpython/pythread.pxd +53 -0
- Cython/Includes/cpython/ref.pxd +141 -0
- Cython/Includes/cpython/sequence.pxd +134 -0
- Cython/Includes/cpython/set.pxd +119 -0
- Cython/Includes/cpython/slice.pxd +70 -0
- Cython/Includes/cpython/time.pxd +129 -0
- Cython/Includes/cpython/tuple.pxd +72 -0
- Cython/Includes/cpython/type.pxd +53 -0
- Cython/Includes/cpython/unicode.pxd +639 -0
- Cython/Includes/cpython/version.pxd +32 -0
- Cython/Includes/cpython/weakref.pxd +78 -0
- Cython/Includes/libc/__init__.pxd +1 -0
- Cython/Includes/libc/complex.pxd +35 -0
- Cython/Includes/libc/errno.pxd +127 -0
- Cython/Includes/libc/float.pxd +43 -0
- Cython/Includes/libc/limits.pxd +28 -0
- Cython/Includes/libc/locale.pxd +46 -0
- Cython/Includes/libc/math.pxd +209 -0
- Cython/Includes/libc/setjmp.pxd +10 -0
- Cython/Includes/libc/signal.pxd +64 -0
- Cython/Includes/libc/stddef.pxd +9 -0
- Cython/Includes/libc/stdint.pxd +105 -0
- Cython/Includes/libc/stdio.pxd +80 -0
- Cython/Includes/libc/stdlib.pxd +72 -0
- Cython/Includes/libc/string.pxd +50 -0
- Cython/Includes/libc/threads.pxd +234 -0
- Cython/Includes/libc/time.pxd +52 -0
- Cython/Includes/libcpp/__init__.pxd +4 -0
- Cython/Includes/libcpp/algorithm.pxd +320 -0
- Cython/Includes/libcpp/any.pxd +16 -0
- Cython/Includes/libcpp/atomic.pxd +59 -0
- Cython/Includes/libcpp/barrier.pxd +22 -0
- Cython/Includes/libcpp/bit.pxd +29 -0
- Cython/Includes/libcpp/cast.pxd +12 -0
- Cython/Includes/libcpp/cmath.pxd +518 -0
- Cython/Includes/libcpp/complex.pxd +106 -0
- Cython/Includes/libcpp/condition_variable.pxd +322 -0
- Cython/Includes/libcpp/deque.pxd +165 -0
- Cython/Includes/libcpp/exception.pxd +86 -0
- Cython/Includes/libcpp/execution.pxd +15 -0
- Cython/Includes/libcpp/forward_list.pxd +63 -0
- Cython/Includes/libcpp/functional.pxd +26 -0
- Cython/Includes/libcpp/future.pxd +103 -0
- Cython/Includes/libcpp/iterator.pxd +34 -0
- Cython/Includes/libcpp/latch.pxd +17 -0
- Cython/Includes/libcpp/limits.pxd +61 -0
- Cython/Includes/libcpp/list.pxd +117 -0
- Cython/Includes/libcpp/map.pxd +252 -0
- Cython/Includes/libcpp/memory.pxd +115 -0
- Cython/Includes/libcpp/mutex.pxd +387 -0
- Cython/Includes/libcpp/numbers.pxd +15 -0
- Cython/Includes/libcpp/numeric.pxd +131 -0
- Cython/Includes/libcpp/optional.pxd +34 -0
- Cython/Includes/libcpp/pair.pxd +1 -0
- Cython/Includes/libcpp/queue.pxd +25 -0
- Cython/Includes/libcpp/random.pxd +166 -0
- Cython/Includes/libcpp/semaphore.pxd +43 -0
- Cython/Includes/libcpp/set.pxd +228 -0
- Cython/Includes/libcpp/shared_mutex.pxd +96 -0
- Cython/Includes/libcpp/span.pxd +87 -0
- Cython/Includes/libcpp/stack.pxd +11 -0
- Cython/Includes/libcpp/stop_token.pxd +117 -0
- Cython/Includes/libcpp/string.pxd +355 -0
- Cython/Includes/libcpp/string_view.pxd +183 -0
- Cython/Includes/libcpp/typeindex.pxd +15 -0
- Cython/Includes/libcpp/typeinfo.pxd +10 -0
- Cython/Includes/libcpp/unordered_map.pxd +193 -0
- Cython/Includes/libcpp/unordered_set.pxd +152 -0
- Cython/Includes/libcpp/utility.pxd +30 -0
- Cython/Includes/libcpp/vector.pxd +186 -0
- Cython/Includes/numpy/math.pxd +150 -0
- Cython/Includes/openmp.pxd +50 -0
- Cython/Includes/posix/__init__.pxd +1 -0
- Cython/Includes/posix/dlfcn.pxd +14 -0
- Cython/Includes/posix/fcntl.pxd +86 -0
- Cython/Includes/posix/ioctl.pxd +4 -0
- Cython/Includes/posix/mman.pxd +101 -0
- Cython/Includes/posix/resource.pxd +57 -0
- Cython/Includes/posix/select.pxd +21 -0
- Cython/Includes/posix/signal.pxd +73 -0
- Cython/Includes/posix/stat.pxd +98 -0
- Cython/Includes/posix/stdio.pxd +37 -0
- Cython/Includes/posix/stdlib.pxd +29 -0
- Cython/Includes/posix/strings.pxd +9 -0
- Cython/Includes/posix/time.pxd +71 -0
- Cython/Includes/posix/types.pxd +30 -0
- Cython/Includes/posix/uio.pxd +26 -0
- Cython/Includes/posix/unistd.pxd +271 -0
- Cython/Includes/posix/wait.pxd +38 -0
- Cython/Plex/Actions.pxd +24 -0
- Cython/Plex/Actions.py +119 -0
- Cython/Plex/Actions.pyd +0 -0
- Cython/Plex/DFA.pxd +14 -0
- Cython/Plex/DFA.py +164 -0
- Cython/Plex/DFA.pyd +0 -0
- Cython/Plex/Errors.py +48 -0
- Cython/Plex/Lexicons.py +178 -0
- Cython/Plex/Machines.pxd +36 -0
- Cython/Plex/Machines.py +238 -0
- Cython/Plex/Machines.pyd +0 -0
- Cython/Plex/Regexps.py +535 -0
- Cython/Plex/Scanners.pxd +45 -0
- Cython/Plex/Scanners.py +328 -0
- Cython/Plex/Scanners.pyd +0 -0
- Cython/Plex/Transitions.pxd +14 -0
- Cython/Plex/Transitions.py +239 -0
- Cython/Plex/Transitions.pyd +0 -0
- Cython/Plex/__init__.py +34 -0
- Cython/Runtime/__init__.py +1 -0
- Cython/Runtime/refnanny.pyd +0 -0
- Cython/Runtime/refnanny.pyx +237 -0
- Cython/Shadow.py +690 -0
- Cython/Shadow.pyi +521 -0
- Cython/StringIOTree.py +170 -0
- Cython/StringIOTree.pyd +0 -0
- Cython/Tempita/__init__.py +4 -0
- Cython/Tempita/_looper.py +154 -0
- Cython/Tempita/_tempita.py +1091 -0
- Cython/Tempita/_tempita.pyd +0 -0
- Cython/TestUtils.py +422 -0
- Cython/Tests/TestCodeWriter.py +128 -0
- Cython/Tests/TestCythonUtils.py +202 -0
- Cython/Tests/TestJediTyper.py +223 -0
- Cython/Tests/TestShadow.py +114 -0
- Cython/Tests/TestStringIOTree.py +67 -0
- Cython/Tests/TestTestUtils.py +90 -0
- Cython/Tests/__init__.py +1 -0
- Cython/Tests/xmlrunner.py +390 -0
- Cython/Utility/AsyncGen.c +1031 -0
- Cython/Utility/Buffer.c +865 -0
- Cython/Utility/BufferFormatFromTypeInfo.pxd +2 -0
- Cython/Utility/Builtins.c +810 -0
- Cython/Utility/CConvert.pyx +134 -0
- Cython/Utility/CMath.c +104 -0
- Cython/Utility/CommonStructures.c +226 -0
- Cython/Utility/Complex.c +378 -0
- Cython/Utility/Coroutine.c +2300 -0
- Cython/Utility/CpdefEnums.pyx +103 -0
- Cython/Utility/CppConvert.pyx +282 -0
- Cython/Utility/CppSupport.cpp +151 -0
- Cython/Utility/CythonFunction.c +1832 -0
- Cython/Utility/Dataclasses.c +101 -0
- Cython/Utility/Embed.c +121 -0
- Cython/Utility/Exceptions.c +1016 -0
- Cython/Utility/ExtensionTypes.c +996 -0
- Cython/Utility/FunctionArguments.c +1043 -0
- Cython/Utility/FusedFunction.pyx +44 -0
- Cython/Utility/ImportExport.c +907 -0
- Cython/Utility/MemoryView.pxd +188 -0
- Cython/Utility/MemoryView.pyx +1482 -0
- Cython/Utility/MemoryView_C.c +927 -0
- Cython/Utility/ModuleSetupCode.c +3203 -0
- Cython/Utility/NumpyImportArray.c +46 -0
- Cython/Utility/ObjectHandling.c +3273 -0
- Cython/Utility/Optimize.c +1603 -0
- Cython/Utility/Overflow.c +384 -0
- Cython/Utility/Printing.c +86 -0
- Cython/Utility/Profile.c +732 -0
- Cython/Utility/StringTools.c +1379 -0
- Cython/Utility/Synchronization.c +399 -0
- Cython/Utility/TString.c +356 -0
- Cython/Utility/TestCyUtilityLoader.pyx +8 -0
- Cython/Utility/TestCythonScope.pyx +75 -0
- Cython/Utility/TestUtilityLoader.c +12 -0
- Cython/Utility/TypeConversion.c +1385 -0
- Cython/Utility/UFuncs.pyx +50 -0
- Cython/Utility/UFuncs_C.c +89 -0
- Cython/Utility/__init__.py +28 -0
- Cython/Utility/arrayarray.h +167 -0
- Cython/Utils.py +687 -0
- Cython/Utils.pyd +0 -0
- Cython/__init__.py +10 -0
- Cython/__init__.pyi +7 -0
- Cython/py.typed +0 -0
- cython-3.2.0.dist-info/METADATA +85 -0
- cython-3.2.0.dist-info/RECORD +333 -0
- cython-3.2.0.dist-info/WHEEL +5 -0
- cython-3.2.0.dist-info/entry_points.txt +4 -0
- cython-3.2.0.dist-info/top_level.txt +3 -0
- cython.py +29 -0
- pyximport/__init__.py +4 -0
- pyximport/pyxbuild.py +160 -0
- pyximport/pyximport.py +482 -0
Cython/Debugging.py
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
###############################################
|
|
2
|
+
#
|
|
3
|
+
# Odds and ends for debugging
|
|
4
|
+
#
|
|
5
|
+
###############################################
|
|
6
|
+
|
|
7
|
+
def print_call_chain(*args):
|
|
8
|
+
import sys
|
|
9
|
+
print(" ".join(map(str, args)))
|
|
10
|
+
f = sys._getframe(1)
|
|
11
|
+
while f:
|
|
12
|
+
name = f.f_code.co_name
|
|
13
|
+
s = f.f_locals.get('self', None)
|
|
14
|
+
if s:
|
|
15
|
+
c = getattr(s, "__class__", None)
|
|
16
|
+
if c:
|
|
17
|
+
name = "%s.%s" % (c.__name__, name)
|
|
18
|
+
print("Called from: %s %s" % (name, f.f_lineno))
|
|
19
|
+
f = f.f_back
|
|
20
|
+
print("-" * 70)
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
import os
|
|
3
|
+
|
|
4
|
+
# Always inherit from the "build_ext" in distutils since setuptools already imports
|
|
5
|
+
# it from Cython if available, and does the proper distutils fallback otherwise.
|
|
6
|
+
# https://github.com/pypa/setuptools/blob/9f1822ee910df3df930a98ab99f66d18bb70659b/setuptools/command/build_ext.py#L16
|
|
7
|
+
|
|
8
|
+
# setuptools imports Cython's "build_ext", so make sure we go first.
|
|
9
|
+
_build_ext_module = sys.modules.get('setuptools.command.build_ext')
|
|
10
|
+
if _build_ext_module is None:
|
|
11
|
+
try:
|
|
12
|
+
import distutils.command.build_ext as _build_ext_module
|
|
13
|
+
except ImportError:
|
|
14
|
+
# Python 3.12 no longer has distutils, but setuptools can replace it.
|
|
15
|
+
try:
|
|
16
|
+
import setuptools.command.build_ext as _build_ext_module
|
|
17
|
+
except ImportError:
|
|
18
|
+
raise ImportError("'distutils' cannot be imported. Please install setuptools.")
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
# setuptools remembers the original distutils "build_ext" as "_du_build_ext"
|
|
22
|
+
_build_ext = getattr(_build_ext_module, '_du_build_ext', None)
|
|
23
|
+
if _build_ext is None:
|
|
24
|
+
_build_ext = getattr(_build_ext_module, 'build_ext', None)
|
|
25
|
+
if _build_ext is None:
|
|
26
|
+
from distutils.command.build_ext import build_ext as _build_ext
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class build_ext(_build_ext):
|
|
30
|
+
|
|
31
|
+
user_options = _build_ext.user_options + [
|
|
32
|
+
('cython-cplus', None,
|
|
33
|
+
"generate C++ source files"),
|
|
34
|
+
('cython-create-listing', None,
|
|
35
|
+
"write errors to a listing file"),
|
|
36
|
+
('cython-line-directives', None,
|
|
37
|
+
"emit source line directives"),
|
|
38
|
+
('cython-include-dirs=', None,
|
|
39
|
+
"path to the Cython include files" + _build_ext.sep_by),
|
|
40
|
+
('cython-c-in-temp', None,
|
|
41
|
+
"put generated C files in temp directory"),
|
|
42
|
+
('cython-gen-pxi', None,
|
|
43
|
+
"generate .pxi file for public declarations"),
|
|
44
|
+
('cython-directives=', None,
|
|
45
|
+
"compiler directive overrides"),
|
|
46
|
+
('cython-gdb', None,
|
|
47
|
+
"generate debug information for cygdb"),
|
|
48
|
+
('cython-compile-time-env', None,
|
|
49
|
+
"cython compile time environment"),
|
|
50
|
+
]
|
|
51
|
+
|
|
52
|
+
boolean_options = _build_ext.boolean_options + [
|
|
53
|
+
'cython-cplus', 'cython-create-listing', 'cython-line-directives',
|
|
54
|
+
'cython-c-in-temp', 'cython-gdb',
|
|
55
|
+
]
|
|
56
|
+
|
|
57
|
+
def initialize_options(self):
|
|
58
|
+
super().initialize_options()
|
|
59
|
+
self.cython_cplus = 0
|
|
60
|
+
self.cython_create_listing = 0
|
|
61
|
+
self.cython_line_directives = 0
|
|
62
|
+
self.cython_include_dirs = None
|
|
63
|
+
self.cython_directives = None
|
|
64
|
+
self.cython_c_in_temp = 0
|
|
65
|
+
self.cython_gen_pxi = 0
|
|
66
|
+
self.cython_gdb = False
|
|
67
|
+
self.cython_compile_time_env = None
|
|
68
|
+
self.shared_utility_qualified_name = None
|
|
69
|
+
|
|
70
|
+
def finalize_options(self):
|
|
71
|
+
super().finalize_options()
|
|
72
|
+
if self.cython_include_dirs is None:
|
|
73
|
+
self.cython_include_dirs = []
|
|
74
|
+
elif isinstance(self.cython_include_dirs, str):
|
|
75
|
+
self.cython_include_dirs = \
|
|
76
|
+
self.cython_include_dirs.split(os.pathsep)
|
|
77
|
+
if self.cython_directives is None:
|
|
78
|
+
self.cython_directives = {}
|
|
79
|
+
|
|
80
|
+
def get_extension_attr(self, extension, option_name, default=False):
|
|
81
|
+
return getattr(self, option_name) or getattr(extension, option_name, default)
|
|
82
|
+
|
|
83
|
+
def build_extension(self, ext):
|
|
84
|
+
from Cython.Build.Dependencies import cythonize
|
|
85
|
+
|
|
86
|
+
# Set up the include_path for the Cython compiler:
|
|
87
|
+
# 1. Start with the command line option.
|
|
88
|
+
# 2. Add in any (unique) paths from the extension
|
|
89
|
+
# cython_include_dirs (if Cython.Distutils.extension is used).
|
|
90
|
+
# 3. Add in any (unique) paths from the extension include_dirs
|
|
91
|
+
includes = list(self.cython_include_dirs)
|
|
92
|
+
for include_dir in getattr(ext, 'cython_include_dirs', []):
|
|
93
|
+
if include_dir not in includes:
|
|
94
|
+
includes.append(include_dir)
|
|
95
|
+
|
|
96
|
+
# In case extension.include_dirs is a generator, evaluate it and keep
|
|
97
|
+
# result
|
|
98
|
+
ext.include_dirs = list(ext.include_dirs)
|
|
99
|
+
for include_dir in ext.include_dirs + list(self.include_dirs):
|
|
100
|
+
if include_dir not in includes:
|
|
101
|
+
includes.append(include_dir)
|
|
102
|
+
|
|
103
|
+
# Set up Cython compiler directives:
|
|
104
|
+
# 1. Start with the command line option.
|
|
105
|
+
# 2. Add in any (unique) entries from the extension
|
|
106
|
+
# cython_directives (if Cython.Distutils.extension is used).
|
|
107
|
+
directives = dict(self.cython_directives)
|
|
108
|
+
if hasattr(ext, "cython_directives"):
|
|
109
|
+
directives.update(ext.cython_directives)
|
|
110
|
+
|
|
111
|
+
if self.get_extension_attr(ext, 'cython_cplus'):
|
|
112
|
+
ext.language = 'c++'
|
|
113
|
+
|
|
114
|
+
if hasattr(ext, 'no_c_in_traceback'):
|
|
115
|
+
c_line_in_traceback = not ext.no_c_in_traceback
|
|
116
|
+
else:
|
|
117
|
+
c_line_in_traceback = None
|
|
118
|
+
options = {
|
|
119
|
+
'use_listing_file': self.get_extension_attr(ext, 'cython_create_listing'),
|
|
120
|
+
'emit_linenums': self.get_extension_attr(ext, 'cython_line_directives'),
|
|
121
|
+
'include_path': includes,
|
|
122
|
+
'compiler_directives': directives,
|
|
123
|
+
'build_dir': self.build_temp if self.get_extension_attr(ext, 'cython_c_in_temp') else None,
|
|
124
|
+
'generate_pxi': self.get_extension_attr(ext, 'cython_gen_pxi'),
|
|
125
|
+
'gdb_debug': self.get_extension_attr(ext, 'cython_gdb'),
|
|
126
|
+
'c_line_in_traceback': c_line_in_traceback,
|
|
127
|
+
'compile_time_env': self.get_extension_attr(ext, 'cython_compile_time_env', default=None),
|
|
128
|
+
'shared_utility_qualified_name': self.get_extension_attr(ext, 'shared_utility_qualified_name', default=None),
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
new_ext = cythonize(
|
|
132
|
+
ext,force=self.force, quiet=self.verbose == 0, **options
|
|
133
|
+
)[0]
|
|
134
|
+
|
|
135
|
+
ext.sources = new_ext.sources
|
|
136
|
+
super().build_extension(ext)
|
|
137
|
+
|
|
138
|
+
# backward compatibility
|
|
139
|
+
new_build_ext = build_ext
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"""Pyrex.Distutils.extension
|
|
2
|
+
|
|
3
|
+
Provides a modified Extension class, that understands how to describe
|
|
4
|
+
Pyrex extension modules in setup scripts."""
|
|
5
|
+
|
|
6
|
+
__revision__ = "$Id:$"
|
|
7
|
+
|
|
8
|
+
import distutils.extension as _Extension
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class Extension(_Extension.Extension):
|
|
12
|
+
# When adding arguments to this constructor, be sure to update
|
|
13
|
+
# user_options.extend in build_ext.py.
|
|
14
|
+
def __init__(self, name, sources,
|
|
15
|
+
include_dirs=None,
|
|
16
|
+
define_macros=None,
|
|
17
|
+
undef_macros=None,
|
|
18
|
+
library_dirs=None,
|
|
19
|
+
libraries=None,
|
|
20
|
+
runtime_library_dirs=None,
|
|
21
|
+
extra_objects=None,
|
|
22
|
+
extra_compile_args=None,
|
|
23
|
+
extra_link_args=None,
|
|
24
|
+
export_symbols=None,
|
|
25
|
+
#swig_opts=None,
|
|
26
|
+
depends=None,
|
|
27
|
+
language=None,
|
|
28
|
+
cython_include_dirs=None,
|
|
29
|
+
cython_directives=None,
|
|
30
|
+
cython_create_listing=False,
|
|
31
|
+
cython_line_directives=False,
|
|
32
|
+
cython_cplus=False,
|
|
33
|
+
cython_c_in_temp=False,
|
|
34
|
+
cython_gen_pxi=False,
|
|
35
|
+
cython_gdb=False,
|
|
36
|
+
no_c_in_traceback=False,
|
|
37
|
+
cython_compile_time_env=None,
|
|
38
|
+
**kw):
|
|
39
|
+
|
|
40
|
+
# Translate pyrex_X to cython_X for backwards compatibility.
|
|
41
|
+
had_pyrex_options = False
|
|
42
|
+
for key in list(kw):
|
|
43
|
+
if key.startswith('pyrex_'):
|
|
44
|
+
had_pyrex_options = True
|
|
45
|
+
kw['cython' + key[5:]] = kw.pop(key)
|
|
46
|
+
if had_pyrex_options:
|
|
47
|
+
Extension.__init__(
|
|
48
|
+
self, name, sources,
|
|
49
|
+
include_dirs=include_dirs,
|
|
50
|
+
define_macros=define_macros,
|
|
51
|
+
undef_macros=undef_macros,
|
|
52
|
+
library_dirs=library_dirs,
|
|
53
|
+
libraries=libraries,
|
|
54
|
+
runtime_library_dirs=runtime_library_dirs,
|
|
55
|
+
extra_objects=extra_objects,
|
|
56
|
+
extra_compile_args=extra_compile_args,
|
|
57
|
+
extra_link_args=extra_link_args,
|
|
58
|
+
export_symbols=export_symbols,
|
|
59
|
+
#swig_opts=swig_opts,
|
|
60
|
+
depends=depends,
|
|
61
|
+
language=language,
|
|
62
|
+
no_c_in_traceback=no_c_in_traceback,
|
|
63
|
+
**kw)
|
|
64
|
+
return
|
|
65
|
+
|
|
66
|
+
_Extension.Extension.__init__(
|
|
67
|
+
self, name, sources,
|
|
68
|
+
include_dirs=include_dirs,
|
|
69
|
+
define_macros=define_macros,
|
|
70
|
+
undef_macros=undef_macros,
|
|
71
|
+
library_dirs=library_dirs,
|
|
72
|
+
libraries=libraries,
|
|
73
|
+
runtime_library_dirs=runtime_library_dirs,
|
|
74
|
+
extra_objects=extra_objects,
|
|
75
|
+
extra_compile_args=extra_compile_args,
|
|
76
|
+
extra_link_args=extra_link_args,
|
|
77
|
+
export_symbols=export_symbols,
|
|
78
|
+
#swig_opts=swig_opts,
|
|
79
|
+
depends=depends,
|
|
80
|
+
language=language,
|
|
81
|
+
**kw)
|
|
82
|
+
|
|
83
|
+
self.cython_include_dirs = cython_include_dirs or []
|
|
84
|
+
self.cython_directives = cython_directives or {}
|
|
85
|
+
self.cython_create_listing = cython_create_listing
|
|
86
|
+
self.cython_line_directives = cython_line_directives
|
|
87
|
+
self.cython_cplus = cython_cplus
|
|
88
|
+
self.cython_c_in_temp = cython_c_in_temp
|
|
89
|
+
self.cython_gen_pxi = cython_gen_pxi
|
|
90
|
+
self.cython_gdb = cython_gdb
|
|
91
|
+
self.no_c_in_traceback = no_c_in_traceback
|
|
92
|
+
self.cython_compile_time_env = cython_compile_time_env
|
|
93
|
+
|
|
94
|
+
# class Extension
|
|
95
|
+
|
|
96
|
+
read_setup_file = _Extension.read_setup_file
|
|
@@ -0,0 +1,351 @@
|
|
|
1
|
+
"""Cython.Distutils.old_build_ext
|
|
2
|
+
|
|
3
|
+
Implements a version of the Distutils 'build_ext' command, for
|
|
4
|
+
building Cython extension modules.
|
|
5
|
+
|
|
6
|
+
Note that this module is deprecated. Use cythonize() instead.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
__revision__ = "$Id:$"
|
|
10
|
+
|
|
11
|
+
import sys
|
|
12
|
+
import os
|
|
13
|
+
from distutils.errors import DistutilsPlatformError
|
|
14
|
+
from distutils.dep_util import newer, newer_group
|
|
15
|
+
from distutils import log
|
|
16
|
+
from distutils.command import build_ext as _build_ext
|
|
17
|
+
from distutils import sysconfig
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
# FIXME: the below does not work as intended since importing 'Cython.Distutils' already
|
|
21
|
+
# imports this module through 'Cython/Distutils/build_ext.py', so the condition is
|
|
22
|
+
# always false and never prints the warning.
|
|
23
|
+
"""
|
|
24
|
+
import inspect
|
|
25
|
+
import warnings
|
|
26
|
+
|
|
27
|
+
def _check_stack(path):
|
|
28
|
+
try:
|
|
29
|
+
for frame in inspect.getouterframes(inspect.currentframe(), 0):
|
|
30
|
+
if path in frame[1].replace(os.sep, '/'):
|
|
31
|
+
return True
|
|
32
|
+
except Exception:
|
|
33
|
+
pass
|
|
34
|
+
return False
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
if (not _check_stack('setuptools/extensions.py')
|
|
38
|
+
and not _check_stack('pyximport/pyxbuild.py')
|
|
39
|
+
and not _check_stack('Cython/Distutils/build_ext.py')):
|
|
40
|
+
warnings.warn(
|
|
41
|
+
"Cython.Distutils.old_build_ext does not properly handle dependencies "
|
|
42
|
+
"and is deprecated.")
|
|
43
|
+
"""
|
|
44
|
+
|
|
45
|
+
extension_name_re = _build_ext.extension_name_re
|
|
46
|
+
|
|
47
|
+
show_compilers = _build_ext.show_compilers
|
|
48
|
+
|
|
49
|
+
class Optimization:
|
|
50
|
+
def __init__(self):
|
|
51
|
+
self.flags = (
|
|
52
|
+
'OPT',
|
|
53
|
+
'CFLAGS',
|
|
54
|
+
'CPPFLAGS',
|
|
55
|
+
'EXTRA_CFLAGS',
|
|
56
|
+
'BASECFLAGS',
|
|
57
|
+
'PY_CFLAGS',
|
|
58
|
+
)
|
|
59
|
+
self.state = sysconfig.get_config_vars(*self.flags)
|
|
60
|
+
self.config_vars = sysconfig.get_config_vars()
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def disable_optimization(self):
|
|
64
|
+
"disable optimization for the C or C++ compiler"
|
|
65
|
+
badoptions = ('-O1', '-O2', '-O3')
|
|
66
|
+
|
|
67
|
+
for flag, option in zip(self.flags, self.state):
|
|
68
|
+
if option is not None:
|
|
69
|
+
L = [opt for opt in option.split() if opt not in badoptions]
|
|
70
|
+
self.config_vars[flag] = ' '.join(L)
|
|
71
|
+
|
|
72
|
+
def restore_state(self):
|
|
73
|
+
"restore the original state"
|
|
74
|
+
for flag, option in zip(self.flags, self.state):
|
|
75
|
+
if option is not None:
|
|
76
|
+
self.config_vars[flag] = option
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
optimization = Optimization()
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
class old_build_ext(_build_ext.build_ext):
|
|
83
|
+
|
|
84
|
+
description = "build C/C++ and Cython extensions (compile/link to build directory)"
|
|
85
|
+
|
|
86
|
+
sep_by = _build_ext.build_ext.sep_by
|
|
87
|
+
user_options = _build_ext.build_ext.user_options[:]
|
|
88
|
+
boolean_options = _build_ext.build_ext.boolean_options[:]
|
|
89
|
+
help_options = _build_ext.build_ext.help_options[:]
|
|
90
|
+
|
|
91
|
+
# Add the pyrex specific data.
|
|
92
|
+
user_options.extend([
|
|
93
|
+
('cython-cplus', None,
|
|
94
|
+
"generate C++ source files"),
|
|
95
|
+
('cython-create-listing', None,
|
|
96
|
+
"write errors to a listing file"),
|
|
97
|
+
('cython-line-directives', None,
|
|
98
|
+
"emit source line directives"),
|
|
99
|
+
('cython-include-dirs=', None,
|
|
100
|
+
"path to the Cython include files" + sep_by),
|
|
101
|
+
('cython-c-in-temp', None,
|
|
102
|
+
"put generated C files in temp directory"),
|
|
103
|
+
('cython-gen-pxi', None,
|
|
104
|
+
"generate .pxi file for public declarations"),
|
|
105
|
+
('cython-directives=', None,
|
|
106
|
+
"compiler directive overrides"),
|
|
107
|
+
('cython-gdb', None,
|
|
108
|
+
"generate debug information for cygdb"),
|
|
109
|
+
('cython-compile-time-env', None,
|
|
110
|
+
"cython compile time environment"),
|
|
111
|
+
|
|
112
|
+
# For backwards compatibility.
|
|
113
|
+
('pyrex-cplus', None,
|
|
114
|
+
"generate C++ source files"),
|
|
115
|
+
('pyrex-create-listing', None,
|
|
116
|
+
"write errors to a listing file"),
|
|
117
|
+
('pyrex-line-directives', None,
|
|
118
|
+
"emit source line directives"),
|
|
119
|
+
('pyrex-include-dirs=', None,
|
|
120
|
+
"path to the Cython include files" + sep_by),
|
|
121
|
+
('pyrex-c-in-temp', None,
|
|
122
|
+
"put generated C files in temp directory"),
|
|
123
|
+
('pyrex-gen-pxi', None,
|
|
124
|
+
"generate .pxi file for public declarations"),
|
|
125
|
+
('pyrex-directives=', None,
|
|
126
|
+
"compiler directive overrides"),
|
|
127
|
+
('pyrex-gdb', None,
|
|
128
|
+
"generate debug information for cygdb"),
|
|
129
|
+
])
|
|
130
|
+
|
|
131
|
+
boolean_options.extend([
|
|
132
|
+
'cython-cplus', 'cython-create-listing', 'cython-line-directives',
|
|
133
|
+
'cython-c-in-temp', 'cython-gdb',
|
|
134
|
+
|
|
135
|
+
# For backwards compatibility.
|
|
136
|
+
'pyrex-cplus', 'pyrex-create-listing', 'pyrex-line-directives',
|
|
137
|
+
'pyrex-c-in-temp', 'pyrex-gdb',
|
|
138
|
+
])
|
|
139
|
+
|
|
140
|
+
def initialize_options(self):
|
|
141
|
+
_build_ext.build_ext.initialize_options(self)
|
|
142
|
+
self.cython_cplus = 0
|
|
143
|
+
self.cython_create_listing = 0
|
|
144
|
+
self.cython_line_directives = 0
|
|
145
|
+
self.cython_include_dirs = None
|
|
146
|
+
self.cython_directives = None
|
|
147
|
+
self.cython_c_in_temp = 0
|
|
148
|
+
self.cython_gen_pxi = 0
|
|
149
|
+
self.cython_gdb = False
|
|
150
|
+
self.no_c_in_traceback = 0
|
|
151
|
+
self.cython_compile_time_env = None
|
|
152
|
+
|
|
153
|
+
def __getattr__(self, name):
|
|
154
|
+
if name[:6] == 'pyrex_':
|
|
155
|
+
return getattr(self, 'cython_' + name[6:])
|
|
156
|
+
else:
|
|
157
|
+
return _build_ext.build_ext.__getattr__(self, name)
|
|
158
|
+
|
|
159
|
+
def __setattr__(self, name, value):
|
|
160
|
+
if name[:6] == 'pyrex_':
|
|
161
|
+
return setattr(self, 'cython_' + name[6:], value)
|
|
162
|
+
else:
|
|
163
|
+
# _build_ext.build_ext.__setattr__(self, name, value)
|
|
164
|
+
self.__dict__[name] = value
|
|
165
|
+
|
|
166
|
+
def finalize_options(self):
|
|
167
|
+
_build_ext.build_ext.finalize_options(self)
|
|
168
|
+
if self.cython_include_dirs is None:
|
|
169
|
+
self.cython_include_dirs = []
|
|
170
|
+
elif isinstance(self.cython_include_dirs, str):
|
|
171
|
+
self.cython_include_dirs = \
|
|
172
|
+
self.cython_include_dirs.split(os.pathsep)
|
|
173
|
+
if self.cython_directives is None:
|
|
174
|
+
self.cython_directives = {}
|
|
175
|
+
# finalize_options ()
|
|
176
|
+
|
|
177
|
+
def run(self):
|
|
178
|
+
# We have one shot at this before build_ext initializes the compiler.
|
|
179
|
+
# If --pyrex-gdb is in effect as a command line option or as option
|
|
180
|
+
# of any Extension module, disable optimization for the C or C++
|
|
181
|
+
# compiler.
|
|
182
|
+
if self.cython_gdb or [1 for ext in self.extensions
|
|
183
|
+
if getattr(ext, 'cython_gdb', False)]:
|
|
184
|
+
optimization.disable_optimization()
|
|
185
|
+
|
|
186
|
+
_build_ext.build_ext.run(self)
|
|
187
|
+
|
|
188
|
+
def check_extensions_list(self, extensions):
|
|
189
|
+
# Note: might get called multiple times.
|
|
190
|
+
_build_ext.build_ext.check_extensions_list(self, extensions)
|
|
191
|
+
for ext in self.extensions:
|
|
192
|
+
ext.sources = self.cython_sources(ext.sources, ext)
|
|
193
|
+
|
|
194
|
+
def cython_sources(self, sources, extension):
|
|
195
|
+
"""
|
|
196
|
+
Walk the list of source files in 'sources', looking for Cython
|
|
197
|
+
source files (.pyx and .py). Run Cython on all that are
|
|
198
|
+
found, and return a modified 'sources' list with Cython source
|
|
199
|
+
files replaced by the generated C (or C++) files.
|
|
200
|
+
"""
|
|
201
|
+
new_sources = []
|
|
202
|
+
cython_sources = []
|
|
203
|
+
cython_targets = {}
|
|
204
|
+
|
|
205
|
+
# Setup create_list and cplus from the extension options if
|
|
206
|
+
# Cython.Distutils.extension.Extension is used, otherwise just
|
|
207
|
+
# use what was parsed from the command-line or the configuration file.
|
|
208
|
+
# cplus will also be set to true is extension.language is equal to
|
|
209
|
+
# 'C++' or 'c++'.
|
|
210
|
+
#try:
|
|
211
|
+
# create_listing = self.cython_create_listing or \
|
|
212
|
+
# extension.cython_create_listing
|
|
213
|
+
# cplus = self.cython_cplus or \
|
|
214
|
+
# extension.cython_cplus or \
|
|
215
|
+
# (extension.language != None and \
|
|
216
|
+
# extension.language.lower() == 'c++')
|
|
217
|
+
#except AttributeError:
|
|
218
|
+
# create_listing = self.cython_create_listing
|
|
219
|
+
# cplus = self.cython_cplus or \
|
|
220
|
+
# (extension.language != None and \
|
|
221
|
+
# extension.language.lower() == 'c++')
|
|
222
|
+
|
|
223
|
+
create_listing = self.cython_create_listing or \
|
|
224
|
+
getattr(extension, 'cython_create_listing', 0)
|
|
225
|
+
line_directives = self.cython_line_directives or \
|
|
226
|
+
getattr(extension, 'cython_line_directives', 0)
|
|
227
|
+
no_c_in_traceback = self.no_c_in_traceback or \
|
|
228
|
+
getattr(extension, 'no_c_in_traceback', 0)
|
|
229
|
+
cplus = self.cython_cplus or getattr(extension, 'cython_cplus', 0) or \
|
|
230
|
+
(extension.language and extension.language.lower() == 'c++')
|
|
231
|
+
cython_gen_pxi = self.cython_gen_pxi or getattr(extension, 'cython_gen_pxi', 0)
|
|
232
|
+
cython_gdb = self.cython_gdb or getattr(extension, 'cython_gdb', False)
|
|
233
|
+
cython_compile_time_env = self.cython_compile_time_env or \
|
|
234
|
+
getattr(extension, 'cython_compile_time_env', None)
|
|
235
|
+
|
|
236
|
+
# Set up the include_path for the Cython compiler:
|
|
237
|
+
# 1. Start with the command line option.
|
|
238
|
+
# 2. Add in any (unique) paths from the extension
|
|
239
|
+
# cython_include_dirs (if Cython.Distutils.extension is used).
|
|
240
|
+
# 3. Add in any (unique) paths from the extension include_dirs
|
|
241
|
+
includes = list(self.cython_include_dirs)
|
|
242
|
+
try:
|
|
243
|
+
for i in extension.cython_include_dirs:
|
|
244
|
+
if i not in includes:
|
|
245
|
+
includes.append(i)
|
|
246
|
+
except AttributeError:
|
|
247
|
+
pass
|
|
248
|
+
|
|
249
|
+
# In case extension.include_dirs is a generator, evaluate it and keep
|
|
250
|
+
# result
|
|
251
|
+
extension.include_dirs = list(extension.include_dirs)
|
|
252
|
+
for i in extension.include_dirs:
|
|
253
|
+
if i not in includes:
|
|
254
|
+
includes.append(i)
|
|
255
|
+
|
|
256
|
+
# Set up Cython compiler directives:
|
|
257
|
+
# 1. Start with the command line option.
|
|
258
|
+
# 2. Add in any (unique) entries from the extension
|
|
259
|
+
# cython_directives (if Cython.Distutils.extension is used).
|
|
260
|
+
directives = dict(self.cython_directives)
|
|
261
|
+
if hasattr(extension, "cython_directives"):
|
|
262
|
+
directives.update(extension.cython_directives)
|
|
263
|
+
|
|
264
|
+
# Set the target file extension for C/C++ mode.
|
|
265
|
+
if cplus:
|
|
266
|
+
target_ext = '.cpp'
|
|
267
|
+
else:
|
|
268
|
+
target_ext = '.c'
|
|
269
|
+
|
|
270
|
+
# Decide whether to drop the generated C files into the temp dir
|
|
271
|
+
# or the source tree.
|
|
272
|
+
|
|
273
|
+
if not self.inplace and (self.cython_c_in_temp
|
|
274
|
+
or getattr(extension, 'cython_c_in_temp', 0)):
|
|
275
|
+
target_dir = os.path.join(self.build_temp, "pyrex")
|
|
276
|
+
for package_name in extension.name.split('.')[:-1]:
|
|
277
|
+
target_dir = os.path.join(target_dir, package_name)
|
|
278
|
+
else:
|
|
279
|
+
target_dir = None
|
|
280
|
+
|
|
281
|
+
newest_dependency = None
|
|
282
|
+
for source in sources:
|
|
283
|
+
(base, ext) = os.path.splitext(os.path.basename(source))
|
|
284
|
+
if ext == ".py":
|
|
285
|
+
# FIXME: we might want to special case this some more
|
|
286
|
+
ext = '.pyx'
|
|
287
|
+
if ext == ".pyx": # Cython source file
|
|
288
|
+
output_dir = target_dir or os.path.dirname(source)
|
|
289
|
+
new_sources.append(os.path.join(output_dir, base + target_ext))
|
|
290
|
+
cython_sources.append(source)
|
|
291
|
+
cython_targets[source] = new_sources[-1]
|
|
292
|
+
elif ext == '.pxi' or ext == '.pxd':
|
|
293
|
+
if newest_dependency is None \
|
|
294
|
+
or newer(source, newest_dependency):
|
|
295
|
+
newest_dependency = source
|
|
296
|
+
else:
|
|
297
|
+
new_sources.append(source)
|
|
298
|
+
|
|
299
|
+
if not cython_sources:
|
|
300
|
+
return new_sources
|
|
301
|
+
|
|
302
|
+
try:
|
|
303
|
+
from Cython.Compiler.Main \
|
|
304
|
+
import CompilationOptions, \
|
|
305
|
+
default_options as cython_default_options, \
|
|
306
|
+
compile as cython_compile
|
|
307
|
+
from Cython.Compiler.Errors import PyrexError
|
|
308
|
+
except ImportError:
|
|
309
|
+
e = sys.exc_info()[1]
|
|
310
|
+
print("failed to import Cython: %s" % e)
|
|
311
|
+
raise DistutilsPlatformError("Cython does not appear to be installed")
|
|
312
|
+
|
|
313
|
+
module_name = extension.name
|
|
314
|
+
|
|
315
|
+
for source in cython_sources:
|
|
316
|
+
target = cython_targets[source]
|
|
317
|
+
depends = [source] + list(extension.depends or ())
|
|
318
|
+
if source[-4:].lower() == ".pyx" and os.path.isfile(source[:-3] + "pxd"):
|
|
319
|
+
depends += [source[:-3] + "pxd"]
|
|
320
|
+
rebuild = self.force or newer_group(depends, target, 'newer')
|
|
321
|
+
if not rebuild and newest_dependency is not None:
|
|
322
|
+
rebuild = newer(newest_dependency, target)
|
|
323
|
+
if rebuild:
|
|
324
|
+
log.info("cythoning %s to %s", source, target)
|
|
325
|
+
self.mkpath(os.path.dirname(target))
|
|
326
|
+
if self.inplace:
|
|
327
|
+
output_dir = os.curdir
|
|
328
|
+
else:
|
|
329
|
+
output_dir = self.build_lib
|
|
330
|
+
options = CompilationOptions(cython_default_options,
|
|
331
|
+
use_listing_file = create_listing,
|
|
332
|
+
include_path = includes,
|
|
333
|
+
compiler_directives = directives,
|
|
334
|
+
output_file = target,
|
|
335
|
+
cplus = cplus,
|
|
336
|
+
emit_linenums = line_directives,
|
|
337
|
+
c_line_in_traceback = not no_c_in_traceback,
|
|
338
|
+
generate_pxi = cython_gen_pxi,
|
|
339
|
+
output_dir = output_dir,
|
|
340
|
+
gdb_debug = cython_gdb,
|
|
341
|
+
compile_time_env = cython_compile_time_env)
|
|
342
|
+
result = cython_compile(source, options=options,
|
|
343
|
+
full_module_name=module_name)
|
|
344
|
+
else:
|
|
345
|
+
log.info("skipping '%s' Cython extension (up-to-date)", target)
|
|
346
|
+
|
|
347
|
+
return new_sources
|
|
348
|
+
|
|
349
|
+
# cython_sources ()
|
|
350
|
+
|
|
351
|
+
# class build_ext
|