Permalink
Browse files

Add support to build GeanyPy on Windows

  • Loading branch information...
1 parent 390f005 commit 3325a0db66c67406c35d692994ce89744eb7f1e2 @eht16 eht16 committed Apr 20, 2014
Showing with 24 additions and 11 deletions.
  1. +8 −2 geanypy/wscript_build
  2. +16 −9 geanypy/wscript_configure
View
@@ -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)
View
@@ -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']

0 comments on commit 3325a0d

Please sign in to comment.