prepare rclmpdf->rclmpdf.py for windows

This commit is contained in:
Jean-Francois Dockes 2015-10-01 15:09:45 +02:00
parent 2f4d88788d
commit 376e5485dc
2 changed files with 22 additions and 11 deletions

View File

@ -22,7 +22,6 @@ import sys
import re
import rclexecm
import subprocess
import distutils.spawn
import tempfile
import atexit
import signal
@ -39,10 +38,22 @@ def signal_handler(signal, frame):
atexit.register(finalcleanup)
signal.signal(signal.SIGHUP, signal_handler)
signal.signal(signal.SIGINT, signal_handler)
signal.signal(signal.SIGQUIT, signal_handler)
signal.signal(signal.SIGTERM, signal_handler)
try:
signal.signal(signal.SIGHUP, signal_handler)
except:
pass
try:
signal.signal(signal.SIGINT, signal_handler)
except:
pass
try:
signal.signal(signal.SIGQUIT, signal_handler)
except:
pass
try:
signal.signal(signal.SIGTERM, signal_handler)
except:
pass
def vacuumdir(dir):
if dir:
@ -173,14 +184,14 @@ class PDFExtractor:
self.currentindex = -1
self.attextractdone = False
if self.pdftotext == "":
self.pdftotext = distutils.spawn.find_executable("pdftotext")
if self.pdftotext is None:
if not self.pdftotext:
self.pdftotext = rclexecm.which("pdftotext")
if not self.pdftotext:
print("RECFILTERROR HELPERNOTFOUND pdftotext")
sys.exit(1);
if self.pdftk == "":
self.pdftk = distutils.spawn.find_executable("pdftk")
if not self.pdftk:
self.pdftk = rclexecm.which("pdftk")
if self.pdftk:
global tmpdir

View File

@ -63,7 +63,7 @@ application/vnd.ms-office = exec rcldoc
application/ogg = execm rclaudio
application/pdf = exec rclpdf
# application/pdf = execm rclmpdf
# application/pdf = execm rclmpdf.py
application/postscript = exec pstotext;charset=iso-8859-1;mimetype=text/plain
application/vnd.ms-excel = exec rclxls
application/vnd.ms-powerpoint = exec rclppt