X-Git-Url: https://git.ralfj.de/auto-debuild.git/blobdiff_plain/2e0776796423039fa487ed36ee9756abf0f5e28d..c8125bbd511e6d1c60bfef92e96bd3d485314fff:/auto_debuild.py diff --git a/auto_debuild.py b/auto_debuild.py index 410d848..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[0:len(res)-1] # 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)