From 54d76448f24c9fd2e656510735283b8f20b218fe Mon Sep 17 00:00:00 2001 From: Tim Waugh Date: Sat, 10 Jan 2009 13:01:24 +0000 Subject: [PATCH] - Don't use popen2 in the foomatic PPD update script. --- gutenprint-foomaticppdupdate | 15 +++++++-------- gutenprint.spec | 5 ++++- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/gutenprint-foomaticppdupdate b/gutenprint-foomaticppdupdate index ffee02e..b8b66e8 100644 --- a/gutenprint-foomaticppdupdate +++ b/gutenprint-foomaticppdupdate @@ -25,7 +25,7 @@ import sys import glob import os -import popen2 +import subprocess import tempfile import cups @@ -38,15 +38,14 @@ gutenprint_version = sys.argv[1] dry_run = True def generate_ppd (ppdfile, printer, driver): - (r, w) = popen2.popen2 (["foomatic-ppdfile", - "-p", printer, - "-d", driver]) - w.close () - ppd = r.readlines () - r.close () + p = subprocess.Popen (["foomatic-ppdfile", "-p", printer, "-d", driver], + stdin=file ("/dev/null"), + stdout=subprocess.PIPE, + stderr=subprocess.PIPE) + (ppd, stderr) = p.communicate () fname = ppdfile + ".tmp" try: - file(fname, "w").writelines (ppd) + file(fname, "w").write (ppd) except IOError, e: print e raise diff --git a/gutenprint.spec b/gutenprint.spec index 801951f..89a817c 100644 --- a/gutenprint.spec +++ b/gutenprint.spec @@ -4,7 +4,7 @@ Name: gutenprint Summary: Printer Drivers Package. Version: 5.2.3 -Release: 2%{?dist} +Release: 3%{?dist} Group: System Environment/Base URL: http://gimp-print.sourceforge.net/ Source0: http://dl.sf.net/gimp-print/gutenprint-%{version}.tar.bz2 @@ -254,6 +254,9 @@ fi /bin/rm -f /var/cache/foomatic/* %changelog +* Sat Jan 10 2009 Tim Waugh 5.2.3-3 +- Don't use popen2 in the foomatic PPD update script. + * Thu Jan 8 2009 Tim Waugh 5.2.3-2 - Only run the foomatic PPD update script on update, and make sure the script can deal with major version upgrades (bug #478328).