X-Git-Url: https://git.ralfj.de/auto-debuild.git/blobdiff_plain/49195767675bb04a0b42877452049b56a8369820..c8125bbd511e6d1c60bfef92e96bd3d485314fff:/auto_debuild.py diff --git a/auto_debuild.py b/auto_debuild.py index a5fb5bc..524603f 100755 --- a/auto_debuild.py +++ b/auto_debuild.py @@ -177,25 +177,23 @@ def commandInBuildEnv(config, command): def getArchitecture(config): cmd = commandInBuildEnv(config, ['dpkg-architecture', '-qDEB_HOST_ARCH']) - with subprocess.Popen(cmd, stdout=subprocess.PIPE) as p: - res = p.communicate()[0] # get only stdout - if p.returncode != 0: raise Exception("Querying dpkg for the architecture failed") - return res.decode('utf-8').strip('\n') # chop of the \n at the end + output = subprocess.check_output(cmd) + return output.decode('utf-8').strip('\n') # chop off the \n at the end def writeDependency(f, name, list): if len(list): print(name+": "+', '.join(list), file=f) +# actual work functions def deleteDebianFolder(): if os.path.islink('debian'): target = os.readlink('debian') if os.path.exists(target): shutil.rmtree(target) os.remove('debian') - else: + elif os.path.exists('debian'): shutil.rmtree('debian') -# actual work functions def createDebianFiles(config): if not isinstance(config, ConfigDict): config = ConfigDict(config)