Fixed pyflakes/pylint warnings
authorThomas Leonard <talex5@gmail.com>
Sat, 15 Sep 2012 09:21:43 +0000 (15 10:21 +0100)
committerThomas Leonard <talex5@gmail.com>
Sat, 15 Sep 2012 09:27:26 +0000 (15 10:27 +0100)
0release
compile.py
release.py
scm.py
setup.py
support.py

index e1513f0..e223e9f 100755 (executable)
--- a/0release
+++ b/0release
@@ -11,7 +11,7 @@ if zi is not None:
        # (and we want our setup.py, not 0install's)
        sys.path.insert(1, zi)
 from zeroinstall import SafeException
-from zeroinstall.injector import reader, model, qdom
+from zeroinstall.injector import qdom
 
 version = '0.13'
 
index b937b59..e3ca162 100644 (file)
@@ -1,10 +1,9 @@
 # Copyright (C) 2009, Thomas Leonard
 # See the README file for details, or visit http://0install.net.
 
-import tempfile, shutil, subprocess, os
+import tempfile, shutil, os
 import ConfigParser
 from logging import info
-from zeroinstall.injector import model
 from zeroinstall.support import basedir
 
 import support
index 4aaad6b..9235457 100644 (file)
@@ -1,9 +1,9 @@
 # Copyright (C) 2009, Thomas Leonard
 # See the README file for details, or visit http://0install.net.
 
-import os, sys, subprocess, shutil, tempfile
+import os, subprocess, shutil
 from zeroinstall import SafeException
-from zeroinstall.injector import reader, model, qdom
+from zeroinstall.injector import model
 from zeroinstall.support import ro_rmtree
 from logging import info, warn
 
@@ -268,7 +268,7 @@ def do_release(local_feed, options):
                finally:
                        changelog.close()
        
-       def fail_candidate(archive_file):
+       def fail_candidate():
                cwd = os.getcwd()
                assert cwd.endswith(status.release_version)
                support.backup_if_exists(cwd)
@@ -276,7 +276,7 @@ def do_release(local_feed, options):
                os.unlink(support.release_status_file)
                print "Restored to state before starting release. Make your fixes and try again..."
 
-       def accept_and_publish(archive_file, archive_name, src_feed_name):
+       def accept_and_publish(archive_file, src_feed_name):
                assert options.master_feed_file
 
                if not options.archive_dir_public_url:
@@ -428,7 +428,7 @@ def do_release(local_feed, options):
                                support.check_call(['tar', 'cjf', archive_file, archive_name])
                        except SafeException:
                                scm.reset_hard(scm.get_current_branch())
-                               fail_candidate(archive_file)
+                               fail_candidate()
                                raise
 
                status.created_archive = 'true'
@@ -474,14 +474,13 @@ def do_release(local_feed, options):
                        status.save()
        except SafeException:
                print "(leaving extracted directory for examination)"
-               fail_candidate(archive_file)
+               fail_candidate()
                raise
        # Unpack it again in case the unit-tests changed anything
        ro_rmtree(archive_name)
        support.unpack_tarball(archive_file)
 
        # Generate feed for source
-       stream = open(extracted_feed_path)
        src_feed_name = '%s.xml' % archive_name
        create_feed(src_feed_name, extracted_feed_path, archive_file, archive_name, main)
        print "Wrote source feed as %s" % src_feed_name
@@ -538,7 +537,7 @@ def do_release(local_feed, options):
        shutil.rmtree(archive_name)
 
        if choice == 'Publish':
-               accept_and_publish(archive_file, archive_name, src_feed_name)
+               accept_and_publish(archive_file, src_feed_name)
        else:
                assert choice == 'Fail'
-               fail_candidate(archive_file)
+               fail_candidate()
diff --git a/scm.py b/scm.py
index 1a8e96d..0532f22 100644 (file)
--- a/scm.py
+++ b/scm.py
@@ -150,7 +150,7 @@ class GIT(SCM):
                child.wait()
                if child.returncode in [0, 1]:
                        return
-               warn("git grep returned exit code %d", proc.returncode)
+               warn("git grep returned exit code %d", child.returncode)
 
        def has_submodules(self):
                return os.path.isfile(os.path.join(self.root_dir, '.gitmodules'))
index 6b8f4a0..17a3dea 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -1,9 +1,8 @@
 # Copyright (C) 2007, Thomas Leonard
 # See the README file for details, or visit http://0install.net.
 
-import os, sys
+import os
 from zeroinstall import SafeException
-from zeroinstall.injector import reader, model
 
 release_uri = 'http://0install.net/2007/interfaces/0release.xml'
 
index 9445426..953e042 100644 (file)
@@ -58,8 +58,6 @@ def publish(feed_path, **kwargs):
        check_call(args)
 
 def get_singleton_impl(feed):
-       if isinstance(feed, model.Interface):
-               feed = feed._main_feed
        impls = feed.implementations
        if len(impls) != 1:
                raise SafeException("Local feed '%s' contains %d versions! I need exactly one!" % (feed.url, len(impls)))