You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by sv...@apache.org on 2020/12/16 04:00:23 UTC

svn commit: r1884483 - in /subversion/branches/1.14.x: ./ subversion/bindings/swig/ subversion/bindings/swig/include/

Author: svn-role
Date: Wed Dec 16 04:00:22 2020
New Revision: 1884483

URL: http://svn.apache.org/viewvc?rev=1884483&view=rev
Log:
Merge r1883335 from trunk:

 * r1883335
   Fix unable to load *.pyd files with Python 3.8.x on Windows.
   Justification:
     Make Python bindings available with Python 3.8+ on Windows.
   Votes:
     +1: jun66j5, jcorvel

Modified:
    subversion/branches/1.14.x/   (props changed)
    subversion/branches/1.14.x/STATUS
    subversion/branches/1.14.x/subversion/bindings/swig/core.i
    subversion/branches/1.14.x/subversion/bindings/swig/include/svn_global.swg
    subversion/branches/1.14.x/subversion/bindings/swig/svn_client.i
    subversion/branches/1.14.x/subversion/bindings/swig/svn_delta.i
    subversion/branches/1.14.x/subversion/bindings/swig/svn_diff.i
    subversion/branches/1.14.x/subversion/bindings/swig/svn_fs.i
    subversion/branches/1.14.x/subversion/bindings/swig/svn_ra.i
    subversion/branches/1.14.x/subversion/bindings/swig/svn_repos.i
    subversion/branches/1.14.x/subversion/bindings/swig/svn_wc.i

Propchange: subversion/branches/1.14.x/
------------------------------------------------------------------------------
  Merged /subversion/trunk:r1883335

Modified: subversion/branches/1.14.x/STATUS
URL: http://svn.apache.org/viewvc/subversion/branches/1.14.x/STATUS?rev=1884483&r1=1884482&r2=1884483&view=diff
==============================================================================
--- subversion/branches/1.14.x/STATUS (original)
+++ subversion/branches/1.14.x/STATUS Wed Dec 16 04:00:22 2020
@@ -111,13 +111,6 @@ Veto-blocked changes:
 Approved changes:
 =================
 
- * r1883335
-   Fix unable to load *.pyd files with Python 3.8.x on Windows.
-   Justification:
-     Make Python bindings available with Python 3.8+ on Windows.
-   Votes:
-     +1: jun66j5, jcorvel
-
  * r1883337
    Remove uses of os.dup2() from run_tests.py in order to adapt the new
    console reader and writer on Windows since Python 3.6.

Modified: subversion/branches/1.14.x/subversion/bindings/swig/core.i
URL: http://svn.apache.org/viewvc/subversion/branches/1.14.x/subversion/bindings/swig/core.i?rev=1884483&r1=1884482&r2=1884483&view=diff
==============================================================================
--- subversion/branches/1.14.x/subversion/bindings/swig/core.i (original)
+++ subversion/branches/1.14.x/subversion/bindings/swig/core.i Wed Dec 16 04:00:22 2020
@@ -23,16 +23,16 @@
  *   of the more specific module files.
  */
 
+%include svn_global.swg
+
 #if defined(SWIGPYTHON)
-%module(package="libsvn") core
+%module(package="libsvn", moduleimport=SVN_PYTHON_MODULEIMPORT) core
 #elif defined(SWIGPERL)
 %module "SVN::_Core"
 #elif defined(SWIGRUBY)
 %module "svn::ext::core"
 #endif
 
-%include svn_global.swg
-
 %{
 #include <apr.h>
 #include <apr_general.h>

Modified: subversion/branches/1.14.x/subversion/bindings/swig/include/svn_global.swg
URL: http://svn.apache.org/viewvc/subversion/branches/1.14.x/subversion/bindings/swig/include/svn_global.swg?rev=1884483&r1=1884482&r2=1884483&view=diff
==============================================================================
--- subversion/branches/1.14.x/subversion/bindings/swig/include/svn_global.swg (original)
+++ subversion/branches/1.14.x/subversion/bindings/swig/include/svn_global.swg Wed Dec 16 04:00:22 2020
@@ -242,3 +242,40 @@ static VALUE *_global_vresult_address =
 /* Now, include the main Subversion typemap library. */
 %include svn_types.swg
 %include proxy.swg
+
+
+#ifdef SWIGPYTHON
+/* Since Python 3.8+ on Windows, DLL dependencies when loading *.pyd file
+ * searches only the system paths, the directory containing the *.pyd file and
+ * the directories added with os.add_dll_directory().
+ * See also https://bugs.python.org/issue36085.
+ */
+%define SVN_PYTHON_MODULEIMPORT
+"
+def _dll_paths():
+    import os
+    if hasattr(os, 'add_dll_directory'):  # Python 3.8+ on Windows
+        cookies = []
+        for path in os.environ.get('PATH', '').split(os.pathsep):
+            if path and os.path.isabs(path):
+                try:
+                    cookie = os.add_dll_directory(path)
+                except OSError:
+                    continue
+                else:
+                    cookies.append(cookie)
+        return cookies
+    else:
+        return ()
+
+_dll_paths = _dll_paths()
+try:
+    from . import $module
+finally:
+    _dll_path = None
+    for _dll_path in _dll_paths:
+        _dll_path.close()
+    del _dll_paths, _dll_path
+"
+%enddef
+#endif

Modified: subversion/branches/1.14.x/subversion/bindings/swig/svn_client.i
URL: http://svn.apache.org/viewvc/subversion/branches/1.14.x/subversion/bindings/swig/svn_client.i?rev=1884483&r1=1884482&r2=1884483&view=diff
==============================================================================
--- subversion/branches/1.14.x/subversion/bindings/swig/svn_client.i (original)
+++ subversion/branches/1.14.x/subversion/bindings/swig/svn_client.i Wed Dec 16 04:00:22 2020
@@ -21,15 +21,16 @@
  * svn_client.i: SWIG interface file for svn_client.h
  */
 
+%include svn_global.swg
+
 #if defined(SWIGPYTHON)
-%module(package="libsvn") client
+%module(package="libsvn", moduleimport=SVN_PYTHON_MODULEIMPORT) client
 #elif defined(SWIGPERL)
 %module "SVN::_Client"
 #elif defined(SWIGRUBY)
 %module "svn::ext::client"
 #endif
 
-%include svn_global.swg
 %import core.i
 %import svn_delta.i
 %import svn_wc.i

Modified: subversion/branches/1.14.x/subversion/bindings/swig/svn_delta.i
URL: http://svn.apache.org/viewvc/subversion/branches/1.14.x/subversion/bindings/swig/svn_delta.i?rev=1884483&r1=1884482&r2=1884483&view=diff
==============================================================================
--- subversion/branches/1.14.x/subversion/bindings/swig/svn_delta.i (original)
+++ subversion/branches/1.14.x/subversion/bindings/swig/svn_delta.i Wed Dec 16 04:00:22 2020
@@ -21,15 +21,16 @@
  * svn_delta.i: SWIG interface file for svn_delta.h
  */
 
+%include svn_global.swg
+
 #if defined(SWIGPYTHON)
-%module(package="libsvn") delta
+%module(package="libsvn", moduleimport=SVN_PYTHON_MODULEIMPORT) delta
 #elif defined(SWIGPERL)
 %module "SVN::_Delta"
 #elif defined(SWIGRUBY)
 %module "svn::ext::delta"
 #endif
 
-%include svn_global.swg
 %import core.i
 
 #ifdef SWIGRUBY

Modified: subversion/branches/1.14.x/subversion/bindings/swig/svn_diff.i
URL: http://svn.apache.org/viewvc/subversion/branches/1.14.x/subversion/bindings/swig/svn_diff.i?rev=1884483&r1=1884482&r2=1884483&view=diff
==============================================================================
--- subversion/branches/1.14.x/subversion/bindings/swig/svn_diff.i (original)
+++ subversion/branches/1.14.x/subversion/bindings/swig/svn_diff.i Wed Dec 16 04:00:22 2020
@@ -21,15 +21,16 @@
  * svn_diff.i: SWIG interface file for svn_diff.h
  */
 
+%include svn_global.swg
+
 #if defined(SWIGPYTHON)
-%module(package="libsvn") diff
+%module(package="libsvn", moduleimport=SVN_PYTHON_MODULEIMPORT) diff
 #elif defined(SWIGPERL)
 %module "SVN::_Diff"
 #elif defined(SWIGRUBY)
 %module "svn::ext::diff"
 #endif
 
-%include svn_global.swg
 %import core.i
 
 /* -----------------------------------------------------------------------

Modified: subversion/branches/1.14.x/subversion/bindings/swig/svn_fs.i
URL: http://svn.apache.org/viewvc/subversion/branches/1.14.x/subversion/bindings/swig/svn_fs.i?rev=1884483&r1=1884482&r2=1884483&view=diff
==============================================================================
--- subversion/branches/1.14.x/subversion/bindings/swig/svn_fs.i (original)
+++ subversion/branches/1.14.x/subversion/bindings/swig/svn_fs.i Wed Dec 16 04:00:22 2020
@@ -21,15 +21,16 @@
  * svn_fs.i: SWIG interface file for svn_fs.h
  */
 
+%include svn_global.swg
+
 #if defined(SWIGPYTHON)
-%module(package="libsvn") fs
+%module(package="libsvn", moduleimport=SVN_PYTHON_MODULEIMPORT) fs
 #elif defined(SWIGPERL)
 %module "SVN::_Fs"
 #elif defined(SWIGRUBY)
 %module "svn::ext::fs"
 #endif
 
-%include svn_global.swg
 %import core.i
 %import svn_delta.i
 

Modified: subversion/branches/1.14.x/subversion/bindings/swig/svn_ra.i
URL: http://svn.apache.org/viewvc/subversion/branches/1.14.x/subversion/bindings/swig/svn_ra.i?rev=1884483&r1=1884482&r2=1884483&view=diff
==============================================================================
--- subversion/branches/1.14.x/subversion/bindings/swig/svn_ra.i (original)
+++ subversion/branches/1.14.x/subversion/bindings/swig/svn_ra.i Wed Dec 16 04:00:22 2020
@@ -21,15 +21,16 @@
  * svn_ra.i: SWIG interface file for svn_ra.h
  */
 
+%include svn_global.swg
+
 #if defined(SWIGPYTHON)
-%module(package="libsvn") ra
+%module(package="libsvn", moduleimport=SVN_PYTHON_MODULEIMPORT) ra
 #elif defined(SWIGPERL)
 %module "SVN::_Ra"
 #elif defined(SWIGRUBY)
 %module "svn::ext::ra"
 #endif
 
-%include svn_global.swg
 %import core.i
 %import svn_delta.i
 

Modified: subversion/branches/1.14.x/subversion/bindings/swig/svn_repos.i
URL: http://svn.apache.org/viewvc/subversion/branches/1.14.x/subversion/bindings/swig/svn_repos.i?rev=1884483&r1=1884482&r2=1884483&view=diff
==============================================================================
--- subversion/branches/1.14.x/subversion/bindings/swig/svn_repos.i (original)
+++ subversion/branches/1.14.x/subversion/bindings/swig/svn_repos.i Wed Dec 16 04:00:22 2020
@@ -21,15 +21,16 @@
  * svn_repos.i: SWIG interface file for svn_repos.h
  */
 
+%include svn_global.swg
+
 #if defined(SWIGPYTHON)
-%module(package="libsvn") repos
+%module(package="libsvn", moduleimport=SVN_PYTHON_MODULEIMPORT) repos
 #elif defined(SWIGPERL)
 %module "SVN::_Repos"
 #elif defined(SWIGRUBY)
 %module "svn::ext::repos"
 #endif
 
-%include svn_global.swg
 %import core.i
 %import svn_delta.i
 %import svn_fs.i

Modified: subversion/branches/1.14.x/subversion/bindings/swig/svn_wc.i
URL: http://svn.apache.org/viewvc/subversion/branches/1.14.x/subversion/bindings/swig/svn_wc.i?rev=1884483&r1=1884482&r2=1884483&view=diff
==============================================================================
--- subversion/branches/1.14.x/subversion/bindings/swig/svn_wc.i (original)
+++ subversion/branches/1.14.x/subversion/bindings/swig/svn_wc.i Wed Dec 16 04:00:22 2020
@@ -21,15 +21,16 @@
  * svn_wc.i: SWIG interface file for svn_wc.h
  */
 
+%include svn_global.swg
+
 #if defined(SWIGPYTHON)
-%module(package="libsvn") wc
+%module(package="libsvn", moduleimport=SVN_PYTHON_MODULEIMPORT) wc
 #elif defined(SWIGPERL)
 %module "SVN::_Wc"
 #elif defined(SWIGRUBY)
 %module "svn::ext::wc"
 #endif
 
-%include svn_global.swg
 %import core.i
 %import svn_delta.i
 %import svn_ra.i