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 shutil
import getopt
import rclconfig
my_config = rclconfig.RclConfig()
############################################
# RclExecM implements the
@ -207,6 +210,10 @@ def which(program):
def path_candidates():
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):
yield path

View file

@ -1,10 +1,12 @@
#!/usr/bin/env python
from __future__ import print_function
import locale
import re
import os
import sys
import base64
import platform
class ConfSimple:
"""A ConfSimple class reads a recoll configuration file, which is a typical
@ -143,14 +145,23 @@ class RclDynConf:
class RclConfig:
def __init__(self, argcnf = None):
platsys = platform.system()
# Find configuration directory
if argcnf is not None:
self.confdir = os.path.abspath(argcnf)
elif "RECOLL_CONFDIR" in os.environ:
self.confdir = os.environ["RECOLL_CONFDIR"]
else:
self.confdir = os.path.expanduser("~/.recoll")
#print("Confdir: [%s]" % self.confdir)
if platsys == "Windows":
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
# "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
@ -158,14 +169,17 @@ class RclConfig:
if "RECOLL_DATADIR" in os.environ:
self.datadir = os.environ["RECOLL_DATADIR"]
else:
dirs = ("/opt/local", "/usr", "/usr/local")
for dir in dirs:
dd = os.path.join(dir, "share/recoll")
if os.path.exists(dd):
self.datadir = dd
if platsys == "Windows":
self.datadir = os.path.join(os.path.dirname(sys.argv[0]), "..")
else:
dirs = ("/opt/local", "/usr", "/usr/local")
for dir in dirs:
dd = os.path.join(dir, "share/recoll")
if os.path.exists(dd):
self.datadir = dd
if self.datadir is None:
self.datadir = "/usr/share/recoll"
#print("Datadir: [%s]" % self.datadir)
#print("Datadir: [%s]" % self.datadir, file=sys.stderr)
self.cdirs = []
# Additional config directory, values override user ones
@ -176,7 +190,7 @@ class RclConfig:
if "RECOLL_CONFMID" in os.environ:
self.cdirs.append(os.environ["RECOLL_CONFMID"])
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.keydir = ''

View file

@ -202,6 +202,10 @@ idxflushmb = 10
# the environment, we use it instead. Defaults to $prefix/share/recoll/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
# want to change the icons displayed in the result list.
# Defaults to $prefix/share/recoll/images

View file

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