[geany/geany-plugins] 3325a0: Add support to build GeanyPy on Windows

Enrico Tröger git-noreply at xxxxx
Sun Apr 20 15:35:03 UTC 2014


Branch:      refs/heads/master
Author:      Enrico Tröger <enrico.troeger at uvena.de>
Committer:   Enrico Tröger <enrico.troeger at uvena.de>
Date:        Sun, 20 Apr 2014 15:35:03 UTC
Commit:      3325a0db66c67406c35d692994ce89744eb7f1e2
             https://github.com/geany/geany-plugins/commit/3325a0db66c67406c35d692994ce89744eb7f1e2

Log Message:
-----------
Add support to build GeanyPy on Windows


Modified Paths:
--------------
    geanypy/wscript_build
    geanypy/wscript_configure

Modified: geanypy/wscript_build
10 lines changed, 8 insertions(+), 2 deletions(-)
===================================================================
@@ -30,6 +30,9 @@ build_plugin(bld, name, includes=includes, libraries=libraries)
 
 
 # install Python modules (they will be byte-compiled on install)
+lib_dst = '%s/geany' % bld.env['GEANYPY_PYTHON_DIR']
+if target_is_win32(bld):
+    lib_dst = '${G_PREFIX}/%s' % lib_dst
 py_sources = ['geany/__init__.py',
               'geany/console.py',
               'geany/manager.py',
@@ -39,9 +42,12 @@ py_sources = ['geany/__init__.py',
 bld.new_task_gen(
     features        = 'py',
     source          = py_sources,
-    install_path    = '%s/geany' % bld.env['GEANYPY_PYTHON_DIR'])
+    install_path    = lib_dst)
 
 
 # install plugins
 start_dir = bld.path.find_dir('plugins')
-bld.install_files(bld.env['GEANYPY_PLUGIN_DIR'], start_dir.ant_glob('*.py'), cwd=start_dir)
+plugin_dst = bld.env['GEANYPY_PLUGIN_DIR']
+if target_is_win32(bld):
+    plugin_dst = '${G_PREFIX}/%s' % plugin_dst
+bld.install_files(plugin_dst, start_dir.ant_glob('*.py'), cwd=start_dir)


Modified: geanypy/wscript_configure
25 lines changed, 16 insertions(+), 9 deletions(-)
===================================================================
@@ -22,14 +22,20 @@ from build.wafutils import add_to_env_and_define, check_cfg_cached, target_is_wi
 from waflib.Errors import ConfigurationError
 
 PYTHON_DETECT_DSO_CODE = """
+import sys
+from ctypes.util import find_library
 from distutils.sysconfig import get_config_vars
 from os.path import join as path_join
 
-cvars = get_config_vars()
-# support multiarch-enabled distributions like Ubuntu
-if not 'MULTIARCH' in cvars.keys():
-    cvars['MULTIARCH'] = ''
-print(path_join(cvars['LIBDIR'], cvars['MULTIARCH'], cvars['LDLIBRARY']))
+if sys.platform == 'win32':
+    pyver = get_config_vars()['VERSION']
+    print(find_library('python%s.dll' % pyver))
+else:
+    cvars = get_config_vars()
+    # support multiarch-enabled distributions like Ubuntu
+    if not 'MULTIARCH' in cvars.keys():
+        cvars['MULTIARCH'] = ''
+    print(path_join(cvars['LIBDIR'], cvars['MULTIARCH'], cvars['LDLIBRARY']))
 """
 
 # Python
@@ -57,7 +63,9 @@ except:
     conf.end_msg(False)
     conf.fatal('Could not find the python DSO path')
 else:
-    dso_path = dso_path.strip()
+    # dso_path on Windows looks like c:\windows\system32\python27.dll, to avoid quoting problems
+    # of backslashes from Python to config.h to C code, simply use forward slashes (lazy workaround)
+    dso_path = dso_path.strip().replace('\\', '/')
     add_to_env_and_define(conf, 'GEANYPY_PYTHON_LIBRARY', dso_path, quote=True)
     conf.end_msg(dso_path)
 
@@ -69,9 +77,8 @@ if not 'LIB_PYEXT' in conf.env:
 # dirs
 is_win32 = target_is_win32(conf)
 if is_win32:
-    geanypy_lib_path = '%s/lib/geany-plugins/geanypy' % conf.env['G_PREFIX']
-    geanypy_data_path = '%s/%s/geany-plugins/geanypy' % (
-        conf.env['G_PREFIX'], conf.env['GEANYPLUGINS_DATADIR'])
+    geanypy_lib_path = '%s/geany-plugins/geanypy' % conf.env['LIBDIR']
+    geanypy_data_path = '%s/geany-plugins/geanypy' % conf.env['GEANYPLUGINS_DATADIR']
 else:
     geanypy_lib_path = '%s/geany-plugins/geanypy' % conf.env['LIBDIR']
     geanypy_data_path = '%s/geany-plugins/geanypy' % conf.env['GEANYPLUGINS_DATADIR']



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Plugins-Commits mailing list