From: Ralf Jung Date: Sun, 27 Oct 2013 20:40:45 +0000 (+0100) Subject: fix deleteDebianFolder in case the folder does not exist in the first place X-Git-Url: https://git.ralfj.de/auto-debuild.git/commitdiff_plain/c8125bbd511e6d1c60bfef92e96bd3d485314fff?hp=c36195ffb7cf682d2ddd2ba754064c79b2a7fc53 fix deleteDebianFolder in case the folder does not exist in the first place --- diff --git a/auto_debuild.py b/auto_debuild.py index 11935ef..524603f 100755 --- a/auto_debuild.py +++ b/auto_debuild.py @@ -178,22 +178,22 @@ def commandInBuildEnv(config, command): def getArchitecture(config): cmd = commandInBuildEnv(config, ['dpkg-architecture', '-qDEB_HOST_ARCH']) output = subprocess.check_output(cmd) - return output.decode('utf-8').strip('\n') # chop of the \n at the end + 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)