pylint cleanups
authorGuido Guenther <agx@sigxcpu.org>
Thu, 18 Jan 2007 23:14:01 +0000 (00:14 +0100)
committerGuido Guenther <agx@bogon.sigxcpu.org>
Thu, 18 Jan 2007 23:14:01 +0000 (00:14 +0100)
git_buildpackage/deb_utils.py
git_buildpackage/git_utils.py

index 0801c4d602f3c6a710f428be95df7ca80730676c..cdcad4870e2714bd79394596902bab05c3c57206 100644 (file)
@@ -17,9 +17,9 @@ def parse_changelog(changelog):
         return None
     cp=email.message_from_string(output)
     if '-' in cp['Version']:
-        cp['Upstream-Version'], cp['Debian-Version'] = cp['Version'].rsplit('-',1)
+        cp['Upstream-Version'], cp['Debian-Version'] = cp['Version'].rsplit('-', 1)
     else:
-        cp['Debian-Version']=cp['Version']
+        cp['Debian-Version'] = cp['Version']
     return cp
  
 
index fa7fe38dfd5b252c31ff6465b78e8c4404d7620f..0c561958affcd983ed2a6326d6bdabc64d7aaf7f 100644 (file)
@@ -5,7 +5,6 @@
 
 import subprocess
 import os.path
-import re
 
 class GitRepositoryError(Exception):
     pass
@@ -19,7 +18,7 @@ class GitRepository(object):
             os.stat(os.path.join(path,'.git'))
         except:
             raise GitRepositoryError
-        self.path=os.path.abspath(path)
+        self.path = os.path.abspath(path)
 
     
     def __check_path(self):
@@ -29,7 +28,7 @@ class GitRepository(object):
 
     def __git_getoutput(self, command):
         """Exec a git command and return the output"""
-        popen = subprocess.Popen(['git',command], stdout=subprocess.PIPE)
+        popen = subprocess.Popen(['git', command], stdout=subprocess.PIPE)
         popen.wait()
         return popen.stdout.readlines()
 
@@ -38,7 +37,7 @@ class GitRepository(object):
         """check if the repository has branch 'branch'"""
         self.__check_path()
         for line in self.__git_getoutput('branch'):
-            if line.split(' ',1)[1].strip() == branch:
+            if line.split(' ', 1)[1].strip() == branch:
                 return True
         return False
 
@@ -48,27 +47,27 @@ class GitRepository(object):
         self.__check_path()
         for line in self.__git_getoutput('branch'):
             if line.startswith('*'):
-                return line.split(' ',1)[1].strip()
+                return line.split(' ', 1)[1].strip()
         
 
     def is_clean(self):
         """does the repository contain any uncommitted modifications"""
         self.__check_path()
-        clean_msg='nothing to commit'
+        clean_msg = 'nothing to commit'
         out = self.__git_getoutput('status')
         if out[0].strip() == clean_msg:
-            ret=True
+            ret = True
         elif out[0].startswith('#') and out[1].strip() == clean_msg:
-            ret=True
+            ret = True
         else:
-            ret=False
+            ret = False
         return (ret, "".join(out))
 
 
 def sanitize_version(version):
     """sanitize a version so git accepts it as a tag"""
     if ':' in version: # strip of any epochs
-        version=version.split(':',1)[1]
-    return version.replace('~','.')
+        version=version.split(':', 1)[1]
+    return version.replace('~', '.')
 
 # vim:et:ts=4:sw=4: