Windows: small fixes for rclmpdf.py to work with alivate poppler

This commit is contained in:
Jean-Francois Dockes 2015-10-01 16:36:29 +02:00
parent 89970ba045
commit 0fa30959f6
4 changed files with 35 additions and 9 deletions

View file

@ -24,6 +24,9 @@ import os
import tempfile import tempfile
import shutil import shutil
import getopt import getopt
import rclconfig
my_config = rclconfig.RclConfig()
############################################ ############################################
# RclExecM implements the # RclExecM implements the
@ -207,6 +210,10 @@ def which(program):
def path_candidates(): def path_candidates():
yield os.path.dirname(sys.argv[0]) yield os.path.dirname(sys.argv[0])
rclpath = my_config.getConfParam("recollhelperpath")
if rclpath:
for path in rclpath.split(os.pathsep):
yield path
for path in os.environ["PATH"].split(os.pathsep): for path in os.environ["PATH"].split(os.pathsep):
yield path yield path

View file

@ -1,10 +1,12 @@
#!/usr/bin/env python #!/usr/bin/env python
from __future__ import print_function
import locale import locale
import re import re
import os import os
import sys import sys
import base64 import base64
import platform
class ConfSimple: class ConfSimple:
"""A ConfSimple class reads a recoll configuration file, which is a typical """A ConfSimple class reads a recoll configuration file, which is a typical
@ -143,14 +145,23 @@ class RclDynConf:
class RclConfig: class RclConfig:
def __init__(self, argcnf = None): def __init__(self, argcnf = None):
platsys = platform.system()
# Find configuration directory # Find configuration directory
if argcnf is not None: if argcnf is not None:
self.confdir = os.path.abspath(argcnf) self.confdir = os.path.abspath(argcnf)
elif "RECOLL_CONFDIR" in os.environ: elif "RECOLL_CONFDIR" in os.environ:
self.confdir = os.environ["RECOLL_CONFDIR"] self.confdir = os.environ["RECOLL_CONFDIR"]
else: else:
self.confdir = os.path.expanduser("~/.recoll") if platsys == "Windows":
#print("Confdir: [%s]" % self.confdir) if "LOCALAPPDATA" in os.environ:
dir = os.environ["LOCALAPPDATA"]
else:
dir = os.path.expanduser("~")
self.confdir = os.path.join(dir, "Recoll")
else:
self.confdir = os.path.expanduser("~/.recoll")
#print("Confdir: [%s]" % self.confdir, file=sys.stderr)
# Also find datadir. This is trickier because this is set by # Also find datadir. This is trickier because this is set by
# "configure" in the C code. We can only do our best. Have to # "configure" in the C code. We can only do our best. Have to
# choose a preference order. Use RECOLL_DATADIR if the order is wrong # choose a preference order. Use RECOLL_DATADIR if the order is wrong
@ -158,14 +169,17 @@ class RclConfig:
if "RECOLL_DATADIR" in os.environ: if "RECOLL_DATADIR" in os.environ:
self.datadir = os.environ["RECOLL_DATADIR"] self.datadir = os.environ["RECOLL_DATADIR"]
else: else:
dirs = ("/opt/local", "/usr", "/usr/local") if platsys == "Windows":
for dir in dirs: self.datadir = os.path.join(os.path.dirname(sys.argv[0]), "..")
dd = os.path.join(dir, "share/recoll") else:
if os.path.exists(dd): dirs = ("/opt/local", "/usr", "/usr/local")
self.datadir = dd for dir in dirs:
dd = os.path.join(dir, "share/recoll")
if os.path.exists(dd):
self.datadir = dd
if self.datadir is None: if self.datadir is None:
self.datadir = "/usr/share/recoll" self.datadir = "/usr/share/recoll"
#print("Datadir: [%s]" % self.datadir) #print("Datadir: [%s]" % self.datadir, file=sys.stderr)
self.cdirs = [] self.cdirs = []
# Additional config directory, values override user ones # Additional config directory, values override user ones
@ -176,7 +190,7 @@ class RclConfig:
if "RECOLL_CONFMID" in os.environ: if "RECOLL_CONFMID" in os.environ:
self.cdirs.append(os.environ["RECOLL_CONFMID"]) self.cdirs.append(os.environ["RECOLL_CONFMID"])
self.cdirs.append(os.path.join(self.datadir, "examples")) self.cdirs.append(os.path.join(self.datadir, "examples"))
#print("Config dirs: %s" % self.cdirs, file=sys.stderr)
self.config = ConfStack("recoll.conf", self.cdirs, "tree") self.config = ConfStack("recoll.conf", self.cdirs, "tree")
self.keydir = '' self.keydir = ''

View file

@ -202,6 +202,10 @@ idxflushmb = 10
# the environment, we use it instead. Defaults to $prefix/share/recoll/filters # the environment, we use it instead. Defaults to $prefix/share/recoll/filters
# filtersdir = /path/to/my/filters # filtersdir = /path/to/my/filters
# Additional places to search for helper executables. This is only used on
# Windows for now
# recollhelperpath = c:/someprog/bin;c:/someotherprog/bin
# Place to search for icons. The only reason to change this would be if you # Place to search for icons. The only reason to change this would be if you
# want to change the icons displayed in the result list. # want to change the icons displayed in the result list.
# Defaults to $prefix/share/recoll/images # Defaults to $prefix/share/recoll/images

View file

@ -53,6 +53,7 @@ copyrecoll()
cc $RECOLL/sampleconf/recoll.qss $DESTDIR/Share/examples cc $RECOLL/sampleconf/recoll.qss $DESTDIR/Share/examples
cp $RECOLL/filters/* $FILTERS || exit 1 cp $RECOLL/filters/* $FILTERS || exit 1
cp $RECOLL/python/recoll/recoll/rclconfig.py $FILTERS || exit 1
} }
copyantiword() copyantiword()