From 7a7b3b5c68f9176d44d021524d599ff7f47cd27d Mon Sep 17 00:00:00 2001 From: Yevgen Muntyan <17531749+muntyan@users.noreply.github.com> Date: Sat, 17 Apr 2010 23:29:31 -0700 Subject: [PATCH] Python is back --- cmake/gtk.cmake | 2 + cmake/modules/FindMooCompilers.cmake | 2 +- cmake/modules/FindMooI18n.cmake | 38 +++- cmake/modules/FindMooPython.cmake | 52 ++++++ junk/moopython/CMakeLists.txt | 53 ------ junk/moopython/plugins/CMakeLists.cmake | 0 junk/moopython/pygtk/CMakeLists.cmake | 114 ------------ medit/CMakeLists.txt | 9 + medit/main.c | 7 +- moo/mooutils/moo-intltool-merge.cmake | 38 ++++ plat/win32/intltool-wrapper.bat.in | 2 +- plugins/CMakeLists.txt | 4 +- plugins/mooeditplugins.c | 3 +- plugins/moopython/CMakeLists.txt | 166 ++++++++++++++++++ {junk => plugins}/moopython/Makefile.ug | 0 {junk => plugins}/moopython/codegen/README | 0 .../moopython/codegen/__init__.py | 0 .../moopython/codegen/argtypes.py | 0 .../moopython/codegen/argtypes_m.py | 0 .../moopython/codegen/codegen.py | 43 ++--- .../moopython/codegen/definitions.py | 0 .../moopython/codegen/defsparser.py | 0 {junk => plugins}/moopython/codegen/docgen.py | 0 .../moopython/codegen/mergedefs.py | 0 {junk => plugins}/moopython/codegen/mkskel.py | 0 .../moopython/codegen/override.py | 0 .../moopython/codegen/reversewrapper.py | 0 .../moopython/codegen/scmexpr.py | 0 {junk => plugins}/moopython/genpygtk.cmake | 0 {junk => plugins}/moopython/moo-mod.c | 0 {junk => plugins}/moopython/moo.rc.in | 0 {junk => plugins}/moopython/moopython-api.h | 0 .../moopython/moopython-builtin.c | 0 .../moopython/moopython-builtin.h | 0 .../moopython/moopython-loader.c | 89 +++++++++- .../moopython/moopython-loader.h | 0 {junk => plugins}/moopython/moopython-mod.c | 0 .../moopython/moopython-pygtkmod.h | 0 {junk => plugins}/moopython/moopython-utils.c | 0 {junk => plugins}/moopython/moopython-utils.h | 2 +- plugins/moopython/plugins/CMakeLists.txt | 26 +++ .../moopython/plugins/Makefile.ug | 0 .../plugins/lib/insert_date_and_time.py | 0 .../moopython/plugins/lib/pyconsole.py | 0 .../moopython/plugins/medit/__init__.py | 0 .../moopython/plugins/medit/runpython.py | 0 .../moopython/plugins/pycmd.ini.in.in | 0 {junk => plugins}/moopython/plugins/pycmd.py | 0 .../moopython/plugins/pyproject/Makefile.ug | 0 .../plugins/pyproject/medit-mprj.xml.in | 0 .../plugins/pyproject/mprj/__init__.py | 0 .../plugins/pyproject/mprj/config/__init__.py | 0 .../plugins/pyproject/mprj/config/_config.py | 0 .../plugins/pyproject/mprj/config/_dict.py | 0 .../plugins/pyproject/mprj/config/_group.py | 0 .../plugins/pyproject/mprj/config/_item.py | 0 .../plugins/pyproject/mprj/config/_setting.py | 0 .../plugins/pyproject/mprj/config/_utils.py | 0 .../plugins/pyproject/mprj/config/_xml.py | 0 .../plugins/pyproject/mprj/config/test.py | 0 .../plugins/pyproject/mprj/config/view.py | 0 .../plugins/pyproject/mprj/factory.glade | 0 .../plugins/pyproject/mprj/factory.py | 0 .../plugins/pyproject/mprj/manager.py | 0 .../plugins/pyproject/mprj/optdialog.py | 0 .../plugins/pyproject/mprj/project.py | 0 .../plugins/pyproject/mprj/session.py | 0 .../plugins/pyproject/mprj/settings.py | 0 .../plugins/pyproject/mprj/simple.glade | 0 .../plugins/pyproject/mprj/simple.py | 0 .../moopython/plugins/pyproject/mprj/test.py | 0 .../plugins/pyproject/mprj/utils.glade | 0 .../moopython/plugins/pyproject/mprj/utils.py | 0 .../pyproject/project-plugin.ini.in.in | 0 .../plugins/pyproject/project-plugin.py | 0 .../moopython/plugins/pyproject/projects/c.py | 0 .../pyproject/projects/cproj/__init__.py | 0 .../pyproject/projects/cproj/config.py | 0 .../pyproject/projects/cproj/optdialog.py | 0 .../pyproject/projects/cproj/options.glade | 0 .../pyproject/projects/cproj/parser.py | 0 .../pyproject/projects/pyproj/__init__.py | 0 .../pyproject/projects/pyproj/config.py | 0 .../pyproject/projects/pyproj/optdialog.py | 0 .../pyproject/projects/pyproj/options.glade | 0 .../plugins/pyproject/projects/python.py | 0 {junk => plugins}/moopython/plugins/pytest.py | 0 .../moopython/plugins/python.ini.in.in | 0 {junk => plugins}/moopython/plugins/python.py | 0 .../moopython/plugins/simple.ini | 0 {junk => plugins}/moopython/plugins/simple.py | 0 .../moopython/plugins/terminal.ini.in.in | 0 .../moopython/plugins/terminal.py | 0 plugins/moopython/py2h.py | 37 ++++ .../moopython/pygtk/Makefile.incl | 0 {junk => plugins}/moopython/pygtk/moo-mod.py | 0 {junk => plugins}/moopython/pygtk/moo-pygtk.c | 0 {junk => plugins}/moopython/pygtk/moo-pygtk.h | 0 .../moopython/pygtk/mooapp-mod.c | 0 .../moopython/pygtk/mooapp-mod.py | 0 .../moopython/pygtk/mooapp-pygtk.defs | 0 .../moopython/pygtk/mooapp-pygtk.override | 0 .../moopython/pygtk/moocommand.defs | 0 .../moopython/pygtk/mooedit-mod.c | 0 .../moopython/pygtk/mooedit-mod.py | 0 .../moopython/pygtk/mooedit-pygtk.defs | 0 .../moopython/pygtk/mooedit-pygtk.override | 2 +- .../moopython/pygtk/mooeditor.defs | 0 .../moopython/pygtk/moofileview.defs | 0 .../moopython/pygtk/moopaned.defs | 0 .../moopython/pygtk/moopaned.override | 0 .../moopython/pygtk/mooplugin.defs | 0 .../moopython/pygtk/mooutils-mod.c | 0 .../moopython/pygtk/mooutils-mod.py | 0 .../moopython/pygtk/mooutils-pygtk.defs | 0 .../moopython/pygtk/mooutils-pygtk.override | 0 {junk => plugins}/moopython/pymoo.ini.in | 0 {junk => plugins}/moopython/pymoo.rc.in | 0 118 files changed, 480 insertions(+), 209 deletions(-) create mode 100644 cmake/modules/FindMooPython.cmake delete mode 100644 junk/moopython/CMakeLists.txt delete mode 100644 junk/moopython/plugins/CMakeLists.cmake delete mode 100644 junk/moopython/pygtk/CMakeLists.cmake create mode 100644 moo/mooutils/moo-intltool-merge.cmake create mode 100644 plugins/moopython/CMakeLists.txt rename {junk => plugins}/moopython/Makefile.ug (100%) rename {junk => plugins}/moopython/codegen/README (100%) rename {junk => plugins}/moopython/codegen/__init__.py (100%) rename {junk => plugins}/moopython/codegen/argtypes.py (100%) rename {junk => plugins}/moopython/codegen/argtypes_m.py (100%) rename {junk => plugins}/moopython/codegen/codegen.py (98%) rename {junk => plugins}/moopython/codegen/definitions.py (100%) rename {junk => plugins}/moopython/codegen/defsparser.py (100%) rename {junk => plugins}/moopython/codegen/docgen.py (100%) rename {junk => plugins}/moopython/codegen/mergedefs.py (100%) rename {junk => plugins}/moopython/codegen/mkskel.py (100%) rename {junk => plugins}/moopython/codegen/override.py (100%) rename {junk => plugins}/moopython/codegen/reversewrapper.py (100%) rename {junk => plugins}/moopython/codegen/scmexpr.py (100%) rename {junk => plugins}/moopython/genpygtk.cmake (100%) rename {junk => plugins}/moopython/moo-mod.c (100%) rename {junk => plugins}/moopython/moo.rc.in (100%) rename {junk => plugins}/moopython/moopython-api.h (100%) rename {junk => plugins}/moopython/moopython-builtin.c (100%) rename {junk => plugins}/moopython/moopython-builtin.h (100%) rename {junk => plugins}/moopython/moopython-loader.c (76%) rename {junk => plugins}/moopython/moopython-loader.h (100%) rename {junk => plugins}/moopython/moopython-mod.c (100%) rename {junk => plugins}/moopython/moopython-pygtkmod.h (100%) rename {junk => plugins}/moopython/moopython-utils.c (100%) rename {junk => plugins}/moopython/moopython-utils.h (98%) create mode 100644 plugins/moopython/plugins/CMakeLists.txt rename {junk => plugins}/moopython/plugins/Makefile.ug (100%) rename {junk => plugins}/moopython/plugins/lib/insert_date_and_time.py (100%) rename {junk => plugins}/moopython/plugins/lib/pyconsole.py (100%) rename {junk => plugins}/moopython/plugins/medit/__init__.py (100%) rename {junk => plugins}/moopython/plugins/medit/runpython.py (100%) rename {junk => plugins}/moopython/plugins/pycmd.ini.in.in (100%) rename {junk => plugins}/moopython/plugins/pycmd.py (100%) rename {junk => plugins}/moopython/plugins/pyproject/Makefile.ug (100%) rename {junk => plugins}/moopython/plugins/pyproject/medit-mprj.xml.in (100%) rename {junk => plugins}/moopython/plugins/pyproject/mprj/__init__.py (100%) rename {junk => plugins}/moopython/plugins/pyproject/mprj/config/__init__.py (100%) rename {junk => plugins}/moopython/plugins/pyproject/mprj/config/_config.py (100%) rename {junk => plugins}/moopython/plugins/pyproject/mprj/config/_dict.py (100%) rename {junk => plugins}/moopython/plugins/pyproject/mprj/config/_group.py (100%) rename {junk => plugins}/moopython/plugins/pyproject/mprj/config/_item.py (100%) rename {junk => plugins}/moopython/plugins/pyproject/mprj/config/_setting.py (100%) rename {junk => plugins}/moopython/plugins/pyproject/mprj/config/_utils.py (100%) rename {junk => plugins}/moopython/plugins/pyproject/mprj/config/_xml.py (100%) rename {junk => plugins}/moopython/plugins/pyproject/mprj/config/test.py (100%) rename {junk => plugins}/moopython/plugins/pyproject/mprj/config/view.py (100%) rename {junk => plugins}/moopython/plugins/pyproject/mprj/factory.glade (100%) rename {junk => plugins}/moopython/plugins/pyproject/mprj/factory.py (100%) rename {junk => plugins}/moopython/plugins/pyproject/mprj/manager.py (100%) rename {junk => plugins}/moopython/plugins/pyproject/mprj/optdialog.py (100%) rename {junk => plugins}/moopython/plugins/pyproject/mprj/project.py (100%) rename {junk => plugins}/moopython/plugins/pyproject/mprj/session.py (100%) rename {junk => plugins}/moopython/plugins/pyproject/mprj/settings.py (100%) rename {junk => plugins}/moopython/plugins/pyproject/mprj/simple.glade (100%) rename {junk => plugins}/moopython/plugins/pyproject/mprj/simple.py (100%) rename {junk => plugins}/moopython/plugins/pyproject/mprj/test.py (100%) rename {junk => plugins}/moopython/plugins/pyproject/mprj/utils.glade (100%) rename {junk => plugins}/moopython/plugins/pyproject/mprj/utils.py (100%) rename {junk => plugins}/moopython/plugins/pyproject/project-plugin.ini.in.in (100%) rename {junk => plugins}/moopython/plugins/pyproject/project-plugin.py (100%) rename {junk => plugins}/moopython/plugins/pyproject/projects/c.py (100%) rename {junk => plugins}/moopython/plugins/pyproject/projects/cproj/__init__.py (100%) rename {junk => plugins}/moopython/plugins/pyproject/projects/cproj/config.py (100%) rename {junk => plugins}/moopython/plugins/pyproject/projects/cproj/optdialog.py (100%) rename {junk => plugins}/moopython/plugins/pyproject/projects/cproj/options.glade (100%) rename {junk => plugins}/moopython/plugins/pyproject/projects/cproj/parser.py (100%) rename {junk => plugins}/moopython/plugins/pyproject/projects/pyproj/__init__.py (100%) rename {junk => plugins}/moopython/plugins/pyproject/projects/pyproj/config.py (100%) rename {junk => plugins}/moopython/plugins/pyproject/projects/pyproj/optdialog.py (100%) rename {junk => plugins}/moopython/plugins/pyproject/projects/pyproj/options.glade (100%) rename {junk => plugins}/moopython/plugins/pyproject/projects/python.py (100%) rename {junk => plugins}/moopython/plugins/pytest.py (100%) rename {junk => plugins}/moopython/plugins/python.ini.in.in (100%) rename {junk => plugins}/moopython/plugins/python.py (100%) rename {junk => plugins}/moopython/plugins/simple.ini (100%) rename {junk => plugins}/moopython/plugins/simple.py (100%) rename {junk => plugins}/moopython/plugins/terminal.ini.in.in (100%) rename {junk => plugins}/moopython/plugins/terminal.py (100%) create mode 100644 plugins/moopython/py2h.py rename {junk => plugins}/moopython/pygtk/Makefile.incl (100%) rename {junk => plugins}/moopython/pygtk/moo-mod.py (100%) rename {junk => plugins}/moopython/pygtk/moo-pygtk.c (100%) rename {junk => plugins}/moopython/pygtk/moo-pygtk.h (100%) rename {junk => plugins}/moopython/pygtk/mooapp-mod.c (100%) rename {junk => plugins}/moopython/pygtk/mooapp-mod.py (100%) rename {junk => plugins}/moopython/pygtk/mooapp-pygtk.defs (100%) rename {junk => plugins}/moopython/pygtk/mooapp-pygtk.override (100%) rename {junk => plugins}/moopython/pygtk/moocommand.defs (100%) rename {junk => plugins}/moopython/pygtk/mooedit-mod.c (100%) rename {junk => plugins}/moopython/pygtk/mooedit-mod.py (100%) rename {junk => plugins}/moopython/pygtk/mooedit-pygtk.defs (100%) rename {junk => plugins}/moopython/pygtk/mooedit-pygtk.override (99%) rename {junk => plugins}/moopython/pygtk/mooeditor.defs (100%) rename {junk => plugins}/moopython/pygtk/moofileview.defs (100%) rename {junk => plugins}/moopython/pygtk/moopaned.defs (100%) rename {junk => plugins}/moopython/pygtk/moopaned.override (100%) rename {junk => plugins}/moopython/pygtk/mooplugin.defs (100%) rename {junk => plugins}/moopython/pygtk/mooutils-mod.c (100%) rename {junk => plugins}/moopython/pygtk/mooutils-mod.py (100%) rename {junk => plugins}/moopython/pygtk/mooutils-pygtk.defs (100%) rename {junk => plugins}/moopython/pygtk/mooutils-pygtk.override (100%) rename {junk => plugins}/moopython/pymoo.ini.in (100%) rename {junk => plugins}/moopython/pymoo.rc.in (100%) diff --git a/cmake/gtk.cmake b/cmake/gtk.cmake index c7bb4f08..b0b76821 100644 --- a/cmake/gtk.cmake +++ b/cmake/gtk.cmake @@ -20,6 +20,8 @@ ENDIF(WIN32 AND EXISTS "$ENV{GTKDIR}") MOO_ADD_COMPILE_DEFINITIONS(RELEASE -DG_DISABLE_CAST_CHECKS -DG_DISABLE_ASSERT) MOO_ADD_COMPILER_FLAGS(GCC WIN32 -mms-bitfields) +FIND_PACKAGE(MooPython) + PKG_CHECK_MODULES(LIBXML2 REQUIRED libxml-2.0) LIST(APPEND MOO_DEP_LIBS ${LIBXML2_LIBRARIES}) INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIRS}) diff --git a/cmake/modules/FindMooCompilers.cmake b/cmake/modules/FindMooCompilers.cmake index 3186234b..4decb936 100644 --- a/cmake/modules/FindMooCompilers.cmake +++ b/cmake/modules/FindMooCompilers.cmake @@ -162,7 +162,7 @@ ENDMACRO(MOO_ADD_COMPILE_DEFINITIONS) # DEBUG # -MOO_ADD_COMPILE_DEFINITIONS(DEBUG -DMOO_DEBUG -DDEBUG -D_DEBUG) +MOO_ADD_COMPILE_DEFINITIONS(DEBUG -DMOO_DEBUG -DDEBUG) ########################################################################### diff --git a/cmake/modules/FindMooI18n.cmake b/cmake/modules/FindMooI18n.cmake index 422bb13d..08df8aa0 100644 --- a/cmake/modules/FindMooI18n.cmake +++ b/cmake/modules/FindMooI18n.cmake @@ -7,6 +7,30 @@ IF(ENABLE_NLS) ENDIF(NOT GETTEXT_FOUND) ENDIF(ENABLE_NLS) +MACRO(MOO_TRANSFORM_INI_FILES outvar) + FOREACH(_moo_ini_in_in_file ${ARGN}) + SET(_moo_ini_in_in_file_abs ${CMAKE_CURRENT_SOURCE_DIR}/${_moo_ini_in_in_file}) + STRING(REPLACE ".ini.in.in" ".ini.in" _moo_ini_in_file ${_moo_ini_in_in_file}) + SET(_moo_ini_in_file ${CMAKE_CURRENT_BINARY_DIR}/${_moo_ini_in_file}) + CONFIGURE_FILE(${_moo_ini_in_in_file} ${_moo_ini_in_file}) + STRING(REPLACE ".ini.in.in" ".ini" _moo_ini_file ${_moo_ini_in_in_file}) + SET(_moo_ini_file ${_moo_ini_file}) + LIST(APPEND ${outvar} ${CMAKE_CURRENT_BINARY_DIR}/${_moo_ini_file}) + IF(ENABLE_NLS) + ADD_CUSTOM_COMMAND(OUTPUT ${_moo_ini_file} + COMMAND ${INTLTOOL_MERGE_COMMAND} -d -u -c ${CMAKE_BINARY_DIR}/po/.intltool-merge-cache ${CMAKE_SOURCE_DIR}/po ${_moo_ini_in_file} ${_moo_ini_file} + DEPENDS ${_moo_ini_in_file}) + ELSE(ENABLE_NLS) + ADD_CUSTOM_COMMAND(OUTPUT ${_moo_ini_file} + COMMAND ${MOO_CMAKE_COMMAND} -D MOO_OS_BSD=${MOO_OS_BSD} + -D INPUT_FILE=${_moo_ini_in_file} + -D OUTPUT_FILE=${_moo_ini_file} + -P ${CMAKE_SOURCE_DIR}/moo/mooutils/moo-intltool-merge.cmake + DEPENDS ${_moo_ini_in_file}) + ENDIF(ENABLE_NLS) + ENDFOREACH(_moo_ini_in_in_file) +ENDMACRO(MOO_TRANSFORM_INI_FILES) + MACRO(MOO_ADD_MSG_CATALOG catalogname dir) IF(ENABLE_NLS) FILE(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/${dir}) @@ -36,13 +60,17 @@ IF(ENABLE_NLS) FIND_FILE(${var} ${script}) ENDIF(NOT "${var}") ENDMACRO(_MOO_FIND_INTLTOOL_VAR) - _MOO_FIND_INTLTOOL_VAR(INTLTOOL_UPDATE intltool-update) - _MOO_FIND_INTLTOOL_VAR(INTLTOOL_EXTRACT intltool-extract) - _MOO_FIND_INTLTOOL_VAR(INTLTOOL_MERGE intltool-merge) - CONFIGURE_FILE(${MOO_SOURCE_DIR}/plat/win32/intltool-wrapper.bat.in ${MOO_BINARY_DIR}/intltool-wrapper.bat) - SET(INTLTOOL_UPDATE_COMMAND ${MOO_BINARY_DIR}/intltool-wrapper.bat) + FOREACH(_moo_i18n_tool update extract merge) + STRING(TOUPPER ${_moo_i18n_tool} _moo_i18n_TOOL) + _MOO_FIND_INTLTOOL_VAR(INTLTOOL_${_moo_i18n_TOOL} intltool-${_moo_i18n_tool}) + SET(__MOO_INTLTOOL_SCRIPT ${INTLTOOL_${_moo_i18n_TOOL}}) + CONFIGURE_FILE(${MOO_SOURCE_DIR}/plat/win32/intltool-wrapper.bat.in ${MOO_BINARY_DIR}/intltool-${_moo_i18n_tool}-wrapper.bat) + SET(INTLTOOL_${_moo_i18n_TOOL}_COMMAND ${MOO_BINARY_DIR}/intltool-${_moo_i18n_tool}-wrapper.bat) + ENDFOREACH(_moo_i18n_tool) ELSE(WIN32) FIND_PROGRAM(INTLTOOL_UPDATE_COMMAND intltool-update) + FIND_PROGRAM(INTLTOOL_MERGE_COMMAND intltool-merge) + FIND_PROGRAM(INTLTOOL_EXTRACT_COMMAND intltool-extract) ENDIF(WIN32) SET(MOO_PO_DIR ${MOO_SOURCE_DIR}/po) diff --git a/cmake/modules/FindMooPython.cmake b/cmake/modules/FindMooPython.cmake new file mode 100644 index 00000000..3dc40add --- /dev/null +++ b/cmake/modules/FindMooPython.cmake @@ -0,0 +1,52 @@ +MOO_OPTION(MOO_ENABLE_PYTHON TRUE "Enable Python" HEADER TRUE) + +SET(PYTHON_DEV_FOUND FALSE) + +MACRO(MOO_GET_PYTHON_SYSCONFIG_VAR var value error) + SET(${error} FALSE) + EXECUTE_PROCESS(COMMAND "${PYTHON_EXECUTABLE}" -c "import distutils.sysconfig; print distutils.sysconfig.get_config_vars('${var}')[0]" + RESULT_VARIABLE _moo_gpsv_result + OUTPUT_VARIABLE _moo_gpsv_output + ERROR_VARIABLE _moo_gpsv_error + OUTPUT_STRIP_TRAILING_WHITESPACE) + IF(_moo_gpsv_result EQUAL 0) + SET(${value} "${_moo_gpsv_output}") + ELSE(_moo_gpsv_result EQUAL 0) + SET(${error} TRUE) + ENDIF(_moo_gpsv_result EQUAL 0) +ENDMACRO(MOO_GET_PYTHON_SYSCONFIG_VAR) + +IF(MOO_ENABLE_PYTHON) + PKG_CHECK_MODULES(PYGTK pygtk-2.0) + IF(PYGTK_FOUND) + _MOO_GET_PKG_CONFIG_VARIABLE(PYGTK_DEFS_DIR defsdir pygtk-2.0) + _MOO_GET_PKG_CONFIG_VARIABLE(PYGTK_CODEGEN_DIR codegendir pygtk-2.0) + MOO_GET_PYTHON_SYSCONFIG_VAR("INCLUDEPY" _moo_fp_includepy _moo_fp_error) + IF(NOT _moo_fp_error) + MOO_GET_PYTHON_SYSCONFIG_VAR("VERSION" _moo_fp_pyversion _moo_fp_error) + ENDIF(NOT _moo_fp_error) + IF(NOT _moo_fp_error AND WIN32) + MOO_GET_PYTHON_SYSCONFIG_VAR("prefix" _moo_fp_pyprefix _moo_fp_error) + ENDIF(NOT _moo_fp_error AND WIN32) + IF(NOT _moo_fp_error) + SET(PYTHON_LIBRARIES "python${_moo_fp_pyversion}") + FILE(TO_CMAKE_PATH "${_moo_fp_includepy}" PYTHON_INCLUDE_DIRS) + FILE(TO_CMAKE_PATH "${_moo_fp_pyprefix}/libs" PYTHON_LIBRARY_DIRS) + SET(PYTHON_DEV_FOUND TRUE) + ENDIF(NOT _moo_fp_error) + ENDIF(PYGTK_FOUND) +ENDIF(MOO_ENABLE_PYTHON) + +MOO_DEBUG(STATUS "PYTHON_DEV_FOUND = ${PYTHON_DEV_FOUND}") + +IF(PYTHON_DEV_FOUND) + MOO_DEBUG(STATUS "PYTHON_INCLUDE_DIRS = ${PYTHON_INCLUDE_DIRS}") + MOO_DEBUG(STATUS "PYTHON_LIBRARIES = ${PYTHON_LIBRARIES}") + MOO_DEBUG(STATUS "PYTHON_LIBRARY_DIRS = ${PYTHON_LIBRARY_DIRS}") + LIST(APPEND MOO_DEP_LIBS ${PYTHON_LIBRARIES}) + LINK_DIRECTORIES(${PYTHON_LIBRARY_DIRS} ${PYGTK_LIBRARY_DIRS}) +ELSE(PYTHON_DEV_FOUND) + SET(MOO_ENABLE_PYTHON FALSE) +ENDIF(PYTHON_DEV_FOUND) + +# -%- strip:true, indent-width:2 -%- diff --git a/junk/moopython/CMakeLists.txt b/junk/moopython/CMakeLists.txt deleted file mode 100644 index 1596bb69..00000000 --- a/junk/moopython/CMakeLists.txt +++ /dev/null @@ -1,53 +0,0 @@ -INCLUDE(plugins/CMakeLists.cmake) - -SET(MOOMOD_SOURCES - moo-mod.c - moopython-api.h - moopython-utils.h - moopython-utils.c - moopython-loader.h - moopython-loader.c -) - -SET(PYMOO_SOURCES - moopython-mod.c - moopython-pygtkmod.h - moopython-api.h - moopython-loader.h - moopython-loader.c - moopython-utils.h - moopython-utils.c -) - -SET(MOOPYTHON_SOURCES - moopython-builtin.h - moopython-builtin.c - moopython-api.h - moopython-loader.h - moopython-loader.c - moopython-utils.h - moopython-utils.c -) - -INCLUDE_DIRECTORIES( - ${CMAKE_CURRENT_SOURCE_DIR}/pygtk - ${CMAKE_CURRENT_BINARY_DIR}/pygtk - ${PYTHON_INCLUDE_PATH} - ${PYGTK_INCLUDE_DIRS} -) - -IF(WIN32 AND MOO_BUILD_SHARED_LIB) - ADD_DEFINITIONS(-DMOO_PYTHON_MODULE_DLL_NAME=\"pymoo.dll\") -ENDIF(WIN32 AND MOO_BUILD_SHARED_LIB) - -INCLUDE(pygtk/CMakeLists.cmake) - -IF(MOO_BUILD_SHARED_LIB) - MOO_ADD_LIBRARY(moomod MODULE ${MOOPYGTK_SOURCES}) - MOO_ADD_LIBRARY(pymoo MODULE) - TARGET_LINK_LIBRARIES(moomod moo ${PYGTK_LIBRARIES} ${PYTHON_LIBRARIES}) -ELSE(MOO_BUILD_SHARED_LIB) - MOO_ADD_LIBRARY(moopython ${MOOMOD_SOURCES} ${MOOPYGTK_SOURCES}) -ENDIF(MOO_BUILD_SHARED_LIB) - -# -%- strip:true -%- diff --git a/junk/moopython/plugins/CMakeLists.cmake b/junk/moopython/plugins/CMakeLists.cmake deleted file mode 100644 index e69de29b..00000000 diff --git a/junk/moopython/pygtk/CMakeLists.cmake b/junk/moopython/pygtk/CMakeLists.cmake deleted file mode 100644 index 3bb0620d..00000000 --- a/junk/moopython/pygtk/CMakeLists.cmake +++ /dev/null @@ -1,114 +0,0 @@ -SET(MOOPYGTK_SOURCES - pygtk/moo-pygtk.c - pygtk/moo-pygtk.h - pygtk/mooapp-mod.h - pygtk/mooedit-mod.h - pygtk/mooutils-mod.h - pygtk/moo-mod.h -) - -SET(mooedit_defs_files - pygtk/mooeditor.defs - pygtk/mooplugin.defs - pygtk/moocommand.defs -) - -SET(mooutils_defs_files - pygtk/moofileview.defs - pygtk/moopaned.defs -) -SET(mooutils_override_files - pygtk/moopaned.override -) - -IF(WIN32) - SET(codegen_platform --platform win32) -ELSE(WIN32) - SET(codegen_platform) -ENDIF(WIN32) - -SET(codegen_files - codegen/codegen.py - codegen/argtypes.py - codegen/argtypes_m.py - codegen/reversewrapper.py -) - -GET_FILENAME_COMPONENT(_moo_abs_srcdir ${CMAKE_CURRENT_SOURCE_DIR} ABSOLUTE) - -SET(codegen_script ${_moo_abs_srcdir}/codegen/codegen.py) -SET(codegen ${PYTHON_EXECUTABLE} ${codegen_script} ${codegen_platform} --pygtk-version=${PYGTK_MINOR_VERSION}) - -pygtk/mooutils-pygtk.c: pygtk/mooutils-pygtk.defs pygtk/mooutils-pygtk.override $(mooutils_override_files) $(mooutils_defs_files) $(codegen_files) - mkdir -p pygtk - $(codegen) --prefix _moo_utils - --load-types $(srcdir)/codegen/argtypes_m.py - --register $(PYGTK_DEFS_DIR)/gtk-types.defs - --register $(PYGTK_DEFS_DIR)/gdk-types.defs - --override $(srcdir)/pygtk/mooutils-pygtk.override - --outfilename pygtk/mooutils-pygtk.c - $(srcdir)/pygtk/mooutils-pygtk.defs > $@.tmp && - mv $@.tmp $@ - -pygtk/mooapp-pygtk.c: pygtk/mooapp-pygtk.defs pygtk/mooapp-pygtk.override $(codegen_files) - mkdir -p pygtk - $(codegen) --prefix _moo_app - --load-types $(srcdir)/codegen/argtypes_m.py - --register $(PYGTK_DEFS_DIR)/gtk-types.defs - --register $(PYGTK_DEFS_DIR)/gdk-types.defs - --register $(srcdir)/pygtk/mooutils-pygtk.defs - --override $(srcdir)/pygtk/mooapp-pygtk.override - --outfilename pygtk/mooapp-pygtk.c - $(srcdir)/pygtk/mooapp-pygtk.defs > $@.tmp && - mv $@.tmp $@ - -pygtk/mooedit-pygtk.c: pygtk/mooedit-pygtk.defs pygtk/mooedit-pygtk.override $(mooedit_defs_files) $(codegen_files) - mkdir -p pygtk - $(codegen) --prefix _moo_edit - --load-types $(srcdir)/codegen/argtypes_m.py - --register $(PYGTK_DEFS_DIR)/gtk-types.defs - --register $(PYGTK_DEFS_DIR)/gdk-types.defs - --register $(srcdir)/pygtk/mooutils-pygtk.defs - --override $(srcdir)/pygtk/mooedit-pygtk.override - --outfilename pygtk/mooedit-pygtk.c - $(srcdir)/pygtk/mooedit-pygtk.defs > $@.tmp && - mv $@.tmp $@ - -PY2H = $(srcdir)/../mooutils/py2h.sh -pygtk/%-mod.h: $(srcdir)/pygtk/%-mod.py $(PY2H) - mkdir -p pygtk - $(SHELL) $(PY2H) `echo $* | tr '[a-z]' '[A-Z]'`_PY $(srcdir)/pygtk/$*-mod.py > $@.tmp && - mv $@.tmp $@ - -FOREACH(_moo_comp utils edit app) - STRING(TOUPPER ${_moo_comp} _moo_COMP) - MOO_ADD_GENERATED_FILE( - ${CMAKE_CURRENT_BINARY_DIR}/pygtk/moo${_moo_comp}-pygtk.stamp - ${CMAKE_CURRENT_BINARY_DIR}/pygtk/moo${_moo_comp}-pygtk.c - ${MOO_${_moo_COMP}_PYGTK_COMMAND} - DEPENDS pygtk/moo${_moo_comp}-pygtk.defs pygtk/moo${_moo_comp}-pygtk.override ${codegen_files}) -ENDFOREACH(_moo_comp) - -# noinst_LTLIBRARIES += libmoopygtk.la -# -# libmoopygtk_la_SOURCES = $(moopygtk_sources) -# nodist_libmoopygtk_la_SOURCES = $(nodist_moopygtk_sources) -# libmoopygtk_la_LIBADD = -# -# libmoopygtk_la_CFLAGS = -# -Ipygtk -# $(MOO_CFLAGS) -# $(MOO_W_NO_WRITE_STRINGS) -# $(MOO_W_NO_UNUSED) -# $(PYTHON_INCLUDES) -# $(PYGTK_CFLAGS) -# -# libmoopygtk_la_CXXFLAGS = -# -Ipygtk -# $(MOO_CXXFLAGS) -# $(MOO_W_NO_WRITE_STRINGS) -# $(MOO_W_NO_UNUSED) -# $(PYTHON_INCLUDES) -# $(PYGTK_CFLAGS) - -# -%- strip: true -%- diff --git a/medit/CMakeLists.txt b/medit/CMakeLists.txt index e193ec88..e52b4276 100644 --- a/medit/CMakeLists.txt +++ b/medit/CMakeLists.txt @@ -6,9 +6,14 @@ IF(MOO_ENABLE_UNIT_TESTS AND NOT WIN32) ADD_DEFINITIONS(-DSRCDIR="${CMAKE_SOURCE_DIR}/medit") ENDIF(MOO_ENABLE_UNIT_TESTS AND NOT WIN32) +IF(MOO_ENABLE_PYTHON) + SET(moopythonlib moopython) +ENDIF(MOO_ENABLE_PYTHON) + SET(MEDIT_SOURCES mem-debug.h run-tests.h parse.h main.c) SET(medit_libs meditplugins + ${moopythonlib} moousertools mooapp smclient @@ -29,6 +34,10 @@ ADD_EXECUTABLE(medit WIN32 ${MEDIT_SOURCES}) TARGET_LINK_LIBRARIES(medit ${medit_libs} ${MOO_DEP_LIBS}) INSTALL(TARGETS medit DESTINATION ${BINDIR}) +IF(MOO_ENABLE_PYTHON) + ADD_DEPENDENCIES(medit python-plugins-ini) +ENDIF(MOO_ENABLE_PYTHON) + FIND_PACKAGE(MooDesktopFile) MOO_INSTALL_DESKTOP_FILE(medit.desktop.in) diff --git a/medit/main.c b/medit/main.c index d382c3a9..bd39b480 100644 --- a/medit/main.c +++ b/medit/main.c @@ -16,8 +16,8 @@ #include #include "mooapp/mooapp.h" #include "mooedit/mooplugin.h" -#ifdef MOO_PYTHON_BUILTIN -#include "moopython/moopython-builtin.h" +#ifdef MOO_ENABLE_PYTHON +#include "plugins/moopython/moopython-builtin.h" #endif #include "mooutils/mooi18n.h" #include "mooutils/mooutils-fs.h" @@ -66,11 +66,12 @@ MOO_DEFINE_TYPE_STATIC (MeditApp, medit_app, MOO_TYPE_APP) static void medit_app_init_plugins (G_GNUC_UNUSED MooApp *app) { -#ifdef MOO_PYTHON_BUILTIN +#ifdef MOO_ENABLE_PYTHON _moo_python_builtin_init (); #endif moo_plugin_init_builtin (); moo_plugin_read_dirs (); + _moo_user_tools_plugin_init (); } static void diff --git a/moo/mooutils/moo-intltool-merge.cmake b/moo/mooutils/moo-intltool-merge.cmake new file mode 100644 index 00000000..828b6905 --- /dev/null +++ b/moo/mooutils/moo-intltool-merge.cmake @@ -0,0 +1,38 @@ +# INPUT_FILE, OUTPUT_FILE + +FIND_PROGRAM(GSED gsed) +IF(GSED) + SET(SED_PROGRAM ${GSED} -r) +ELSEIF(MOO_OS_BSD) + SET(SED_PROGRAM sed -E) +ELSE(GSED) + SET(SED_PROGRAM sed -r) +ENDIF(GSED) + +MACRO(DO_FILE) + SET(COMMAND ${SED_PROGRAM} ${ARGN} "${INPUT_FILE}") + EXECUTE_PROCESS(COMMAND ${COMMAND} + RESULT_VARIABLE result + ERROR_VARIABLE error + OUTPUT_FILE "${OUTPUT_FILE}.tmp") + IF(NOT result EQUAL 0) + MESSAGE(FATAL_ERROR "Command ${COMMAND} failed: ${error}") + ENDIF(NOT result EQUAL 0) + FILE(RENAME "${OUTPUT_FILE}.tmp" "${OUTPUT_FILE}") +ENDMACRO(DO_FILE) + +MACRO(DO_XML) + DO_FILE(-e "s@<_@<@g" -e "s@ #include "mooeditplugins.h" +void initmoo (void); + void moo_plugin_init_builtin (void) { - _moo_user_tools_plugin_init (); _moo_file_selector_plugin_init (); _moo_file_list_plugin_init (); _moo_find_plugin_init (); diff --git a/plugins/moopython/CMakeLists.txt b/plugins/moopython/CMakeLists.txt new file mode 100644 index 00000000..e3d0d78d --- /dev/null +++ b/plugins/moopython/CMakeLists.txt @@ -0,0 +1,166 @@ +ADD_SUBDIRECTORY(plugins) + +SET(MOOMOD_SOURCES + moo-mod.c + moopython-api.h + moopython-utils.h + moopython-utils.c + moopython-loader.h + moopython-loader.c +) + +SET(PYMOO_SOURCES + moopython-mod.c + moopython-pygtkmod.h + moopython-api.h + moopython-loader.h + moopython-loader.c + moopython-utils.h + moopython-utils.c +) + +SET(MOOPYTHON_SOURCES + moopython-builtin.h + moopython-builtin.c + moopython-api.h + moopython-loader.h + moopython-loader.c + moopython-utils.h + moopython-utils.c +) + +INCLUDE_DIRECTORIES( + ${CMAKE_CURRENT_SOURCE_DIR}/pygtk + ${CMAKE_CURRENT_BINARY_DIR}/pygtk + ${PYTHON_INCLUDE_DIRS} + ${PYGTK_INCLUDE_DIRS} +) + +ADD_DEFINITIONS(${PYTHON_DEFINITIONS} ${PYGTK_DEFINITIONS}) + +SET(MOOPYGTK_SOURCES + pygtk/moo-pygtk.c + pygtk/moo-pygtk.h + pygtk/mooapp-mod.h + pygtk/mooedit-mod.h + pygtk/mooutils-mod.h + pygtk/mooapp-mod.c + pygtk/mooedit-mod.c + pygtk/mooutils-mod.c + pygtk/moo-mod.h +) + +SET(mooedit_defs_files + pygtk/mooeditor.defs + pygtk/mooplugin.defs + pygtk/moocommand.defs +) + +SET(mooutils_defs_files + pygtk/moofileview.defs + pygtk/moopaned.defs +) + +SET(mooutils_override_files + pygtk/moopaned.override +) + +IF(WIN32) + SET(codegen_platform --platform win32) +ELSE(WIN32) + SET(codegen_platform) +ENDIF(WIN32) + +SET(codegen_files + codegen/codegen.py + codegen/argtypes.py + codegen/argtypes_m.py + codegen/reversewrapper.py +) + +GET_FILENAME_COMPONENT(_moo_abs_srcdir ${CMAKE_CURRENT_SOURCE_DIR} ABSOLUTE) + +SET(codegen_script ${_moo_abs_srcdir}/codegen/codegen.py) +SET(codegen ${PYTHON_EXECUTABLE} ${codegen_script} ${codegen_platform}) + +SET(MOO_UTILS_CODEGEN_ARGS +) + +SET(MOO_EDIT_CODEGEN_ARGS + --register ${_moo_abs_srcdir}/pygtk/mooutils-pygtk.defs +) + +SET(MOO_APP_CODEGEN_ARGS + --register ${_moo_abs_srcdir}/pygtk/mooutils-pygtk.defs + --register ${_moo_abs_srcdir}/pygtk/mooedit-pygtk.defs +) + +SET(MOO_PY2H ${_moo_abs_srcdir}/py2h.py) + +MACRO(MOO_GEN_MOD_H _moo_comp) + STRING(TOUPPER "${_moo_comp}" _moo_COMP) + MOO_ADD_GENERATED_FILE( + ${CMAKE_CURRENT_BINARY_DIR}/pygtk/moo${_moo_comp}-mod.h.stamp + ${CMAKE_CURRENT_BINARY_DIR}/pygtk/moo${_moo_comp}-mod.h + COMMAND ${CMAKE_COMMAND} -E make_directory pygtk + COMMAND ${PYTHON_EXECUTABLE} ${MOO_PY2H} + ${_moo_abs_srcdir}/pygtk/moo${_moo_comp}-mod.py + ${CMAKE_CURRENT_BINARY_DIR}/pygtk/moo${_moo_comp}-mod.h + MOO${_moo_COMP}_PY + DEPENDS pygtk/moo${_moo_comp}-mod.py ${MOO_PY2H}) +ENDMACRO(MOO_GEN_MOD_H) + +MOO_GEN_MOD_H("") +FOREACH(_moo_comp utils edit app) + STRING(TOUPPER ${_moo_comp} _moo_COMP) + MOO_GEN_MOD_H(${_moo_comp}) + MOO_ADD_GENERATED_FILE( + ${CMAKE_CURRENT_BINARY_DIR}/pygtk/moo${_moo_comp}-pygtk.stamp + ${CMAKE_CURRENT_BINARY_DIR}/pygtk/moo${_moo_comp}-pygtk.c + COMMAND ${CMAKE_COMMAND} -E make_directory pygtk + COMMAND ${codegen} + --prefix _moo_${_moo_comp} + --load-types ${_moo_abs_srcdir}/codegen/argtypes_m.py + --register ${PYGTK_DEFS_DIR}/gtk-types.defs + --register ${PYGTK_DEFS_DIR}/gdk-types.defs + ${MOO_${_moo_COMP}_CODEGEN_ARGS} + --override ${_moo_abs_srcdir}/pygtk/moo${_moo_comp}-pygtk.override + --outfile pygtk/moo${_moo_comp}-pygtk.c.tmp + --outfilename pygtk/moo${_moo_comp}-pygtk.c + ${_moo_abs_srcdir}/pygtk/moo${_moo_comp}-pygtk.defs + COMMAND ${CMAKE_COMMAND} -E copy_if_different pygtk/moo${_moo_comp}-pygtk.c.tmp pygtk/moo${_moo_comp}-pygtk.c + COMMAND ${CMAKE_COMMAND} -E remove pygtk/moo${_moo_comp}-pygtk.c.tmp + COMMAND ${CMAKE_COMMAND} -E touch pygtk/moo${_moo_comp}-pygtk.stamp + DEPENDS pygtk/moo${_moo_comp}-pygtk.defs + pygtk/moo${_moo_comp}-pygtk.override + ${moo${_moo_comp}_override_files} + ${moo${_moo_comp}_defs_files} + ${codegen_files}) +ENDFOREACH(_moo_comp) + +# noinst_LTLIBRARIES += libmoopygtk.la +# +# libmoopygtk_la_SOURCES = $(moopygtk_sources) +# nodist_libmoopygtk_la_SOURCES = $(nodist_moopygtk_sources) +# libmoopygtk_la_LIBADD = +# +# libmoopygtk_la_CFLAGS = +# -Ipygtk +# $(MOO_CFLAGS) +# $(MOO_W_NO_WRITE_STRINGS) +# $(MOO_W_NO_UNUSED) +# $(PYTHON_INCLUDES) +# $(PYGTK_CFLAGS) +# +# libmoopygtk_la_CXXFLAGS = +# -Ipygtk +# $(MOO_CXXFLAGS) +# $(MOO_W_NO_WRITE_STRINGS) +# $(MOO_W_NO_UNUSED) +# $(PYTHON_INCLUDES) +# $(PYGTK_CFLAGS) + +INCLUDE_DIRECTORIES(${MOO_SOURCE_DIR}) +MOO_ADD_LIBRARY(moopython ${MOOPYTHON_SOURCES} ${MOOPYGTK_SOURCES}) + +# -%- strip:true, indent-width:2 -%- diff --git a/junk/moopython/Makefile.ug b/plugins/moopython/Makefile.ug similarity index 100% rename from junk/moopython/Makefile.ug rename to plugins/moopython/Makefile.ug diff --git a/junk/moopython/codegen/README b/plugins/moopython/codegen/README similarity index 100% rename from junk/moopython/codegen/README rename to plugins/moopython/codegen/README diff --git a/junk/moopython/codegen/__init__.py b/plugins/moopython/codegen/__init__.py similarity index 100% rename from junk/moopython/codegen/__init__.py rename to plugins/moopython/codegen/__init__.py diff --git a/junk/moopython/codegen/argtypes.py b/plugins/moopython/codegen/argtypes.py similarity index 100% rename from junk/moopython/codegen/argtypes.py rename to plugins/moopython/codegen/argtypes.py diff --git a/junk/moopython/codegen/argtypes_m.py b/plugins/moopython/codegen/argtypes_m.py similarity index 100% rename from junk/moopython/codegen/argtypes_m.py rename to plugins/moopython/codegen/argtypes_m.py diff --git a/junk/moopython/codegen/codegen.py b/plugins/moopython/codegen/codegen.py similarity index 98% rename from junk/moopython/codegen/codegen.py rename to plugins/moopython/codegen/codegen.py index 0451c0ea..bcf2b634 100644 --- a/junk/moopython/codegen/codegen.py +++ b/plugins/moopython/codegen/codegen.py @@ -12,8 +12,6 @@ import override import reversewrapper import warnings -pygtk_version = 6 - class Coverage(object): def __init__(self, name): self.name = name @@ -74,6 +72,8 @@ class FileOutput: self.filename = filename else: self.filename = self.fp.name + if sys.platform == 'win32': + self.filename = self.filename.replace('\\', '/') # handle writing to the file, and keep track of the line number ... def write(self, str): self.fp.write(str) @@ -154,7 +154,7 @@ class Wrapper: getter_tmpl = ( 'static PyObject *\n' - '%(funcname)s(PyObject *self, void *closure)\n' + '%(funcname)s(PyObject *self, G_GNUC_UNUSED void *closure)\n' '{\n' '%(varlist)s' ' ret = %(field)s;\n' @@ -181,8 +181,8 @@ class Wrapper: noconstructor = ( 'static int\n' - 'pygobject_no_constructor(PyObject *self, PyObject *args, ' - 'PyObject *kwargs)\n' + 'pygobject_no_constructor(PyObject *self, G_GNUC_UNUSED PyObject *args, ' + 'G_GNUC_UNUSED PyObject *kwargs)\n' '{\n' ' gchar buf[512];\n' '\n' @@ -195,7 +195,7 @@ class Wrapper: function_tmpl = ( 'static PyObject *\n' - '_wrap_%(cname)s(PyObject *self%(extraparams)s)\n' + '_wrap_%(cname)s(G_GNUC_UNUSED PyObject *self%(extraparams)s)\n' '{\n' '%(varlist)s' '%(parseargs)s' @@ -234,7 +234,7 @@ class Wrapper: constructor_tmpl = None method_tmpl = None - def __init__(self, parser, objinfo, overrides, fp=FileOutput(sys.stdout)): + def __init__(self, parser, objinfo, overrides, fp): self.parser = parser self.objinfo = objinfo self.overrides = overrides @@ -397,7 +397,6 @@ class Wrapper: data = self.overrides.override(funcname) self.write_function(funcname, data) self.objinfo.has_new_constructor_api = ( - pygtk_version >= 8 and self.objinfo.typecode in self.overrides.newstyle_constructors) else: @@ -405,7 +404,7 @@ class Wrapper: # new-style constructores :P property_based = getattr(self, 'write_property_based_constructor', - None) and pygtk_version >= 8 + None) if property_based: if (len(constructor.params) == 0 or isinstance(constructor.params[0], @@ -947,7 +946,7 @@ class GObjectWrapper(Wrapper): '%(codeafter)s\n' '}\n\n' ) - def __init__(self, parser, objinfo, overrides, fp=FileOutput(sys.stdout)): + def __init__(self, parser, objinfo, overrides, fp): Wrapper.__init__(self, parser, objinfo, overrides, fp) if self.objinfo: self.castmacro = string.replace(self.objinfo.typecode, @@ -986,8 +985,8 @@ class GObjectWrapper(Wrapper): ## just like the constructor is inheritted, we should # inherit the new API compatibility flag self.objinfo.has_new_constructor_api = ( - pygtk_version >= 8 and parent.has_new_constructor_api) - elif self.objinfo.parent == 'GObject' and pygtk_version >= 8: + parent.has_new_constructor_api) + elif self.objinfo.parent == 'GObject': self.objinfo.has_new_constructor_api = True return '0' @@ -1328,7 +1327,7 @@ class GPointerWrapper(GBoxedWrapper): return substdict class SourceWriter: - def __init__(self, parser, overrides, prefix, fp=FileOutput(sys.stdout)): + def __init__(self, parser, overrides, prefix, fp): self.parser = parser self.overrides = overrides self.prefix = prefix @@ -1656,12 +1655,13 @@ usage = 'usage: codegen.py [-o overridesfile] [-p prefix] defsfile' def main(argv): o = override.Overrides() prefix = 'pygtk' + outfile = None outfilename = None errorfilename = None opts, args = getopt.getopt(argv[1:], "o:p:r:t:D:I:", - ["override=", "prefix=", "register=", "outfilename=", + ["override=", "prefix=", "register=", "outfile=", "outfilename=", "load-types=", "errorfilename=", "py_ssize_t-clean", - "platform=", "pygtk-version="]) + "platform="]) defines = {} # -Dkey[=val] options py_ssize_t_clean = False for opt, arg in opts: @@ -1675,17 +1675,14 @@ def main(argv): p.startParsing() register_types(p) del p + elif opt == '--outfile': + outfile = arg elif opt == '--outfilename': outfilename = arg elif opt == '--errorfilename': errorfilename = arg elif opt == '--platform': sys.platform = arg - elif opt == '--pygtk-version': - global pygtk_version - pygtk_version = int(arg) - if pygtk_version < 8: - defines['pygtk-2.6'] = '1' elif opt in ('-t', '--load-types'): globals = {} execfile(arg, globals) @@ -1712,7 +1709,11 @@ def main(argv): p.startParsing() register_types(p) - sw = SourceWriter(p, o, prefix, FileOutput(sys.stdout, outfilename)) + if outfile is None: + fp = sys.stdout + else: + fp = open(outfile, 'w') + sw = SourceWriter(p, o, prefix, FileOutput(fp, outfilename)) sw.write(py_ssize_t_clean) functions_coverage.printstats() diff --git a/junk/moopython/codegen/definitions.py b/plugins/moopython/codegen/definitions.py similarity index 100% rename from junk/moopython/codegen/definitions.py rename to plugins/moopython/codegen/definitions.py diff --git a/junk/moopython/codegen/defsparser.py b/plugins/moopython/codegen/defsparser.py similarity index 100% rename from junk/moopython/codegen/defsparser.py rename to plugins/moopython/codegen/defsparser.py diff --git a/junk/moopython/codegen/docgen.py b/plugins/moopython/codegen/docgen.py similarity index 100% rename from junk/moopython/codegen/docgen.py rename to plugins/moopython/codegen/docgen.py diff --git a/junk/moopython/codegen/mergedefs.py b/plugins/moopython/codegen/mergedefs.py similarity index 100% rename from junk/moopython/codegen/mergedefs.py rename to plugins/moopython/codegen/mergedefs.py diff --git a/junk/moopython/codegen/mkskel.py b/plugins/moopython/codegen/mkskel.py similarity index 100% rename from junk/moopython/codegen/mkskel.py rename to plugins/moopython/codegen/mkskel.py diff --git a/junk/moopython/codegen/override.py b/plugins/moopython/codegen/override.py similarity index 100% rename from junk/moopython/codegen/override.py rename to plugins/moopython/codegen/override.py diff --git a/junk/moopython/codegen/reversewrapper.py b/plugins/moopython/codegen/reversewrapper.py similarity index 100% rename from junk/moopython/codegen/reversewrapper.py rename to plugins/moopython/codegen/reversewrapper.py diff --git a/junk/moopython/codegen/scmexpr.py b/plugins/moopython/codegen/scmexpr.py similarity index 100% rename from junk/moopython/codegen/scmexpr.py rename to plugins/moopython/codegen/scmexpr.py diff --git a/junk/moopython/genpygtk.cmake b/plugins/moopython/genpygtk.cmake similarity index 100% rename from junk/moopython/genpygtk.cmake rename to plugins/moopython/genpygtk.cmake diff --git a/junk/moopython/moo-mod.c b/plugins/moopython/moo-mod.c similarity index 100% rename from junk/moopython/moo-mod.c rename to plugins/moopython/moo-mod.c diff --git a/junk/moopython/moo.rc.in b/plugins/moopython/moo.rc.in similarity index 100% rename from junk/moopython/moo.rc.in rename to plugins/moopython/moo.rc.in diff --git a/junk/moopython/moopython-api.h b/plugins/moopython/moopython-api.h similarity index 100% rename from junk/moopython/moopython-api.h rename to plugins/moopython/moopython-api.h diff --git a/junk/moopython/moopython-builtin.c b/plugins/moopython/moopython-builtin.c similarity index 100% rename from junk/moopython/moopython-builtin.c rename to plugins/moopython/moopython-builtin.c diff --git a/junk/moopython/moopython-builtin.h b/plugins/moopython/moopython-builtin.h similarity index 100% rename from junk/moopython/moopython-builtin.h rename to plugins/moopython/moopython-builtin.h diff --git a/junk/moopython/moopython-loader.c b/plugins/moopython/moopython-loader.c similarity index 76% rename from junk/moopython/moopython-loader.c rename to plugins/moopython/moopython-loader.c index ddff4d5c..b3fc1935 100644 --- a/junk/moopython/moopython-loader.c +++ b/plugins/moopython/moopython-loader.c @@ -20,6 +20,12 @@ #define NO_IMPORT_PYGOBJECT #include "pygobject.h" #include +#include +#ifdef __WIN32__ +#include +#include +#endif +#include #include "moopython/moopython-loader.h" #include "mooutils/mooutils-misc.h" @@ -103,20 +109,89 @@ sys_path_add_plugin_dirs (void) } +/* Python doesn't like \r characters in the text passed to Py_CompileString() */ +static char * +get_text_contents (const char *path) +{ +#if 1 && defined(__WIN32__) + int fd = -1; + GIOChannel *io = NULL; + GString *content = NULL; + GString *buffer = NULL; + gsize terminator_pos; + char *contents = NULL; + GIOStatus status; + + if ((fd = g_open (path, _O_RDONLY | _O_BINARY, 0)) == -1) + { + moo_warning ("could not read file '%s'", path); + goto out; + } + + io = g_io_channel_win32_new_fd (fd); + if (!io) + { + moo_critical ("oops"); + goto out; + } + + content = g_string_new (NULL); + buffer = g_string_new (NULL); + + while ((status = g_io_channel_read_line_string (io, buffer, &terminator_pos, NULL)) == G_IO_STATUS_NORMAL) + { + g_string_append_len (content, buffer->str, terminator_pos); + if (buffer->len > terminator_pos) + g_string_append_len (content, "\n", 1); + } + + if (status == G_IO_STATUS_ERROR) + { + moo_warning ("error reading file '%s'", path); + goto out; + } + + contents = g_string_free (content, FALSE); + content = NULL; + +out: + if (content) + g_string_free (content, TRUE); + if (buffer) + g_string_free (buffer, TRUE); + if (io) + { + g_io_channel_shutdown (io, FALSE, NULL); + g_io_channel_unref (io); + } + if (fd != -1) + close (fd); + return contents; +#else + char *content = NULL; + GError *error = NULL; + if (!g_file_get_contents (path, &content, NULL, &error)) + { + moo_warning ("could not read file '%s': %s", path, error->message); + g_error_free (error); + return NULL; + } + else + { + return content; + } +#endif +} + static PyObject * do_load_file (const char *path) { PyObject *mod = NULL; PyObject *code; char *modname = NULL, *content = NULL; - GError *error = NULL; - if (!g_file_get_contents (path, &content, NULL, &error)) - { - g_warning ("could not read file '%s': %s", path, error->message); - g_error_free (error); + if (!(content = get_text_contents (path))) return NULL; - } modname = g_strdup_printf ("moo_module_%08x", g_random_int ()); code = Py_CompileString (content, path, Py_file_input); @@ -160,7 +235,7 @@ do_load_file (const char *path) PyErr_Restore(type, value, traceback); } - g_warning ("error when loading file '%s'", path); + g_printerr ("error when loading file '%s'", path); PyErr_Print (); goto out; } diff --git a/junk/moopython/moopython-loader.h b/plugins/moopython/moopython-loader.h similarity index 100% rename from junk/moopython/moopython-loader.h rename to plugins/moopython/moopython-loader.h diff --git a/junk/moopython/moopython-mod.c b/plugins/moopython/moopython-mod.c similarity index 100% rename from junk/moopython/moopython-mod.c rename to plugins/moopython/moopython-mod.c diff --git a/junk/moopython/moopython-pygtkmod.h b/plugins/moopython/moopython-pygtkmod.h similarity index 100% rename from junk/moopython/moopython-pygtkmod.h rename to plugins/moopython/moopython-pygtkmod.h diff --git a/junk/moopython/moopython-utils.c b/plugins/moopython/moopython-utils.c similarity index 100% rename from junk/moopython/moopython-utils.c rename to plugins/moopython/moopython-utils.c diff --git a/junk/moopython/moopython-utils.h b/plugins/moopython/moopython-utils.h similarity index 98% rename from junk/moopython/moopython-utils.h rename to plugins/moopython/moopython-utils.h index 5f7f2317..e9d9e3f4 100644 --- a/junk/moopython/moopython-utils.h +++ b/plugins/moopython/moopython-utils.h @@ -54,7 +54,7 @@ void _moo_py_init_print_funcs (void); /* avoid strict aliasing warnings */ #define return_True return PyBool_FromLong (TRUE) #define return_False return PyBool_FromLong (FALSE) -#define return_Bool(v) return PyBool_FromLong ((v) && TRUE) +#define return_Bool(v) return PyBool_FromLong ((v) != 0) #define return_Int(v) return PyInt_FromLong (v) diff --git a/plugins/moopython/plugins/CMakeLists.txt b/plugins/moopython/plugins/CMakeLists.txt new file mode 100644 index 00000000..b4c44436 --- /dev/null +++ b/plugins/moopython/plugins/CMakeLists.txt @@ -0,0 +1,26 @@ +SET(moopython_pluginsdir ${MOO_PLUGINS_DIR}) +SET(plugins_libdir ${MOO_PLUGINS_DIR}/lib) + +SET(plugins + terminal.py + python.py + pycmd.py +) + +SET(INI_IN_IN_FILES + terminal.ini.in.in + python.ini.in.in + pycmd.ini.in.in +) + +IF(NOT WIN32) + LIST(APPEND plugins terminal.py) + LIST(APPEND INI_IN_IN_FILES terminal.ini.in.in) +ENDIF(NOT WIN32) + +MOO_TRANSFORM_INI_FILES(INI_FILES ${INI_IN_IN_FILES}) +ADD_CUSTOM_TARGET(python-plugins-ini DEPENDS ${INI_IN_IN_FILES}) + +INSTALL(FILES ${INI_FILES} ${plugins} DESTINATION ${moopython_pluginsdir}) +INSTALL(FILES lib/pyconsole.py lib/insert_date_and_time.py DESTINATION ${plugins_libdir}) +INSTALL(FILES medit/__init__.py medit/runpython.py DESTINATION ${plugins_libdir}/medit) diff --git a/junk/moopython/plugins/Makefile.ug b/plugins/moopython/plugins/Makefile.ug similarity index 100% rename from junk/moopython/plugins/Makefile.ug rename to plugins/moopython/plugins/Makefile.ug diff --git a/junk/moopython/plugins/lib/insert_date_and_time.py b/plugins/moopython/plugins/lib/insert_date_and_time.py similarity index 100% rename from junk/moopython/plugins/lib/insert_date_and_time.py rename to plugins/moopython/plugins/lib/insert_date_and_time.py diff --git a/junk/moopython/plugins/lib/pyconsole.py b/plugins/moopython/plugins/lib/pyconsole.py similarity index 100% rename from junk/moopython/plugins/lib/pyconsole.py rename to plugins/moopython/plugins/lib/pyconsole.py diff --git a/junk/moopython/plugins/medit/__init__.py b/plugins/moopython/plugins/medit/__init__.py similarity index 100% rename from junk/moopython/plugins/medit/__init__.py rename to plugins/moopython/plugins/medit/__init__.py diff --git a/junk/moopython/plugins/medit/runpython.py b/plugins/moopython/plugins/medit/runpython.py similarity index 100% rename from junk/moopython/plugins/medit/runpython.py rename to plugins/moopython/plugins/medit/runpython.py diff --git a/junk/moopython/plugins/pycmd.ini.in.in b/plugins/moopython/plugins/pycmd.ini.in.in similarity index 100% rename from junk/moopython/plugins/pycmd.ini.in.in rename to plugins/moopython/plugins/pycmd.ini.in.in diff --git a/junk/moopython/plugins/pycmd.py b/plugins/moopython/plugins/pycmd.py similarity index 100% rename from junk/moopython/plugins/pycmd.py rename to plugins/moopython/plugins/pycmd.py diff --git a/junk/moopython/plugins/pyproject/Makefile.ug b/plugins/moopython/plugins/pyproject/Makefile.ug similarity index 100% rename from junk/moopython/plugins/pyproject/Makefile.ug rename to plugins/moopython/plugins/pyproject/Makefile.ug diff --git a/junk/moopython/plugins/pyproject/medit-mprj.xml.in b/plugins/moopython/plugins/pyproject/medit-mprj.xml.in similarity index 100% rename from junk/moopython/plugins/pyproject/medit-mprj.xml.in rename to plugins/moopython/plugins/pyproject/medit-mprj.xml.in diff --git a/junk/moopython/plugins/pyproject/mprj/__init__.py b/plugins/moopython/plugins/pyproject/mprj/__init__.py similarity index 100% rename from junk/moopython/plugins/pyproject/mprj/__init__.py rename to plugins/moopython/plugins/pyproject/mprj/__init__.py diff --git a/junk/moopython/plugins/pyproject/mprj/config/__init__.py b/plugins/moopython/plugins/pyproject/mprj/config/__init__.py similarity index 100% rename from junk/moopython/plugins/pyproject/mprj/config/__init__.py rename to plugins/moopython/plugins/pyproject/mprj/config/__init__.py diff --git a/junk/moopython/plugins/pyproject/mprj/config/_config.py b/plugins/moopython/plugins/pyproject/mprj/config/_config.py similarity index 100% rename from junk/moopython/plugins/pyproject/mprj/config/_config.py rename to plugins/moopython/plugins/pyproject/mprj/config/_config.py diff --git a/junk/moopython/plugins/pyproject/mprj/config/_dict.py b/plugins/moopython/plugins/pyproject/mprj/config/_dict.py similarity index 100% rename from junk/moopython/plugins/pyproject/mprj/config/_dict.py rename to plugins/moopython/plugins/pyproject/mprj/config/_dict.py diff --git a/junk/moopython/plugins/pyproject/mprj/config/_group.py b/plugins/moopython/plugins/pyproject/mprj/config/_group.py similarity index 100% rename from junk/moopython/plugins/pyproject/mprj/config/_group.py rename to plugins/moopython/plugins/pyproject/mprj/config/_group.py diff --git a/junk/moopython/plugins/pyproject/mprj/config/_item.py b/plugins/moopython/plugins/pyproject/mprj/config/_item.py similarity index 100% rename from junk/moopython/plugins/pyproject/mprj/config/_item.py rename to plugins/moopython/plugins/pyproject/mprj/config/_item.py diff --git a/junk/moopython/plugins/pyproject/mprj/config/_setting.py b/plugins/moopython/plugins/pyproject/mprj/config/_setting.py similarity index 100% rename from junk/moopython/plugins/pyproject/mprj/config/_setting.py rename to plugins/moopython/plugins/pyproject/mprj/config/_setting.py diff --git a/junk/moopython/plugins/pyproject/mprj/config/_utils.py b/plugins/moopython/plugins/pyproject/mprj/config/_utils.py similarity index 100% rename from junk/moopython/plugins/pyproject/mprj/config/_utils.py rename to plugins/moopython/plugins/pyproject/mprj/config/_utils.py diff --git a/junk/moopython/plugins/pyproject/mprj/config/_xml.py b/plugins/moopython/plugins/pyproject/mprj/config/_xml.py similarity index 100% rename from junk/moopython/plugins/pyproject/mprj/config/_xml.py rename to plugins/moopython/plugins/pyproject/mprj/config/_xml.py diff --git a/junk/moopython/plugins/pyproject/mprj/config/test.py b/plugins/moopython/plugins/pyproject/mprj/config/test.py similarity index 100% rename from junk/moopython/plugins/pyproject/mprj/config/test.py rename to plugins/moopython/plugins/pyproject/mprj/config/test.py diff --git a/junk/moopython/plugins/pyproject/mprj/config/view.py b/plugins/moopython/plugins/pyproject/mprj/config/view.py similarity index 100% rename from junk/moopython/plugins/pyproject/mprj/config/view.py rename to plugins/moopython/plugins/pyproject/mprj/config/view.py diff --git a/junk/moopython/plugins/pyproject/mprj/factory.glade b/plugins/moopython/plugins/pyproject/mprj/factory.glade similarity index 100% rename from junk/moopython/plugins/pyproject/mprj/factory.glade rename to plugins/moopython/plugins/pyproject/mprj/factory.glade diff --git a/junk/moopython/plugins/pyproject/mprj/factory.py b/plugins/moopython/plugins/pyproject/mprj/factory.py similarity index 100% rename from junk/moopython/plugins/pyproject/mprj/factory.py rename to plugins/moopython/plugins/pyproject/mprj/factory.py diff --git a/junk/moopython/plugins/pyproject/mprj/manager.py b/plugins/moopython/plugins/pyproject/mprj/manager.py similarity index 100% rename from junk/moopython/plugins/pyproject/mprj/manager.py rename to plugins/moopython/plugins/pyproject/mprj/manager.py diff --git a/junk/moopython/plugins/pyproject/mprj/optdialog.py b/plugins/moopython/plugins/pyproject/mprj/optdialog.py similarity index 100% rename from junk/moopython/plugins/pyproject/mprj/optdialog.py rename to plugins/moopython/plugins/pyproject/mprj/optdialog.py diff --git a/junk/moopython/plugins/pyproject/mprj/project.py b/plugins/moopython/plugins/pyproject/mprj/project.py similarity index 100% rename from junk/moopython/plugins/pyproject/mprj/project.py rename to plugins/moopython/plugins/pyproject/mprj/project.py diff --git a/junk/moopython/plugins/pyproject/mprj/session.py b/plugins/moopython/plugins/pyproject/mprj/session.py similarity index 100% rename from junk/moopython/plugins/pyproject/mprj/session.py rename to plugins/moopython/plugins/pyproject/mprj/session.py diff --git a/junk/moopython/plugins/pyproject/mprj/settings.py b/plugins/moopython/plugins/pyproject/mprj/settings.py similarity index 100% rename from junk/moopython/plugins/pyproject/mprj/settings.py rename to plugins/moopython/plugins/pyproject/mprj/settings.py diff --git a/junk/moopython/plugins/pyproject/mprj/simple.glade b/plugins/moopython/plugins/pyproject/mprj/simple.glade similarity index 100% rename from junk/moopython/plugins/pyproject/mprj/simple.glade rename to plugins/moopython/plugins/pyproject/mprj/simple.glade diff --git a/junk/moopython/plugins/pyproject/mprj/simple.py b/plugins/moopython/plugins/pyproject/mprj/simple.py similarity index 100% rename from junk/moopython/plugins/pyproject/mprj/simple.py rename to plugins/moopython/plugins/pyproject/mprj/simple.py diff --git a/junk/moopython/plugins/pyproject/mprj/test.py b/plugins/moopython/plugins/pyproject/mprj/test.py similarity index 100% rename from junk/moopython/plugins/pyproject/mprj/test.py rename to plugins/moopython/plugins/pyproject/mprj/test.py diff --git a/junk/moopython/plugins/pyproject/mprj/utils.glade b/plugins/moopython/plugins/pyproject/mprj/utils.glade similarity index 100% rename from junk/moopython/plugins/pyproject/mprj/utils.glade rename to plugins/moopython/plugins/pyproject/mprj/utils.glade diff --git a/junk/moopython/plugins/pyproject/mprj/utils.py b/plugins/moopython/plugins/pyproject/mprj/utils.py similarity index 100% rename from junk/moopython/plugins/pyproject/mprj/utils.py rename to plugins/moopython/plugins/pyproject/mprj/utils.py diff --git a/junk/moopython/plugins/pyproject/project-plugin.ini.in.in b/plugins/moopython/plugins/pyproject/project-plugin.ini.in.in similarity index 100% rename from junk/moopython/plugins/pyproject/project-plugin.ini.in.in rename to plugins/moopython/plugins/pyproject/project-plugin.ini.in.in diff --git a/junk/moopython/plugins/pyproject/project-plugin.py b/plugins/moopython/plugins/pyproject/project-plugin.py similarity index 100% rename from junk/moopython/plugins/pyproject/project-plugin.py rename to plugins/moopython/plugins/pyproject/project-plugin.py diff --git a/junk/moopython/plugins/pyproject/projects/c.py b/plugins/moopython/plugins/pyproject/projects/c.py similarity index 100% rename from junk/moopython/plugins/pyproject/projects/c.py rename to plugins/moopython/plugins/pyproject/projects/c.py diff --git a/junk/moopython/plugins/pyproject/projects/cproj/__init__.py b/plugins/moopython/plugins/pyproject/projects/cproj/__init__.py similarity index 100% rename from junk/moopython/plugins/pyproject/projects/cproj/__init__.py rename to plugins/moopython/plugins/pyproject/projects/cproj/__init__.py diff --git a/junk/moopython/plugins/pyproject/projects/cproj/config.py b/plugins/moopython/plugins/pyproject/projects/cproj/config.py similarity index 100% rename from junk/moopython/plugins/pyproject/projects/cproj/config.py rename to plugins/moopython/plugins/pyproject/projects/cproj/config.py diff --git a/junk/moopython/plugins/pyproject/projects/cproj/optdialog.py b/plugins/moopython/plugins/pyproject/projects/cproj/optdialog.py similarity index 100% rename from junk/moopython/plugins/pyproject/projects/cproj/optdialog.py rename to plugins/moopython/plugins/pyproject/projects/cproj/optdialog.py diff --git a/junk/moopython/plugins/pyproject/projects/cproj/options.glade b/plugins/moopython/plugins/pyproject/projects/cproj/options.glade similarity index 100% rename from junk/moopython/plugins/pyproject/projects/cproj/options.glade rename to plugins/moopython/plugins/pyproject/projects/cproj/options.glade diff --git a/junk/moopython/plugins/pyproject/projects/cproj/parser.py b/plugins/moopython/plugins/pyproject/projects/cproj/parser.py similarity index 100% rename from junk/moopython/plugins/pyproject/projects/cproj/parser.py rename to plugins/moopython/plugins/pyproject/projects/cproj/parser.py diff --git a/junk/moopython/plugins/pyproject/projects/pyproj/__init__.py b/plugins/moopython/plugins/pyproject/projects/pyproj/__init__.py similarity index 100% rename from junk/moopython/plugins/pyproject/projects/pyproj/__init__.py rename to plugins/moopython/plugins/pyproject/projects/pyproj/__init__.py diff --git a/junk/moopython/plugins/pyproject/projects/pyproj/config.py b/plugins/moopython/plugins/pyproject/projects/pyproj/config.py similarity index 100% rename from junk/moopython/plugins/pyproject/projects/pyproj/config.py rename to plugins/moopython/plugins/pyproject/projects/pyproj/config.py diff --git a/junk/moopython/plugins/pyproject/projects/pyproj/optdialog.py b/plugins/moopython/plugins/pyproject/projects/pyproj/optdialog.py similarity index 100% rename from junk/moopython/plugins/pyproject/projects/pyproj/optdialog.py rename to plugins/moopython/plugins/pyproject/projects/pyproj/optdialog.py diff --git a/junk/moopython/plugins/pyproject/projects/pyproj/options.glade b/plugins/moopython/plugins/pyproject/projects/pyproj/options.glade similarity index 100% rename from junk/moopython/plugins/pyproject/projects/pyproj/options.glade rename to plugins/moopython/plugins/pyproject/projects/pyproj/options.glade diff --git a/junk/moopython/plugins/pyproject/projects/python.py b/plugins/moopython/plugins/pyproject/projects/python.py similarity index 100% rename from junk/moopython/plugins/pyproject/projects/python.py rename to plugins/moopython/plugins/pyproject/projects/python.py diff --git a/junk/moopython/plugins/pytest.py b/plugins/moopython/plugins/pytest.py similarity index 100% rename from junk/moopython/plugins/pytest.py rename to plugins/moopython/plugins/pytest.py diff --git a/junk/moopython/plugins/python.ini.in.in b/plugins/moopython/plugins/python.ini.in.in similarity index 100% rename from junk/moopython/plugins/python.ini.in.in rename to plugins/moopython/plugins/python.ini.in.in diff --git a/junk/moopython/plugins/python.py b/plugins/moopython/plugins/python.py similarity index 100% rename from junk/moopython/plugins/python.py rename to plugins/moopython/plugins/python.py diff --git a/junk/moopython/plugins/simple.ini b/plugins/moopython/plugins/simple.ini similarity index 100% rename from junk/moopython/plugins/simple.ini rename to plugins/moopython/plugins/simple.ini diff --git a/junk/moopython/plugins/simple.py b/plugins/moopython/plugins/simple.py similarity index 100% rename from junk/moopython/plugins/simple.py rename to plugins/moopython/plugins/simple.py diff --git a/junk/moopython/plugins/terminal.ini.in.in b/plugins/moopython/plugins/terminal.ini.in.in similarity index 100% rename from junk/moopython/plugins/terminal.ini.in.in rename to plugins/moopython/plugins/terminal.ini.in.in diff --git a/junk/moopython/plugins/terminal.py b/plugins/moopython/plugins/terminal.py similarity index 100% rename from junk/moopython/plugins/terminal.py rename to plugins/moopython/plugins/terminal.py diff --git a/plugins/moopython/py2h.py b/plugins/moopython/py2h.py new file mode 100644 index 00000000..76b60cc0 --- /dev/null +++ b/plugins/moopython/py2h.py @@ -0,0 +1,37 @@ +#! /usr/bin/python + +import sys +import filecmp +import shutil + +input = sys.argv[1] +output = sys.argv[2] +tmp_output = output + '.tmp' +varname = sys.argv[3] + +outfile = open(tmp_output, 'w') +print >> outfile, '/* -*- C -*- */' +print >> outfile, 'static const char %s [] = ""' % (varname,) +for line in open(input): + if line.endswith('\n'): + line = line[:-1] + print >> outfile, '"' + line.replace('"', '\\"') + '\\n"' +print >> outfile, ';' + +outfile.close() + +docopy = False +try: + docopy = not filecmp.cmp(tmp_output, output) +except: + docopy = True + +if docopy: + shutil.copyfile(tmp_output, output) + +open(output + '.stamp', 'w').write('stamp\n') + +try: + os.remove(tmp_output) +except: + pass diff --git a/junk/moopython/pygtk/Makefile.incl b/plugins/moopython/pygtk/Makefile.incl similarity index 100% rename from junk/moopython/pygtk/Makefile.incl rename to plugins/moopython/pygtk/Makefile.incl diff --git a/junk/moopython/pygtk/moo-mod.py b/plugins/moopython/pygtk/moo-mod.py similarity index 100% rename from junk/moopython/pygtk/moo-mod.py rename to plugins/moopython/pygtk/moo-mod.py diff --git a/junk/moopython/pygtk/moo-pygtk.c b/plugins/moopython/pygtk/moo-pygtk.c similarity index 100% rename from junk/moopython/pygtk/moo-pygtk.c rename to plugins/moopython/pygtk/moo-pygtk.c diff --git a/junk/moopython/pygtk/moo-pygtk.h b/plugins/moopython/pygtk/moo-pygtk.h similarity index 100% rename from junk/moopython/pygtk/moo-pygtk.h rename to plugins/moopython/pygtk/moo-pygtk.h diff --git a/junk/moopython/pygtk/mooapp-mod.c b/plugins/moopython/pygtk/mooapp-mod.c similarity index 100% rename from junk/moopython/pygtk/mooapp-mod.c rename to plugins/moopython/pygtk/mooapp-mod.c diff --git a/junk/moopython/pygtk/mooapp-mod.py b/plugins/moopython/pygtk/mooapp-mod.py similarity index 100% rename from junk/moopython/pygtk/mooapp-mod.py rename to plugins/moopython/pygtk/mooapp-mod.py diff --git a/junk/moopython/pygtk/mooapp-pygtk.defs b/plugins/moopython/pygtk/mooapp-pygtk.defs similarity index 100% rename from junk/moopython/pygtk/mooapp-pygtk.defs rename to plugins/moopython/pygtk/mooapp-pygtk.defs diff --git a/junk/moopython/pygtk/mooapp-pygtk.override b/plugins/moopython/pygtk/mooapp-pygtk.override similarity index 100% rename from junk/moopython/pygtk/mooapp-pygtk.override rename to plugins/moopython/pygtk/mooapp-pygtk.override diff --git a/junk/moopython/pygtk/moocommand.defs b/plugins/moopython/pygtk/moocommand.defs similarity index 100% rename from junk/moopython/pygtk/moocommand.defs rename to plugins/moopython/pygtk/moocommand.defs diff --git a/junk/moopython/pygtk/mooedit-mod.c b/plugins/moopython/pygtk/mooedit-mod.c similarity index 100% rename from junk/moopython/pygtk/mooedit-mod.c rename to plugins/moopython/pygtk/mooedit-mod.c diff --git a/junk/moopython/pygtk/mooedit-mod.py b/plugins/moopython/pygtk/mooedit-mod.py similarity index 100% rename from junk/moopython/pygtk/mooedit-mod.py rename to plugins/moopython/pygtk/mooedit-mod.py diff --git a/junk/moopython/pygtk/mooedit-pygtk.defs b/plugins/moopython/pygtk/mooedit-pygtk.defs similarity index 100% rename from junk/moopython/pygtk/mooedit-pygtk.defs rename to plugins/moopython/pygtk/mooedit-pygtk.defs diff --git a/junk/moopython/pygtk/mooedit-pygtk.override b/plugins/moopython/pygtk/mooedit-pygtk.override similarity index 99% rename from junk/moopython/pygtk/mooedit-pygtk.override rename to plugins/moopython/pygtk/mooedit-pygtk.override index ace85c8d..cf47b3ed 100644 --- a/junk/moopython/pygtk/mooedit-pygtk.override +++ b/plugins/moopython/pygtk/mooedit-pygtk.override @@ -22,7 +22,6 @@ headers #include #include #include "mooedit/moocmdview.h" -#include "mooedit/moocommand.h" #include "mooedit/mooedit.h" #include "mooedit/mooedit-bookmarks.h" #include "mooedit/mooedit-enums.h" @@ -49,6 +48,7 @@ headers #include "mooedit/mootextpopup.h" #include "mooedit/mootextcompletion.h" #include "mooedit/mooedit-enums.h" +#include "plugins/usertools/moocommand.h" #include "moopython/moopython-utils.h" #include "moopython/pygtk/moo-pygtk.h" diff --git a/junk/moopython/pygtk/mooeditor.defs b/plugins/moopython/pygtk/mooeditor.defs similarity index 100% rename from junk/moopython/pygtk/mooeditor.defs rename to plugins/moopython/pygtk/mooeditor.defs diff --git a/junk/moopython/pygtk/moofileview.defs b/plugins/moopython/pygtk/moofileview.defs similarity index 100% rename from junk/moopython/pygtk/moofileview.defs rename to plugins/moopython/pygtk/moofileview.defs diff --git a/junk/moopython/pygtk/moopaned.defs b/plugins/moopython/pygtk/moopaned.defs similarity index 100% rename from junk/moopython/pygtk/moopaned.defs rename to plugins/moopython/pygtk/moopaned.defs diff --git a/junk/moopython/pygtk/moopaned.override b/plugins/moopython/pygtk/moopaned.override similarity index 100% rename from junk/moopython/pygtk/moopaned.override rename to plugins/moopython/pygtk/moopaned.override diff --git a/junk/moopython/pygtk/mooplugin.defs b/plugins/moopython/pygtk/mooplugin.defs similarity index 100% rename from junk/moopython/pygtk/mooplugin.defs rename to plugins/moopython/pygtk/mooplugin.defs diff --git a/junk/moopython/pygtk/mooutils-mod.c b/plugins/moopython/pygtk/mooutils-mod.c similarity index 100% rename from junk/moopython/pygtk/mooutils-mod.c rename to plugins/moopython/pygtk/mooutils-mod.c diff --git a/junk/moopython/pygtk/mooutils-mod.py b/plugins/moopython/pygtk/mooutils-mod.py similarity index 100% rename from junk/moopython/pygtk/mooutils-mod.py rename to plugins/moopython/pygtk/mooutils-mod.py diff --git a/junk/moopython/pygtk/mooutils-pygtk.defs b/plugins/moopython/pygtk/mooutils-pygtk.defs similarity index 100% rename from junk/moopython/pygtk/mooutils-pygtk.defs rename to plugins/moopython/pygtk/mooutils-pygtk.defs diff --git a/junk/moopython/pygtk/mooutils-pygtk.override b/plugins/moopython/pygtk/mooutils-pygtk.override similarity index 100% rename from junk/moopython/pygtk/mooutils-pygtk.override rename to plugins/moopython/pygtk/mooutils-pygtk.override diff --git a/junk/moopython/pymoo.ini.in b/plugins/moopython/pymoo.ini.in similarity index 100% rename from junk/moopython/pymoo.ini.in rename to plugins/moopython/pymoo.ini.in diff --git a/junk/moopython/pymoo.rc.in b/plugins/moopython/pymoo.rc.in similarity index 100% rename from junk/moopython/pymoo.rc.in rename to plugins/moopython/pymoo.rc.in