diff options
author | Eli Schwartz <eschwartz93@gmail.com> | 2022-08-05 05:49:39 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-05 11:49:39 +0200 |
commit | c656624a4fc638e4c0cc098dab0f59a6f8331b1c (patch) | |
tree | 2abb4a5d71f877be7c05e1235a30cf905fc6fcae /tests/build/depfile_package_cythonize.srctree | |
parent | 189f6684474b9d3c5e27696f2ed961657b951204 (diff) | |
download | cython-c656624a4fc638e4c0cc098dab0f59a6f8331b1c.tar.gz |
[0.29] implement the --depfile command-line option for the "cython" tool (GH-4949)release
Backports https://github.com/cython/cython/pull/4916
Diffstat (limited to 'tests/build/depfile_package_cythonize.srctree')
-rw-r--r-- | tests/build/depfile_package_cythonize.srctree | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/tests/build/depfile_package_cythonize.srctree b/tests/build/depfile_package_cythonize.srctree new file mode 100644 index 000000000..0ad4cab78 --- /dev/null +++ b/tests/build/depfile_package_cythonize.srctree @@ -0,0 +1,60 @@ +""" +PYTHON -m Cython.Build.Cythonize -i pkg --depfile +PYTHON package_test.py +""" + +######## package_test.py ######## + +import os.path + +def pkgpath(*args): + return os.path.join('pkg', *args) + +with open(os.path.join("pkg", "test.c.dep"), "r") as f: + contents = f.read().replace("\\\n", " ").replace("\n", " ") + +assert sorted(contents.split()) == sorted([pkgpath('test.c:'), pkgpath('sub', 'incl.pxi'), pkgpath('test.pxd'), pkgpath('test.pyx')]), contents + + +with open(os.path.join("pkg", "sub", "test.c.dep"), "r") as f: + contents = f.read().replace("\\\n", " ").replace("\n", " ") + +contents = [os.path.relpath(entry, '.') + if os.path.isabs(entry) else entry for entry in contents.split()] +assert sorted(contents) == sorted([pkgpath('sub', 'test.c:'), pkgpath('sub', 'incl.pxi'), pkgpath('sub', 'test.pyx'), pkgpath('test.pxd')]), contents # last is really one level up + + +######## pkg/__init__.py ######## + + +######## pkg/test.pyx ######## + +TEST = "pkg.test" + +include "sub/incl.pxi" + +cdef object get_str(): + return TEST + + +######## pkg/test.pxd ######## + +cdef object get_str() + + +######## pkg/sub/__init__.py ######## + + +######## pkg/sub/test.pyx ######## +# cython: language_level=3 + +from ..test cimport get_str + +include 'incl.pxi' + +TEST = 'pkg.sub.test' + + +######## pkg/sub/incl.pxi ######## + +pass |