]> git.pld-linux.org Git - packages/subversion.git/blob - subversion-swig_py.patch
- rebuild with perl 5.24.0
[packages/subversion.git] / subversion-swig_py.patch
1 ------------------------------------------------------------------------
2 r1721488 | jamessan | 2015-12-23 05:46:42 +0100 (śro, 23 gru 2015) | 13 lines
3
4 Enable building bindings with SWIG >= 3.0.6
5
6 This reinstates r1690591 and adds the minimum version checks for SWIG
7 proposed by Joe Orton in http://svn.haxx.se/dev/archive-2015-07/0028.shtml.
8
9 * build/ac-macros/swig.m4,
10   subversion/bindings/swig/INSTALL:
11   Change version check and documentation to allow SWIG >= 3.0.6
12
13 * subversion/bindings/swig/include/proxy.swg:
14   Use %{ %} with %pythoncode so comments avoid the SWIG processor,
15   fixing the bindings with SWIG >= 3.0.6.
16
17
18 Index: subversion/bindings/swig/include/proxy.swg
19 ===================================================================
20 --- subversion/bindings/swig/include/proxy.swg  (revision 1721487)
21 +++ subversion/bindings/swig/include/proxy.swg  (revision 1721488)
22 @@ -62,7 +62,7 @@
23  
24  /* Default code for all wrapped proxy classes in Python */
25  %define %proxy_pythoncode(TYPE)
26 -%pythoncode {
27 +%pythoncode %{
28    def set_parent_pool(self, parent_pool=None):
29      """Create a new proxy object for TYPE"""
30      import libsvn.core, weakref
31 @@ -104,7 +104,7 @@
32      self.__dict__.setdefault("_members",{})[name] = value
33  
34      return _swig_setattr(self, self.__class__, name, value)
35 -}
36 +%}
37  %enddef
38  
39  /* Define a proxy for wrapping an existing struct */
40 Index: subversion/bindings/swig/INSTALL
41 ===================================================================
42 --- subversion/bindings/swig/INSTALL    (revision 1721487)
43 +++ subversion/bindings/swig/INSTALL    (revision 1721488)
44 @@ -65,7 +65,7 @@
45  
46  
47  Step 1:  Install a suitable version of SWIG (which is
48 -         currently SWIG version 1.3.24 or later, but not SWIG 3.0.0 or newer).
49 +         currently SWIG version 1.3.24 or later, excluding SWIG 3.0.0 through 3.0.5).
50  
51      * Perhaps your distribution packages a suitable version - if it does
52        install it, and skip to the last bullet point in this section.
53 Index: build/ac-macros/swig.m4
54 ===================================================================
55 --- build/ac-macros/swig.m4     (revision 1721487)
56 +++ build/ac-macros/swig.m4     (revision 1721488)
57 @@ -92,12 +92,12 @@
58      # If you change the required swig version number, don't forget to update:
59      #   subversion/bindings/swig/INSTALL
60      if test -n "$SWIG_VERSION" && test "$SWIG_VERSION" -ge "103024" && \
61 -       test "$SWIG_VERSION" -lt "300000"; then
62 +       ( test "$SWIG_VERSION" -lt "300000" || test "$SWIG_VERSION" -ge "300006" ); then
63        SWIG_SUITABLE=yes
64      else
65        SWIG_SUITABLE=no
66        AC_MSG_WARN([Detected SWIG version $SWIG_VERSION_RAW])
67 -      AC_MSG_WARN([Subversion requires SWIG >= 1.3.24 and < 3.0.0 ])
68 +      AC_MSG_WARN([Subversion requires SWIG >= 1.3.24 and < 3.0.0, or >= 3.0.6 ])
69      fi
70    fi
71   
72
73 ------------------------------------------------------------------------
74 r1721648 | jamessan | 2015-12-24 19:33:13 +0100 (czw, 24 gru 2015) | 27 lines
75
76 Fix Python bindings with SWIG < 3.0.6, followup on 1721488.
77
78 “%pythoncode { ... }” had to be changed to “%pythoncode %{ ... %}” to avoid
79 macro expansion (done in r1721488).  This was a latent bug in the bindings
80 exposed by stricter parsing in SWIG 3.x.
81
82 However, there was a bug in SWIG through 3.0.6 which would remove part of the
83 commented lines inside the “%pythoncode %{ ... %}” block.  This caused the
84 "right" fix to break everywhere except 3.0.6+.
85
86 As discussed in the SWIG bug tracker[0], an alternative form of the pythoncode
87 directive can be used to inline the contents of a specified file.  Use of this
88 form works in all supported SWIG versions.
89
90 [0]: https://github.com/swig/swig/issues/379#issuecomment-107664345
91
92 * subversion/bindings/swig/include/proxy.swg:
93   (proxy_pythoncode): Copy %pythoncode contents to ...
94
95 * subversion/bindings/swig/include/proxy.py:
96   ... new file which is included in proxy.swg via “%pythoncode "..."”
97   directive.
98
99 * build/ac-macros/swig.m4
100   subversion/bindings/swig/INSTALL:
101   Remove 3.x related SWIG restrictions.  All SWIG versions are supported again.
102
103
104 Index: subversion/bindings/swig/include/proxy.py
105 ===================================================================
106 --- subversion/bindings/swig/include/proxy.py   (nonexistent)
107 +++ subversion/bindings/swig/include/proxy.py   (revision 1721648)
108 @@ -0,0 +1,41 @@
109 +  def set_parent_pool(self, parent_pool=None):
110 +    """Create a new proxy object for TYPE"""
111 +    import libsvn.core, weakref
112 +    self.__dict__["_parent_pool"] = \
113 +      parent_pool or libsvn.core.application_pool;
114 +    if self.__dict__["_parent_pool"]:
115 +      self.__dict__["_is_valid"] = weakref.ref(
116 +        self.__dict__["_parent_pool"]._is_valid)
117 +
118 +  def assert_valid(self):
119 +    """Assert that this object is using valid pool memory"""
120 +    if "_is_valid" in self.__dict__:
121 +      assert self.__dict__["_is_valid"](), "Variable has already been deleted"
122 +
123 +  def __getattr__(self, name):
124 +    """Get an attribute from this object"""
125 +    self.assert_valid()
126 +
127 +    value = _swig_getattr(self, self.__class__, name)
128 +
129 +    # If we got back a different object than we have, we need to copy all our
130 +    # metadata into it, so that it looks identical
131 +    members = self.__dict__.get("_members")
132 +    if members is not None:
133 +      _copy_metadata_deep(value, members.get(name))
134 +
135 +    # Verify that the new object is good
136 +    _assert_valid_deep(value)
137 +
138 +    return value
139 +
140 +  def __setattr__(self, name, value):
141 +    """Set an attribute on this object"""
142 +    self.assert_valid()
143 +
144 +    # Save a copy of the object, so that the garbage
145 +    # collector won't kill the object while it's in
146 +    # SWIG-land
147 +    self.__dict__.setdefault("_members",{})[name] = value
148 +
149 +    return _swig_setattr(self, self.__class__, name, value)
150
151 Property changes on: subversion/bindings/swig/include/proxy.py
152 ___________________________________________________________________
153 Added: svn:eol-style
154 ## -0,0 +1 ##
155 +native
156 \ No newline at end of property
157 Index: subversion/bindings/swig/include/proxy.swg
158 ===================================================================
159 --- subversion/bindings/swig/include/proxy.swg  (revision 1721647)
160 +++ subversion/bindings/swig/include/proxy.swg  (revision 1721648)
161 @@ -60,51 +60,11 @@
162          value.assert_valid()
163  %}
164  
165 -/* Default code for all wrapped proxy classes in Python */
166 +/* Default code for all wrapped proxy classes in Python.
167 + * Inline the code from a separate file to avoid issues with
168 + * SWIG mis-parsing the comments as preprocessor directives. */
169  %define %proxy_pythoncode(TYPE)
170 -%pythoncode %{
171 -  def set_parent_pool(self, parent_pool=None):
172 -    """Create a new proxy object for TYPE"""
173 -    import libsvn.core, weakref
174 -    self.__dict__["_parent_pool"] = \
175 -      parent_pool or libsvn.core.application_pool;
176 -    if self.__dict__["_parent_pool"]:
177 -      self.__dict__["_is_valid"] = weakref.ref(
178 -        self.__dict__["_parent_pool"]._is_valid)
179 -
180 -  def assert_valid(self):
181 -    """Assert that this object is using valid pool memory"""
182 -    if "_is_valid" in self.__dict__:
183 -      assert self.__dict__["_is_valid"](), "Variable has already been deleted"
184 -
185 -  def __getattr__(self, name):
186 -    """Get an attribute from this object"""
187 -    self.assert_valid()
188 -
189 -    value = _swig_getattr(self, self.__class__, name)
190 -
191 -    # If we got back a different object than we have, we need to copy all our
192 -    # metadata into it, so that it looks identical
193 -    members = self.__dict__.get("_members")
194 -    if members is not None:
195 -      _copy_metadata_deep(value, members.get(name))
196 -        
197 -    # Verify that the new object is good
198 -    _assert_valid_deep(value)
199 -
200 -    return value
201 -
202 -  def __setattr__(self, name, value):
203 -    """Set an attribute on this object"""
204 -    self.assert_valid()
205 -
206 -    # Save a copy of the object, so that the garbage
207 -    # collector won't kill the object while it's in
208 -    # SWIG-land
209 -    self.__dict__.setdefault("_members",{})[name] = value
210 -
211 -    return _swig_setattr(self, self.__class__, name, value)
212 -%}
213 +%pythoncode "proxy.py"
214  %enddef
215  
216  /* Define a proxy for wrapping an existing struct */
217 Index: subversion/bindings/swig/INSTALL
218 ===================================================================
219 --- subversion/bindings/swig/INSTALL    (revision 1721647)
220 +++ subversion/bindings/swig/INSTALL    (revision 1721648)
221 @@ -65,7 +65,7 @@
222  
223  
224  Step 1:  Install a suitable version of SWIG (which is
225 -         currently SWIG version 1.3.24 or later, excluding SWIG 3.0.0 through 3.0.5).
226 +         currently SWIG version 1.3.24 or later).
227  
228      * Perhaps your distribution packages a suitable version - if it does
229        install it, and skip to the last bullet point in this section.
230 ------------------------------------------------------------------------
This page took 0.081708 seconds and 3 git commands to generate.