From 28a5b1029b4f43a405f6dd1fa4eac66abf6dcb00 Mon Sep 17 00:00:00 2001 From: Colomban Wendling Date: Thu, 18 Jul 2019 18:15:22 +0200 Subject: [PATCH] Add support for selecting the default Python command Add a configure option to select the command used as the Python interpreter by default in the Python filetype. This can typically be useful if a setup has non-standard paths or do not provide a generic `python` interpreter but only versioned ones. --- configure.ac | 9 +++++++++ data/Makefile.am | 12 +++++++++--- .../{filetypes.python => filetypes.python.in} | 4 ++-- 3 files changed, 20 insertions(+), 5 deletions(-) rename data/filedefs/{filetypes.python => filetypes.python.in} (98%) diff --git a/configure.ac b/configure.ac index a933b8061..eb49a2313 100644 --- a/configure.ac +++ b/configure.ac @@ -145,6 +145,14 @@ AM_COND_IF([MINGW], AC_SUBST([GEANY_DATA_DIR], [$(eval echo $(eval echo $pkgdatadir))]) AC_SUBST([pkgdatadir]) +# The default Python command +AC_ARG_WITH([python-command], + [AS_HELP_STRING([--with-python-command], + [the default Python command [default=python]])], + [with_python_command=$withval], + [with_python_command=python]) +AC_SUBST([PYTHON_COMMAND], [$with_python_command]) + # Documentation tools GEANY_CHECK_DOCUTILS GEANY_CHECK_DOXYGEN @@ -176,6 +184,7 @@ AC_CONFIG_FILES([ plugins/Makefile po/Makefile.in data/Makefile + data/filedefs/filetypes.python doc/Makefile doc/geany.1 geany.pc diff --git a/data/Makefile.am b/data/Makefile.am index 0be1fb242..f52f4bf89 100644 --- a/data/Makefile.am +++ b/data/Makefile.am @@ -2,7 +2,7 @@ colorschemes = \ colorschemes/alt.conf -filetypes = \ +filetypes_dist = \ filedefs/filetypes.abaqus \ filedefs/filetypes.abc \ filedefs/filetypes.actionscript \ @@ -57,7 +57,6 @@ filetypes = \ filedefs/filetypes.php \ filedefs/filetypes.po \ filedefs/filetypes.powershell \ - filedefs/filetypes.python \ filedefs/filetypes.r \ filedefs/filetypes.restructuredtext \ filedefs/filetypes.ruby \ @@ -75,6 +74,10 @@ filetypes = \ filedefs/filetypes.yaml \ filedefs/filetypes.zephir +# generated filetypes +filetypes_nodist = \ + filedefs/filetypes.python + tagfiles = \ tags/std99.c.tags \ tags/std.php.tags \ @@ -106,7 +109,7 @@ templates = \ nobase_dist_pkgdata_DATA = \ $(colorschemes) \ - $(filetypes) \ + $(filetypes_dist) \ $(tagfiles) \ $(template_files) \ $(templates) \ @@ -115,6 +118,9 @@ nobase_dist_pkgdata_DATA = \ ui_toolbar.xml \ geany.glade +nobase_pkgdata_DATA = \ + $(filetypes_nodist) + if GTK3 nobase_dist_pkgdata_DATA += \ geany-3.0.css \ diff --git a/data/filedefs/filetypes.python b/data/filedefs/filetypes.python.in similarity index 98% rename from data/filedefs/filetypes.python rename to data/filedefs/filetypes.python.in index 78383755a..9b4203b61 100644 --- a/data/filedefs/filetypes.python +++ b/data/filedefs/filetypes.python.in @@ -72,12 +72,12 @@ context_action_cmd= # %e will be replaced by the filename without extension # (use only one of it at one time) FT_00_LB=_Compile -FT_00_CM=python -m py_compile "%f" +FT_00_CM=@PYTHON_COMMAND@ -m py_compile "%f" FT_00_WD= FT_02_LB=_Lint FT_02_CM=pep8 --max-line-length=80 "%f" FT_02_WD= error_regex=(.+):([0-9]+):([0-9]+) EX_00_LB=_Execute -EX_00_CM=python "%f" +EX_00_CM=@PYTHON_COMMAND@ "%f" EX_00_WD=