Skip to content

Instantly share code, notes, and snippets.

@jun66j5
Last active May 8, 2020 17:13
Show Gist options
  • Save jun66j5/fd901e3d52fc7fb1e6c19e509b10039d to your computer and use it in GitHub Desktop.
Save jun66j5/fd901e3d52fc7fb1e6c19e509b10039d to your computer and use it in GitHub Desktop.
Index: subversion/bindings/swig/core.i
===================================================================
--- subversion/bindings/swig/core.i (revision 1877480)
+++ subversion/bindings/swig/core.i (working copy)
@@ -23,8 +23,10 @@
* of the more specific module files.
*/
+%include svn_module.swg
+
#if defined(SWIGPYTHON)
-%module(package="libsvn") core
+%module(package="libsvn", moduleimport=MODULEIMPORT) core
#elif defined(SWIGPERL)
%module "SVN::_Core"
#elif defined(SWIGRUBY)
Index: subversion/bindings/swig/include/svn_module.swg
===================================================================
--- subversion/bindings/swig/include/svn_module.swg (nonexistent)
+++ subversion/bindings/swig/include/svn_module.swg (working copy)
@@ -0,0 +1,45 @@
+/*
+ * ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * ====================================================================
+ */
+
+#if defined(SWIGPYTHON)
+%define MODULEIMPORT
+"
+def _dll_paths():
+ import os
+ paths = []
+ if hasattr(os, 'add_dll_directory'): # Python 3.8+ on Windows
+ for path in filter(None, os.environ.get('PATH', '').split(';')):
+ # Add absolute and local paths
+ if os.path.isabs(path) and not os.path.ismount(path):
+ paths.append(os.add_dll_directory(path))
+ return paths
+
+_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
Index: subversion/bindings/swig/svn_client.i
===================================================================
--- subversion/bindings/swig/svn_client.i (revision 1877480)
+++ subversion/bindings/swig/svn_client.i (working copy)
@@ -21,8 +21,10 @@
* svn_client.i: SWIG interface file for svn_client.h
*/
+%include svn_module.swg
+
#if defined(SWIGPYTHON)
-%module(package="libsvn") client
+%module(package="libsvn", moduleimport=MODULEIMPORT) client
#elif defined(SWIGPERL)
%module "SVN::_Client"
#elif defined(SWIGRUBY)
Index: subversion/bindings/swig/svn_delta.i
===================================================================
--- subversion/bindings/swig/svn_delta.i (revision 1877480)
+++ subversion/bindings/swig/svn_delta.i (working copy)
@@ -21,8 +21,10 @@
* svn_delta.i: SWIG interface file for svn_delta.h
*/
+%include svn_module.swg
+
#if defined(SWIGPYTHON)
-%module(package="libsvn") delta
+%module(package="libsvn", moduleimport=MODULEIMPORT) delta
#elif defined(SWIGPERL)
%module "SVN::_Delta"
#elif defined(SWIGRUBY)
Index: subversion/bindings/swig/svn_diff.i
===================================================================
--- subversion/bindings/swig/svn_diff.i (revision 1877480)
+++ subversion/bindings/swig/svn_diff.i (working copy)
@@ -21,8 +21,10 @@
* svn_diff.i: SWIG interface file for svn_diff.h
*/
+%include svn_module.swg
+
#if defined(SWIGPYTHON)
-%module(package="libsvn") diff
+%module(package="libsvn", moduleimport=MODULEIMPORT) diff
#elif defined(SWIGPERL)
%module "SVN::_Diff"
#elif defined(SWIGRUBY)
Index: subversion/bindings/swig/svn_fs.i
===================================================================
--- subversion/bindings/swig/svn_fs.i (revision 1877480)
+++ subversion/bindings/swig/svn_fs.i (working copy)
@@ -21,8 +21,10 @@
* svn_fs.i: SWIG interface file for svn_fs.h
*/
+%include svn_module.swg
+
#if defined(SWIGPYTHON)
-%module(package="libsvn") fs
+%module(package="libsvn", moduleimport=MODULEIMPORT) fs
#elif defined(SWIGPERL)
%module "SVN::_Fs"
#elif defined(SWIGRUBY)
Index: subversion/bindings/swig/svn_ra.i
===================================================================
--- subversion/bindings/swig/svn_ra.i (revision 1877480)
+++ subversion/bindings/swig/svn_ra.i (working copy)
@@ -21,8 +21,10 @@
* svn_ra.i: SWIG interface file for svn_ra.h
*/
+%include svn_module.swg
+
#if defined(SWIGPYTHON)
-%module(package="libsvn") ra
+%module(package="libsvn", moduleimport=MODULEIMPORT) ra
#elif defined(SWIGPERL)
%module "SVN::_Ra"
#elif defined(SWIGRUBY)
Index: subversion/bindings/swig/svn_repos.i
===================================================================
--- subversion/bindings/swig/svn_repos.i (revision 1877480)
+++ subversion/bindings/swig/svn_repos.i (working copy)
@@ -21,8 +21,10 @@
* svn_repos.i: SWIG interface file for svn_repos.h
*/
+%include svn_module.swg
+
#if defined(SWIGPYTHON)
-%module(package="libsvn") repos
+%module(package="libsvn", moduleimport=MODULEIMPORT) repos
#elif defined(SWIGPERL)
%module "SVN::_Repos"
#elif defined(SWIGRUBY)
Index: subversion/bindings/swig/svn_wc.i
===================================================================
--- subversion/bindings/swig/svn_wc.i (revision 1877480)
+++ subversion/bindings/swig/svn_wc.i (working copy)
@@ -21,8 +21,10 @@
* svn_wc.i: SWIG interface file for svn_wc.h
*/
+%include svn_module.swg
+
#if defined(SWIGPYTHON)
-%module(package="libsvn") wc
+%module(package="libsvn", moduleimport=MODULEIMPORT) wc
#elif defined(SWIGPERL)
%module "SVN::_Wc"
#elif defined(SWIGRUBY)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment