windows: rely on .py extension instead of special keyword to determine use of interpreter
This commit is contained in:
parent
8b3792026f
commit
844b4e8b03
@ -125,7 +125,7 @@
|
|||||||
#define PACKAGE_NAME "Recoll"
|
#define PACKAGE_NAME "Recoll"
|
||||||
|
|
||||||
/* Define to the full name and version of this package. */
|
/* Define to the full name and version of this package. */
|
||||||
#define PACKAGE_STRING "Recoll 1.31.6"
|
#define PACKAGE_STRING "Recoll 1.32.0"
|
||||||
|
|
||||||
/* Define to the one symbol short name of this package. */
|
/* Define to the one symbol short name of this package. */
|
||||||
#define PACKAGE_TARNAME "recoll"
|
#define PACKAGE_TARNAME "recoll"
|
||||||
@ -134,7 +134,7 @@
|
|||||||
#define PACKAGE_URL ""
|
#define PACKAGE_URL ""
|
||||||
|
|
||||||
/* Define to the version of this package. */
|
/* Define to the version of this package. */
|
||||||
#define PACKAGE_VERSION "1.31.6"
|
#define PACKAGE_VERSION "1.32.0"
|
||||||
|
|
||||||
/* putenv parameter is const */
|
/* putenv parameter is const */
|
||||||
/* #undef PUTENV_ARG_CONST */
|
/* #undef PUTENV_ARG_CONST */
|
||||||
|
|||||||
@ -118,7 +118,7 @@
|
|||||||
#define PACKAGE_NAME "Recoll"
|
#define PACKAGE_NAME "Recoll"
|
||||||
|
|
||||||
/* Define to the full name and version of this package. */
|
/* Define to the full name and version of this package. */
|
||||||
#define PACKAGE_STRING "Recoll 1.31.6"
|
#define PACKAGE_STRING "Recoll 1.32.0"
|
||||||
|
|
||||||
/* Define to the one symbol short name of this package. */
|
/* Define to the one symbol short name of this package. */
|
||||||
#define PACKAGE_TARNAME "recoll"
|
#define PACKAGE_TARNAME "recoll"
|
||||||
@ -127,7 +127,7 @@
|
|||||||
#define PACKAGE_URL ""
|
#define PACKAGE_URL ""
|
||||||
|
|
||||||
/* Define to the version of this package. */
|
/* Define to the version of this package. */
|
||||||
#define PACKAGE_VERSION "1.31.6"
|
#define PACKAGE_VERSION "1.32.0"
|
||||||
|
|
||||||
/* putenv parameter is const */
|
/* putenv parameter is const */
|
||||||
/* #undef PUTENV_ARG_CONST */
|
/* #undef PUTENV_ARG_CONST */
|
||||||
|
|||||||
@ -1633,6 +1633,7 @@ vector<string> RclConfig::getDaemSkippedPaths() const
|
|||||||
// and filtersdir from the config file to the PATH, then use execmd::which()
|
// and filtersdir from the config file to the PATH, then use execmd::which()
|
||||||
string RclConfig::findFilter(const string &icmd) const
|
string RclConfig::findFilter(const string &icmd) const
|
||||||
{
|
{
|
||||||
|
LOGDEB2("findFilter: " << icmd << "\n");
|
||||||
// If the path is absolute, this is it
|
// If the path is absolute, this is it
|
||||||
if (path_isabsolute(icmd))
|
if (path_isabsolute(icmd))
|
||||||
return icmd;
|
return icmd;
|
||||||
@ -1680,13 +1681,19 @@ bool RclConfig::processFilterCmd(std::vector<std::string>& cmd) const
|
|||||||
LOGDEB0("processFilterCmd: in: " << stringsToString(cmd) << "\n");
|
LOGDEB0("processFilterCmd: in: " << stringsToString(cmd) << "\n");
|
||||||
auto it = cmd.begin();
|
auto it = cmd.begin();
|
||||||
|
|
||||||
// Special-case python and perl on windows: we need to also locate the
|
#ifdef _WIN32
|
||||||
// first argument which is the script name "python somescript.py".
|
// Special-case interpreters on windows: we used to have an additional 1st argument "python" in
|
||||||
// On Unix, thanks to #!, we usually just run "somescript.py", but need
|
// mimeconf, but we now rely on the .py extension for better sharing of mimeconf.
|
||||||
// the same change if we ever want to use the same cmd line as windows
|
std::string ext = path_suffix(*it);
|
||||||
bool hasinterp = !stringlowercmp("python", *it) ||
|
if ("py" == ext) {
|
||||||
!stringlowercmp("perl", *it);
|
it = cmd.insert(it, findFilter("python"));
|
||||||
|
it++;
|
||||||
|
} else if ("pl" == ext) {
|
||||||
|
it = cmd.insert(it, findFilter("perl"));
|
||||||
|
it++;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// Note that, if the cmd vector size is 1, post-incrementing the
|
// Note that, if the cmd vector size is 1, post-incrementing the
|
||||||
// iterator in the following statement, which works on x86, leads
|
// iterator in the following statement, which works on x86, leads
|
||||||
// to a crash on ARM with gcc 6 and 8 (at least), which does not
|
// to a crash on ARM with gcc 6 and 8 (at least), which does not
|
||||||
@ -1694,25 +1701,15 @@ bool RclConfig::processFilterCmd(std::vector<std::string>& cmd) const
|
|||||||
// whatever... We do it later then.
|
// whatever... We do it later then.
|
||||||
*it = findFilter(*it);
|
*it = findFilter(*it);
|
||||||
|
|
||||||
if (hasinterp) {
|
|
||||||
if (cmd.size() < 2) {
|
|
||||||
LOGERR("processFilterCmd: python/perl cmd: no script?. [" <<
|
|
||||||
stringsToString(cmd) << "]\n");
|
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
++it;
|
|
||||||
*it = findFilter(*it);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
LOGDEB0("processFilterCmd: out: " << stringsToString(cmd) << "\n");
|
LOGDEB0("processFilterCmd: out: " << stringsToString(cmd) << "\n");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RclConfig::pythonCmd(const std::string& scriptname,
|
// This now does nothing more than processFilterCmd (after we changed to relying on the py extension)
|
||||||
std::vector<std::string>& cmd) const
|
bool RclConfig::pythonCmd(const std::string& scriptname, std::vector<std::string>& cmd) const
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
cmd = {"python", scriptname};
|
cmd = {scriptname};
|
||||||
#else
|
#else
|
||||||
cmd = {scriptname};
|
cmd = {scriptname};
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
# (C) 2015 J.F.Dockes
|
# (C) 2015-2022 J.F.Dockes
|
||||||
|
|
||||||
# This file contains most of the data which determines how we
|
# This file contains most of the data which determines how we
|
||||||
# handle the different mime types (also see the "mimeview" file).
|
# handle the different mime types (also see the "mimeview" file).
|
||||||
@ -30,12 +30,12 @@
|
|||||||
# The script (ie: rcluncomp) must output the uncompressed file name on
|
# The script (ie: rcluncomp) must output the uncompressed file name on
|
||||||
# stdout. Note that the windows version will always use 7z, and ignore
|
# stdout. Note that the windows version will always use 7z, and ignore
|
||||||
# the decompressor parameter in the following lines
|
# the decompressor parameter in the following lines
|
||||||
application/gzip = uncompress python rcluncomp.py 7z %f %t
|
application/gzip = uncompress rcluncomp.py 7z %f %t
|
||||||
application/x-gzip = uncompress python rcluncomp.py 7z %f %t
|
application/x-gzip = uncompress rcluncomp.py 7z %f %t
|
||||||
application/x-compress = uncompress python rcluncomp.py 7z %f %t
|
application/x-compress = uncompress rcluncomp.py 7z %f %t
|
||||||
application/x-bzip2 = uncompress python rcluncomp.py 7z %f %t
|
application/x-bzip2 = uncompress rcluncomp.py 7z %f %t
|
||||||
application/x-xz = uncompress python rcluncomp.py 7z %f %t
|
application/x-xz = uncompress rcluncomp.py 7z %f %t
|
||||||
application/x-lzma = uncompress python rcluncomp.py 7z %f %t
|
application/x-lzma = uncompress rcluncomp.py 7z %f %t
|
||||||
|
|
||||||
|
|
||||||
## ###################################
|
## ###################################
|
||||||
@ -47,14 +47,14 @@ application/x-lzma = uncompress python rcluncomp.py 7z %f %t
|
|||||||
# each filter, see the exemples below (ie: msword)
|
# each filter, see the exemples below (ie: msword)
|
||||||
[index]
|
[index]
|
||||||
|
|
||||||
application/msword = execm python rcldoc.py
|
application/msword = execm rcldoc.py
|
||||||
application/vnd.ms-excel = execm python rclxls.py
|
application/vnd.ms-excel = execm rclxls.py
|
||||||
application/vnd.ms-outlook = execm python rclpst.py
|
application/vnd.ms-outlook = execm rclpst.py
|
||||||
application/vnd.ms-powerpoint = execm python rclppt.py
|
application/vnd.ms-powerpoint = execm rclppt.py
|
||||||
# Also Handle the mime type returned by "file -i" for a suffix-less word
|
# Also Handle the mime type returned by "file -i" for a suffix-less word
|
||||||
# file. This could probably just as well be an excel file, but we have to
|
# file. This could probably just as well be an excel file, but we have to
|
||||||
# chose one.
|
# chose one.
|
||||||
application/vnd.ms-office = execm python rcldoc.py
|
application/vnd.ms-office = execm rcldoc.py
|
||||||
|
|
||||||
application/vnd.oasis.opendocument.text = \
|
application/vnd.oasis.opendocument.text = \
|
||||||
internal xsltproc meta meta.xml opendoc-meta.xsl \
|
internal xsltproc meta meta.xml opendoc-meta.xsl \
|
||||||
@ -89,9 +89,9 @@ application/vnd.openxmlformats-officedocument.wordprocessingml.template = \
|
|||||||
body word/footnotes.xml openxml-word-body.xsl \
|
body word/footnotes.xml openxml-word-body.xsl \
|
||||||
body word/endnotes.xml openxml-word-body.xsl
|
body word/endnotes.xml openxml-word-body.xsl
|
||||||
application/vnd.openxmlformats-officedocument.presentationml.template = \
|
application/vnd.openxmlformats-officedocument.presentationml.template = \
|
||||||
execm python rclopxml.py
|
execm rclopxml.py
|
||||||
application/vnd.openxmlformats-officedocument.presentationml.presentation = \
|
application/vnd.openxmlformats-officedocument.presentationml.presentation = \
|
||||||
execm python rclopxml.py
|
execm rclopxml.py
|
||||||
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet = \
|
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet = \
|
||||||
internal xsltproc meta docProps/core.xml openxml-meta.xsl \
|
internal xsltproc meta docProps/core.xml openxml-meta.xsl \
|
||||||
body xl/sharedStrings.xml openxml-xls-body.xsl
|
body xl/sharedStrings.xml openxml-xls-body.xsl
|
||||||
@ -131,52 +131,52 @@ application/vnd.sun.xml.writer.template = \
|
|||||||
body content.xml opendoc-body.xsl
|
body content.xml opendoc-body.xsl
|
||||||
|
|
||||||
#application/postscript = exec rclps
|
#application/postscript = exec rclps
|
||||||
#application/x-gnuinfo = execm python rclinfo.py
|
#application/x-gnuinfo = execm rclinfo.py
|
||||||
#application/x-tar = execm python rcltar.py
|
#application/x-tar = execm rcltar.py
|
||||||
|
|
||||||
application/epub+zip = execm python rclepub.py
|
application/epub+zip = execm rclepub.py
|
||||||
application/x-ipynb+json = execm python rclipynb.py
|
application/x-ipynb+json = execm rclipynb.py
|
||||||
application/javascript = internal text/plain
|
application/javascript = internal text/plain
|
||||||
application/ogg = execm python rclaudio.py
|
application/ogg = execm rclaudio.py
|
||||||
application/pdf = execm python rclpdf.py
|
application/pdf = execm rclpdf.py
|
||||||
application/sql = internal text/plain
|
application/sql = internal text/plain
|
||||||
application/vnd.wordperfect = exec wpd/wpd2html;mimetype=text/html
|
application/vnd.wordperfect = exec wpd/wpd2html;mimetype=text/html
|
||||||
application/x-7z-compressed = execm python rcl7z.py
|
application/x-7z-compressed = execm rcl7z.py
|
||||||
application/x-abiword = internal xsltproc abiword.xsl
|
application/x-abiword = internal xsltproc abiword.xsl
|
||||||
application/x-awk = internal text/plain
|
application/x-awk = internal text/plain
|
||||||
application/x-chm = execm python rclchm.py
|
application/x-chm = execm rclchm.py
|
||||||
application/x-dia-diagram = execm python rcldia.py;mimetype=text/plain
|
application/x-dia-diagram = execm rcldia.py;mimetype=text/plain
|
||||||
application/x-flac = execm python rclaudio.py
|
application/x-flac = execm rclaudio.py
|
||||||
application/x-gnote = execm python rclxml.py
|
application/x-gnote = execm rclxml.py
|
||||||
application/x-hwp = execm python rclhwp.py
|
application/x-hwp = execm rclhwp.py
|
||||||
application/x-mimehtml = internal message/rfc822
|
application/x-mimehtml = internal message/rfc822
|
||||||
application/x-perl = internal text/plain
|
application/x-perl = internal text/plain
|
||||||
application/x-php = internal text/plain
|
application/x-php = internal text/plain
|
||||||
application/x-rar = execm python rclrar.py;charset=default
|
application/x-rar = execm rclrar.py;charset=default
|
||||||
application/x-shellscript = internal text/plain
|
application/x-shellscript = internal text/plain
|
||||||
application/x-webarchive = execm python rclwar.py
|
application/x-webarchive = execm rclwar.py
|
||||||
application/x-zerosize = internal
|
application/x-zerosize = internal
|
||||||
application/zip = execm python rclzip.py;charset=default
|
application/zip = execm rclzip.py;charset=default
|
||||||
audio/aac = execm python rclaudio.py
|
audio/aac = execm rclaudio.py
|
||||||
audio/mp4 = execm python rclaudio.py
|
audio/mp4 = execm rclaudio.py
|
||||||
audio/mpeg = execm python rclaudio.py
|
audio/mpeg = execm rclaudio.py
|
||||||
audio/x-karaoke = execm python rclkar.py
|
audio/x-karaoke = execm rclkar.py
|
||||||
image/gif = execm rclimg.exe
|
image/gif = execm rclimg.exe
|
||||||
image/jp2 = execm rclimg.exe
|
image/jp2 = execm rclimg.exe
|
||||||
image/jpeg = execm rclimg.exe
|
image/jpeg = execm rclimg.exe
|
||||||
image/png = execm rclimg.exe
|
image/png = execm rclimg.exe
|
||||||
image/svg+xml = internal xsltproc svg.xsl
|
image/svg+xml = internal xsltproc svg.xsl
|
||||||
image/tiff = execm rclimg.exe
|
image/tiff = execm rclimg.exe
|
||||||
image/vnd.djvu = execm python rcldjvu.py
|
image/vnd.djvu = execm rcldjvu.py
|
||||||
inode/symlink = internal
|
inode/symlink = internal
|
||||||
inode/x-empty = internal application/x-zerosize
|
inode/x-empty = internal application/x-zerosize
|
||||||
message/rfc822 = internal
|
message/rfc822 = internal
|
||||||
text/calendar = execm python rclics.py;mimetype=text/plain
|
text/calendar = execm rclics.py;mimetype=text/plain
|
||||||
text/css = internal text/plain
|
text/css = internal text/plain
|
||||||
text/html = internal
|
text/html = internal
|
||||||
text/plain = internal
|
text/plain = internal
|
||||||
text/plain1 = internal
|
text/plain1 = internal
|
||||||
#text/rtf = execm python rclrtf.py
|
#text/rtf = execm rclrtf.py
|
||||||
text/rtf = exec unrtf --nopict --html;mimetype=text/html
|
text/rtf = exec unrtf --nopict --html;mimetype=text/html
|
||||||
text/x-c = internal
|
text/x-c = internal
|
||||||
text/x-c+ = internal
|
text/x-c+ = internal
|
||||||
@ -187,9 +187,9 @@ text/x-csv = internal text/plain
|
|||||||
text/x-fictionbook = internal xsltproc fb2.xsl
|
text/x-fictionbook = internal xsltproc fb2.xsl
|
||||||
text/x-ini = internal text/plain
|
text/x-ini = internal text/plain
|
||||||
text/x-mail = internal
|
text/x-mail = internal
|
||||||
text/x-orgmode = execm python rclorgmode.py
|
text/x-orgmode = execm rclorgmode.py
|
||||||
text/x-perl = internal text/plain
|
text/x-perl = internal text/plain
|
||||||
text/x-python = execm python rclpython.py
|
text/x-python = execm rclpython.py
|
||||||
text/x-shellscript = internal text/plain
|
text/x-shellscript = internal text/plain
|
||||||
text/x-srt = internal text/plain
|
text/x-srt = internal text/plain
|
||||||
image/x-xcf = execm rclimg.exe
|
image/x-xcf = execm rclimg.exe
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user