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
37ef43ae
Commit
37ef43ae
authored
Feb 20, 2016
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'fix_dependencies_dir' of
https://github.com/jdemeyer/cython
into fix_dependencies_dir
parents
70ac174e
73d9b84f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
93 additions
and
4 deletions
+93
-4
Cython/Build/Dependencies.py
Cython/Build/Dependencies.py
+3
-4
tests/build/build_dir_src.srctree
tests/build/build_dir_src.srctree
+90
-0
No files found.
Cython/Build/Dependencies.py
View file @
37ef43ae
...
@@ -46,8 +46,7 @@ from distutils.extension import Extension
...
@@ -46,8 +46,7 @@ from distutils.extension import Extension
from
..
import
Utils
from
..
import
Utils
from
..Utils
import
(
cached_function
,
cached_method
,
path_exists
,
from
..Utils
import
(
cached_function
,
cached_method
,
path_exists
,
safe_makedirs
,
copy_file_to_dir_if_changed
,
find_root_package_dir
,
safe_makedirs
,
copy_file_to_dir_if_changed
,
is_package_dir
)
is_package_dir
)
from
..Compiler.Main
import
Context
,
CompilationOptions
,
default_options
from
..Compiler.Main
import
Context
,
CompilationOptions
,
default_options
join_path
=
cached_function
(
os
.
path
.
join
)
join_path
=
cached_function
(
os
.
path
.
join
)
...
@@ -711,7 +710,7 @@ def create_extension_list(patterns, exclude=None, ctx=None, aliases=None, quiet=
...
@@ -711,7 +710,7 @@ def create_extension_list(patterns, exclude=None, ctx=None, aliases=None, quiet=
else
:
else
:
extra_sources
=
None
extra_sources
=
None
if
'depends'
in
kwds
:
if
'depends'
in
kwds
:
depends
=
resolve_depends
(
kwds
[
'depends'
],
(
kwds
.
get
(
'include_dirs'
)
or
[])
+
[
find_root_package_dir
(
file
)
])
depends
=
resolve_depends
(
kwds
[
'depends'
],
(
kwds
.
get
(
'include_dirs'
)
or
[])
+
[
"."
])
if
template
is
not
None
:
if
template
is
not
None
:
# Always include everything from the template.
# Always include everything from the template.
depends
=
set
(
template
.
depends
).
union
(
depends
)
depends
=
set
(
template
.
depends
).
union
(
depends
)
...
@@ -790,7 +789,7 @@ def cythonize(module_list, exclude=None, nthreads=0, aliases=None, quiet=False,
...
@@ -790,7 +789,7 @@ def cythonize(module_list, exclude=None, nthreads=0, aliases=None, quiet=False,
to_compile
=
[]
to_compile
=
[]
for
m
in
module_list
:
for
m
in
module_list
:
if
build_dir
:
if
build_dir
:
root
=
os
.
path
.
abspath
(
find_root_package_dir
(
m
.
sources
[
0
])
)
root
=
os
.
getcwd
(
)
def
copy_to_build_dir
(
filepath
,
root
=
root
):
def
copy_to_build_dir
(
filepath
,
root
=
root
):
filepath_abs
=
os
.
path
.
abspath
(
filepath
)
filepath_abs
=
os
.
path
.
abspath
(
filepath
)
if
os
.
path
.
isabs
(
filepath
):
if
os
.
path
.
isabs
(
filepath
):
...
...
tests/build/build_dir_src.srctree
0 → 100644
View file @
37ef43ae
# 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")
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