Skip to content

Commit

Permalink
Apply pyflakes to slave - fixes buildbot#1714
Browse files Browse the repository at this point in the history
This uncovered a number of missing imports, so it was well worth it!
  • Loading branch information
djmitche committed Dec 9, 2010
1 parent 9ed53fc commit ec4ee44
Show file tree
Hide file tree
Showing 31 changed files with 24 additions and 76 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ pylint:

pyflakes:
cd master; $(MAKE) pyflakes
cd slave; $(MAKE) pyflakes
3 changes: 3 additions & 0 deletions slave/Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# developer utilities
pylint:
pylint --rcfile=../common/pylintrc buildslave

pyflakes:
pyflakes buildslave
8 changes: 4 additions & 4 deletions slave/buildslave/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from twisted.spread import pb
from twisted.python import log
from twisted.internet import reactor, defer, error
from twisted.internet import reactor, error
from twisted.application import service, internet
from twisted.cred import credentials

Expand Down Expand Up @@ -71,9 +71,9 @@ def stopService(self):
def activity(self):
bot = self.parent
if bot:
buildslave = bot.parent
if buildslave:
bf = buildslave.bf
bslave = bot.parent
if bslave:
bf = bslave.bf
bf.activity()

def remote_setMaster(self, remote):
Expand Down
6 changes: 2 additions & 4 deletions slave/buildslave/commands/base.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@

import os, signal, types, re, traceback
from stat import ST_CTIME, ST_MTIME, ST_SIZE
from base64 import b64encode
import os
from base64 import b64encode
import sys
import shutil

from zope.interface import implements
from twisted.internet import reactor, defer, task
from twisted.internet import reactor, defer
from twisted.python import log, failure, runtime

from buildslave.interfaces import ISlaveCommand
Expand Down
5 changes: 2 additions & 3 deletions slave/buildslave/commands/bk.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

from buildslave.commands.base import SourceBaseCommand
from buildslave import runprocess
from buildslave.commands import utils


class BK(SourceBaseCommand):
Expand Down Expand Up @@ -34,7 +33,8 @@ def sourcedirIsUpdateable(self):

def doVCUpdate(self):
bk = self.getCommand('bk')
revision = self.args['revision'] or 'HEAD'
# XXX revision is never used!! - bug #1715
# revision = self.args['revision'] or 'HEAD'
# update: possible for mode in ('copy', 'update')
d = os.path.join(self.builder.basedir, self.srcdir)

Expand Down Expand Up @@ -83,7 +83,6 @@ def parseGotRevision(self):
d = c.start()
def _parse(res):
r_raw = c.stdout.strip()
got_version = None
try:
r = r_raw
except:
Expand Down
1 change: 0 additions & 1 deletion slave/buildslave/commands/bzr.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

from buildslave.commands.base import SourceBaseCommand
from buildslave import runprocess
from buildslave.commands import utils


class Bzr(SourceBaseCommand):
Expand Down
1 change: 0 additions & 1 deletion slave/buildslave/commands/cvs.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

from buildslave.commands.base import SourceBaseCommand
from buildslave import runprocess
from buildslave.commands import utils

class CVS(SourceBaseCommand):
"""CVS-specific VC operation. In addition to the arguments handled by
Expand Down
1 change: 0 additions & 1 deletion slave/buildslave/commands/darcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

from buildslave.commands.base import SourceBaseCommand
from buildslave import runprocess
from buildslave.commands import utils


class Darcs(SourceBaseCommand):
Expand Down
3 changes: 2 additions & 1 deletion slave/buildslave/commands/fs.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import os
import sys
import shutil

from twisted.internet import defer
from twisted.python import runtime
from twisted.python import runtime, log

from buildslave import runprocess
from buildslave.commands import base, utils
Expand Down
1 change: 0 additions & 1 deletion slave/buildslave/commands/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

from buildslave.commands.base import SourceBaseCommand
from buildslave import runprocess
from buildslave.commands import utils
from buildslave.commands.base import AbandonChain


Expand Down
1 change: 0 additions & 1 deletion slave/buildslave/commands/hg.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

from buildslave.commands.base import SourceBaseCommand, AbandonChain
from buildslave import runprocess
from buildslave.commands import utils
from buildslave.util import remove_userpassword


Expand Down
1 change: 0 additions & 1 deletion slave/buildslave/commands/p4.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

from buildslave.commands.base import SourceBaseCommand
from buildslave import runprocess
from buildslave.commands import utils
from buildslave.util import Obfuscated


Expand Down
2 changes: 1 addition & 1 deletion slave/buildslave/commands/transfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from twisted.python import log
from twisted.internet import defer

from buildslave.commands.base import Command, command_version
from buildslave.commands.base import Command

class SlaveFileUploadCommand(Command):
"""
Expand Down
5 changes: 2 additions & 3 deletions slave/buildslave/runprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"""

import os
import sys
import signal
import types
import re
Expand All @@ -12,7 +11,7 @@
from collections import deque

from twisted.python import runtime, log
from twisted.internet import reactor, defer, protocol, task
from twisted.internet import reactor, defer, protocol, task, error

from buildslave import util
from buildslave.exceptions import AbandonChain
Expand Down Expand Up @@ -732,7 +731,7 @@ def kill(self, msg):
except OSError:
# could be no-such-process, because they finished very recently
pass
except twisted.internet.error.ProcessExitedAlready:
except error.ProcessExitedAlready:
# Twisted thinks the process has already exited
pass
if not hit:
Expand Down
6 changes: 2 additions & 4 deletions slave/buildslave/scripts/runner.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# N.B.: don't import anything that might pull in a reactor yet. Some of our
# subcommands want to load modules that need the gtk reactor.
import os, sys, stat, re, time
import traceback
from twisted.python import usage, util, runtime
import os, sys, re, time
from twisted.python import usage

def isBuildslaveDir(dir):
buildbot_tac = os.path.join(dir, "buildbot.tac")
Expand Down Expand Up @@ -212,7 +211,6 @@ def stop(config, signame="TERM", wait=False, returnFalseOnNotRunning=False):
print "never saw process go away"

def restart(config):
basedir = config['basedir']
quiet = config['quiet']

if not isBuildslaveDir(config['basedir']):
Expand Down
2 changes: 1 addition & 1 deletion slave/buildslave/test/fake/runprocess.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from twisted.python import failure
from twisted.internet import defer, reactor
from twisted.internet import defer

class Expect:
"""
Expand Down
1 change: 0 additions & 1 deletion slave/buildslave/test/unit/test_bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from twisted.trial import unittest
from twisted.internet import defer, reactor
from twisted.python import failure, log
from zope.interface import implements
import mock

from buildslave.test.util import command
Expand Down
7 changes: 1 addition & 6 deletions slave/buildslave/test/unit/test_commands_base.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
import sys, re
import pprint
import time

from twisted.trial import unittest
from twisted.internet import task, defer
from twisted.python import runtime
from twisted.internet import defer

from buildslave.test.util.command import CommandTestMixin
from buildslave.commands.base import Command
Expand Down
3 changes: 0 additions & 3 deletions slave/buildslave/test/unit/test_commands_bk.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import os

from twisted.trial import unittest
from twisted.python import runtime

from buildslave.test.fake.runprocess import Expect
from buildslave.test.util.sourcecommand import SourceCommandTestMixin
Expand Down
2 changes: 0 additions & 2 deletions slave/buildslave/test/unit/test_commands_bzr.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import os
import textwrap

from twisted.trial import unittest
from twisted.python import runtime

from buildslave.test.fake.runprocess import Expect
from buildslave.test.util.sourcecommand import SourceCommandTestMixin
Expand Down
4 changes: 0 additions & 4 deletions slave/buildslave/test/unit/test_commands_cvs.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import os

from twisted.trial import unittest
from twisted.python import runtime

from buildslave.test.fake.runprocess import Expect
from buildslave.test.util.sourcecommand import SourceCommandTestMixin
Expand All @@ -26,7 +23,6 @@ def test_simple(self):
cvsmodule='htdocs',
))

exp_environ = dict(PWD='.', LC_MESSAGES='C')
expects = [
Expect([ 'clobber', 'workdir' ],
self.basedir)
Expand Down
3 changes: 0 additions & 3 deletions slave/buildslave/test/unit/test_commands_darcs.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import os

from twisted.trial import unittest
from twisted.python import runtime

from buildslave.test.fake.runprocess import Expect
from buildslave.test.util.sourcecommand import SourceCommandTestMixin
Expand Down
1 change: 0 additions & 1 deletion slave/buildslave/test/unit/test_commands_fs.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import os

from twisted.trial import unittest
from twisted.python import runtime

from buildslave.test.util.command import CommandTestMixin
from buildslave.commands import fs
Expand Down
6 changes: 0 additions & 6 deletions slave/buildslave/test/unit/test_commands_git.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import os

from twisted.trial import unittest
from twisted.python import runtime

from buildslave.test.fake.runprocess import Expect
from buildslave.test.util.sourcecommand import SourceCommandTestMixin
Expand All @@ -25,7 +22,6 @@ def test_simple(self):
repourl='git://github.com/djmitche/buildbot.git',
))

exp_environ = dict(PWD='.', LC_MESSAGES='C')
expects = [
Expect([ 'clobber', 'workdir' ],
self.basedir)
Expand Down Expand Up @@ -91,7 +87,6 @@ def sourcedirIsUpdateable():
return True
self.patch(self.cmd, "sourcedirIsUpdateable", sourcedirIsUpdateable)

exp_environ = dict(PWD='.', LC_MESSAGES='C')
expects = [
Expect([ 'clobber', 'workdir' ],
self.basedir)
Expand Down Expand Up @@ -135,7 +130,6 @@ def test_nonexistant_ref(self):
repourl='git://github.com/djmitche/buildbot.git',
))

exp_environ = dict(PWD='.', LC_MESSAGES='C')
expects = [
Expect([ 'clobber', 'workdir' ],
self.basedir)
Expand Down
3 changes: 0 additions & 3 deletions slave/buildslave/test/unit/test_commands_hg.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import os

from twisted.trial import unittest
from twisted.python import runtime

from buildslave.test.fake.runprocess import Expect
from buildslave.test.util.sourcecommand import SourceCommandTestMixin
Expand Down
4 changes: 0 additions & 4 deletions slave/buildslave/test/unit/test_commands_p4.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
import os
import textwrap

from twisted.trial import unittest
from twisted.python import runtime

from buildslave.test.fake.runprocess import Expect
from buildslave.test.util.sourcecommand import SourceCommandTestMixin
Expand Down
2 changes: 0 additions & 2 deletions slave/buildslave/test/unit/test_commands_shell.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
from twisted.trial import unittest
from twisted.internet import task, defer
from twisted.python import runtime

from buildslave.test.fake.runprocess import Expect
from buildslave.test.util.command import CommandTestMixin
Expand Down
3 changes: 0 additions & 3 deletions slave/buildslave/test/unit/test_commands_svn.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import os

from twisted.trial import unittest
from twisted.python import runtime

from buildslave.test.fake.runprocess import Expect
from buildslave.test.util.sourcecommand import SourceCommandTestMixin
Expand Down
5 changes: 2 additions & 3 deletions slave/buildslave/test/unit/test_commands_transfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@
import StringIO

from twisted.trial import unittest
from twisted.internet import task, defer, reactor
from twisted.internet import defer, reactor
from twisted.python import runtime

from buildslave.test.fake.runprocess import Expect
from buildslave.test.fake.remote import FakeRemote
from buildslave.test.util.command import CommandTestMixin
from buildslave.commands import transfer
Expand Down Expand Up @@ -389,7 +388,7 @@ def check(_):
return d

def test_interrupted(self):
self.fakemaster.data = test_data = 'tenchars--' * 100 # 1k
self.fakemaster.data = 'tenchars--' * 100 # 1k
self.fakemaster.delay_read = True # read veery slowly

self.make_command(transfer.SlaveFileDownloadCommand, dict(
Expand Down
2 changes: 1 addition & 1 deletion slave/buildslave/test/unit/test_runprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import twisted
from twisted.trial import unittest
from twisted.internet import task, defer
from twisted.internet import task
from twisted.python import runtime

from buildslave.test.util.misc import nl, BasedirMixin
Expand Down
7 changes: 0 additions & 7 deletions slave/buildslave/test/util/sourcecommand.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,6 @@ def doClobber(_, dirname):
return r.start()
cmd.doClobber = doClobber

def doClobber(_, dirname):
r = runprocess.RunProcess(self.builder,
[ 'clobber', dirname ],
self.builder.basedir)
return r.start()
cmd.doClobber = doClobber

def doCopy(_):
r = runprocess.RunProcess(self.builder,
[ 'copy', cmd.srcdir, cmd.workdir ],
Expand Down

0 comments on commit ec4ee44

Please sign in to comment.