let filter 'which' find a command in a specified subdir of PATH elements
This commit is contained in:
parent
f72bf802f3
commit
a02a611694
@ -226,6 +226,14 @@ class RclExecM:
|
||||
|
||||
|
||||
# Helper routine to test for program accessibility
|
||||
# Note that this works a bit differently from Linux 'which', which
|
||||
# won't search the PATH if there is a path part in the program name,
|
||||
# even if not absolute (e.g. will just try subdir/cmd in current
|
||||
# dir). We will find such a command if it exists in a matching subpath
|
||||
# of any PATH element.
|
||||
# This is very useful esp. on Windows so that we can have several bin
|
||||
# filter directories under filters (to avoid dll clashes). The
|
||||
# corresponding c++ routine in recoll execcmd works the same.
|
||||
def which(program):
|
||||
def is_exe(fpath):
|
||||
return os.path.exists(fpath) and os.access(fpath, os.X_OK)
|
||||
@ -242,9 +250,8 @@ def which(program):
|
||||
yield path
|
||||
for path in os.environ["PATH"].split(os.pathsep):
|
||||
yield path
|
||||
|
||||
fpath, fname = os.path.split(program)
|
||||
if fpath:
|
||||
|
||||
if os.path.isabs(program):
|
||||
if is_exe(program):
|
||||
return program
|
||||
else:
|
||||
@ -296,7 +303,9 @@ def main(proto, extract):
|
||||
# Not running the main loop: either acting as single filter (when called
|
||||
# from other filter for example), or debugging
|
||||
def usage():
|
||||
print("Usage: rclexecm.py [-d] [-s] [-i ipath] [filename]",
|
||||
print("Usage: rclexecm.py [-d] [-s] [-i ipath] <filename>",
|
||||
file=sys.stderr)
|
||||
print(" rclexecm.py -w <prog>",
|
||||
file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
@ -305,7 +314,7 @@ def main(proto, extract):
|
||||
ipath = ""
|
||||
|
||||
args = sys.argv[1:]
|
||||
opts, args = getopt.getopt(args, "hdsi:")
|
||||
opts, args = getopt.getopt(args, "hdsi:w:")
|
||||
for opt, arg in opts:
|
||||
if opt in ['-h']:
|
||||
usage()
|
||||
@ -313,6 +322,13 @@ def main(proto, extract):
|
||||
actAsSingle = True
|
||||
elif opt in ['-i']:
|
||||
ipath = arg
|
||||
elif opt in ['-w']:
|
||||
ret = which(arg)
|
||||
if ret:
|
||||
print("%s" % ret)
|
||||
sys.exit(0)
|
||||
else:
|
||||
sys.exit(1)
|
||||
elif opt in ['-d']:
|
||||
debugDumpData = True
|
||||
else:
|
||||
|
||||
@ -15,6 +15,12 @@ In the following, a number of commands will use a command window with an
|
||||
MinGW environment. This can be easily created by executing
|
||||
C:\MinGW\msys\1.0\msys.bat from File Explorer.
|
||||
|
||||
Note: you should take care to use the gcc compiler which comes with Qt for
|
||||
all the following builds. For this, you will want to execute the following
|
||||
command in the command window:
|
||||
|
||||
export PATH=c:/qt/tools/mingw492_32/bin:$PATH
|
||||
|
||||
== Tortoise HG
|
||||
|
||||
This is needed because there is no source package for recoll or its
|
||||
@ -30,15 +36,26 @@ dependancies] to C:/recolldeps
|
||||
You can change the target names, but there will be more script editing
|
||||
later on then (nothing much).
|
||||
|
||||
== Qt
|
||||
|
||||
Download and install Qt 5.5.x (mingw version) from: http://www.qt.io/download/
|
||||
|
||||
Note: it is not possible to build a static webkit, so the installation is
|
||||
necessarily dynamic, which means that the Qt DLLS will need to be copied
|
||||
into the installation directory. This is done by the installation-building
|
||||
script (using `windeployqt`)
|
||||
|
||||
|
||||
== zlib
|
||||
|
||||
Download from http://zlib.net/zlib-1.2.8.tar.gz
|
||||
Then, from an MSYS command window (see above):
|
||||
|
||||
cd c:/temp
|
||||
export PATH=c:/qt/tools/mingw492_32/bin:$PATH
|
||||
tar xzf path-to-tar-file
|
||||
cd zlib-1.2.8
|
||||
make -f Win32/Makefile.gcc
|
||||
make -f win32/Makefile.gcc
|
||||
|
||||
== Xapian
|
||||
|
||||
@ -56,18 +73,10 @@ http://oligarchy.co.uk/xapian/1.2.21/xapian-core-1.2.21.tar.xz
|
||||
|
||||
Then:
|
||||
|
||||
export PATH=c:/qt/tools/mingw492_32/bin:$PATH
|
||||
CPPFLAGS=-IC:/temp/zlib-1.2.8 LDFLAGS=-Lc:/temp/zlib-1.2.8 ./configure
|
||||
make
|
||||
|
||||
== Qt
|
||||
|
||||
Download and install Qt 5.5.x (mingw version) from: http://www.qt.io/download/
|
||||
|
||||
Note: it is not possible to build a static webkit, so the installation is
|
||||
necessarily dynamic, which means that the Qt DLLS will need to be copied
|
||||
into the installation directory. This is done by the installation-building
|
||||
script (using `windeployqt`)
|
||||
|
||||
== Recoll
|
||||
|
||||
You need to use the source from the repository, there is no release
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user