This repository has been archived by the owner on Jan 30, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
transitive_dependencies.patch
78 lines (74 loc) · 2.42 KB
/
transitive_dependencies.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
commit 2285a087a3976ef301a8ea740fb5568f91930c8e
Author: Jeroen Demeyer <jdemeyer@cage.ugent.be>
Date: Tue Apr 21 14:40:12 2015 +0200
When merging a transitive_list, copy the list
diff --git a/Cython/Build/Dependencies.py b/Cython/Build/Dependencies.py
index 3fe6885..ae47c62 100644
--- a/Cython/Build/Dependencies.py
+++ b/Cython/Build/Dependencies.py
@@ -216,12 +216,13 @@ class DistutilsInfo(object):
self.values[key] = value
elif type is transitive_list:
if key in self.values:
- all = self.values[key]
+ # Change a *copy* of the list (Trac #845)
+ all = self.values[key][:]
for v in value:
if v not in all:
all.append(v)
- else:
- self.values[key] = value
+ value = all
+ self.values[key] = value
return self
def subs(self, aliases):
@@ -250,9 +251,8 @@ class DistutilsInfo(object):
for key, value in self.values.items():
type = distutils_settings[key]
if type in [list, transitive_list]:
- getattr(extension, key).extend(value)
- else:
- setattr(extension, key, value)
+ value = getattr(extension, key) + list(value)
+ setattr(extension, key, value)
@cython.locals(start=long, q=long, single_q=long, double_q=long, hash_mark=long,
end=long, k=long, counter=long, quote_len=long)
diff --git a/tests/compile/distutils_libraries_T845.srctree b/tests/compile/distutils_libraries_T845.srctree
new file mode 100644
index 0000000..69c8549
--- /dev/null
+++ b/tests/compile/distutils_libraries_T845.srctree
@@ -0,0 +1,33 @@
+PYTHON setup.py build_ext --inplace
+
+######## setup.py ########
+
+from Cython.Build import cythonize
+from Cython.Distutils.extension import Extension
+
+ext_modules = [
+ Extension("a", ["a.pyx"]),
+ Extension("x", ["x.pyx"]),
+ Extension("y", ["y.pyx"]),
+]
+
+ext_modules = cythonize(ext_modules)
+
+assert ext_modules[1].libraries == ["lib_x"]
+assert ext_modules[2].libraries == ["lib_y"]
+
+######## libx.pxd ########
+# distutils: libraries = lib_x
+
+######## liby.pxd ########
+# distutils: libraries = lib_y
+
+######## a.pyx ########
+cimport libx
+cimport liby
+
+######## x.pyx ########
+cimport libx
+
+######## y.pyx ########
+cimport liby