Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Xavier Thompson
cython
Commits
73d9b84f
Commit
73d9b84f
authored
8 years ago
by
Jeroen Demeyer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Additional build_dir test with all sources in src/
parent
00ab5d36
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
90 additions
and
0 deletions
+90
-0
tests/build/build_dir_src.srctree
tests/build/build_dir_src.srctree
+90
-0
No files found.
tests/build/build_dir_src.srctree
0 → 100644
View file @
73d9b84f
# Mostly the same test as build_dir.srctree but with everything inside
# a common "src" directory. We don't use --inplace and don't actually
# import the built modules.
PYTHON shutil_copy.py src/subdir src/fake
PYTHON setup.py build_ext
PYTHON check_paths.py
######## shutil_copy.py ########
import shutil, sys
shutil.copytree(sys.argv[1], sys.argv[2])
######## setup.py ########
from Cython.Build.Dependencies import cythonize
from Cython.Distutils.extension import Extension
from distutils.core import setup
ext_modules = cythonize(
Extension("a", ["src/a.pyx"]), build_dir="scratchA")
ext_modules += cythonize(
Extension("pkg.b", ["src/pkg/b.pyx"]), build_dir="scratchB")
setup(ext_modules=ext_modules)
######## src/a.pyx ########
cdef extern from "helper.h":
int value1
cdef extern from "subdir/helper.h":
int value2
cdef extern from "pkg/pkg_helper.h":
int value3
assert value1 == 100
assert value2 == 200
assert value3 == 300
######## src/helper.h ########
int value1 = 100;
######## src/subdir/helper.h ########
int value2 = 200;
######## src/pkg/__init__.py ########
######## src/pkg/b.pyx ########
cdef extern from "../fake/helper.h":
int value2
cdef extern from "pkg_helper.h":
int value3
cdef extern from "subdir/pkg_helper.h":
int value4
assert value2 == 200
assert value3 == 300
assert value4 == 400
######## src/pkg/pkg_helper.h ########
int value3 = 300;
######## src/pkg/subdir/pkg_helper.h ########
int value4 = 400;
######## check_paths.py ########
import os
assert os.path.exists("scratchA/src/a.c")
assert os.path.exists("scratchA/src/helper.h")
assert os.path.exists("scratchA/src/subdir/helper.h")
assert os.path.exists("scratchA/src/pkg/pkg_helper.h")
assert not os.path.exists("src/a.c")
assert os.path.exists("scratchB/src/pkg/b.c")
assert os.path.exists("scratchB/src/pkg/pkg_helper.h")
assert os.path.exists("scratchB/src/pkg/subdir/pkg_helper.h")
assert os.path.exists("scratchB/src/fake/helper.h")
assert not os.path.exists("src/b.c")
assert not os.path.exists("src/pkg/b.c")
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment