~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/externalcommand.py

  • Committer: Robey Pointer
  • Date: 2005-11-22 01:41:46 UTC
  • mfrom: (1185.40.1)
  • mto: (1185.33.37 bzr.dev)
  • mto: This revision was merged to the branch mainline in revision 1512.
  • Revision ID: robey@lag.net-20051122014146-5186f5e310a15202
make sftp put faster when using paramiko 1.5.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
import sys
24
24
 
25
25
from bzrlib.commands import Command
26
 
from bzrlib.osutils import pathjoin
27
26
 
28
27
 
29
28
class ExternalCommand(Command):
38
37
            ## Empty directories are not real paths
39
38
            if not dir:
40
39
                continue
41
 
            # This needs to be os.path.join() or windows cannot
42
 
            # find the batch file that you are wanting to execute
43
40
            path = os.path.join(dir, cmd)
44
41
            if os.path.isfile(path):
45
42
                return ExternalCommand(path)
50
47
    def __init__(self, path):
51
48
        self.path = path
52
49
 
 
50
 
53
51
    def name(self):
54
 
        return os.path.basename(self.path)
 
52
        return self.path.split(os.sep)[-1]
 
53
 
55
54
 
56
55
    def run(self, *args, **kwargs):
57
56
        raise NotImplementedError('should not be called on %r' % self)
58
57
 
59
 
    def run_argv(self, argv, alias_argv=None):
 
58
 
 
59
    def run_argv(self, argv):
60
60
        return os.spawnv(os.P_WAIT, self.path, [self.path] + argv)
61
61
 
 
62
 
62
63
    def help(self):
63
64
        m = 'external command from %s\n\n' % self.path
64
65
        pipe = os.popen('%s --help' % self.path)
65
66
        return m + pipe.read()
66