Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=pacman-tools.git;a=commitdiff;h=308e77ad5d4d63155003ea52f9d54e64cd4b4a6f

commit 308e77ad5d4d63155003ea52f9d54e64cd4b4a6f
Author: Melko <[email protected]>
Date:   Fri Jan 20 10:49:53 2017 +0100

chkworld.py

* fix sigpipe error
* use subprocess.Popen instead of os.popen (deprecated)
* add exception for m8r regexp

diff --git a/chkworld.py b/chkworld.py
index 4dd3edd..08c950f 100755
--- a/chkworld.py
+++ b/chkworld.py
@@ -23,10 +23,13 @@
import os
import getopt
import sys
+import subprocess
+import signal
from multiprocessing import Process, Queue
from re import search as regex_search
from time import asctime, localtime

+signal.signal(signal.SIGPIPE, signal.SIG_DFL)

def usage():
os.system("man chkworld")
@@ -94,10 +97,15 @@ def find_file(filename, path, blacklist):
def run_command(fb, command):
cwd = os.getcwd()
os.chdir(fb)  # this is necessary otherwise it won't use user repo but system 
one (stable on genesis)
-       with os.popen("source {0};source ./FrugalBuild; {1}".format(fwmakepkg, 
command)) as pipe:
-               tmp = pipe.read()
+       p = subprocess.Popen("source {0};source ./FrugalBuild; 
{1}".format(fwmakepkg, command),
+               stdout=subprocess.PIPE,
+               stderr=subprocess.PIPE,
+               shell=True)
+       out, err = p.communicate()
+       if err:
+               print "@".join([fb, out, err]), "@"
os.chdir(cwd)
-       return tmp
+       return out


class FrugalBuild:
@@ -117,6 +125,8 @@ class FrugalBuild:
f.read()).groups()[0]
except IndexError:
self.m8r = "????????"  # probably Maintainer is empty
+               except AttributeError:
+                       self.m8r = "????????"

self.skip = False
if devel and self.m8r != devel:
_______________________________________________
Frugalware-git mailing list
[email protected]
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to