~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/mergetools.py

  • Committer: Jelmer Vernooij
  • Date: 2012-04-16 11:08:11 UTC
  • mfrom: (6521 +trunk)
  • mto: This revision was merged to the branch mainline in revision 6522.
  • Revision ID: jelmer@samba.org-20120416110811-0y996ihqy9o2bb1t
Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
48
48
    cmd_list = cmdline.split(command_line)
49
49
    exe = cmd_list[0]
50
50
    if sys.platform == 'win32':
51
 
        if os.path.isabs(exe):
52
 
            base, ext = os.path.splitext(exe)
53
 
            path_ext = [unicode(s.lower())
54
 
                        for s in os.getenv('PATHEXT', '').split(os.pathsep)]
55
 
            return os.path.exists(exe) and ext in path_ext
56
 
        else:
57
 
            return osutils.find_executable_on_path(exe) is not None
 
51
        exe = _get_executable_path(exe)
 
52
        if exe is None:
 
53
            return False
 
54
        base, ext = os.path.splitext(exe)
 
55
        path_ext = [unicode(s.lower())
 
56
                    for s in os.getenv('PATHEXT', '').split(os.pathsep)]
 
57
        return os.path.exists(exe) and ext in path_ext
58
58
    else:
59
59
        return (os.access(exe, os.X_OK)
60
60
                or osutils.find_executable_on_path(exe) is not None)
69
69
    if invoker is None:
70
70
        invoker = subprocess_invoker
71
71
    cmd_list = cmdline.split(command_line)
 
72
    exe = _get_executable_path(cmd_list[0])
 
73
    if exe is not None:
 
74
        cmd_list[0] = exe
72
75
    args, tmp_file = _subst_filename(cmd_list, filename)
73
76
    def cleanup(retcode):
74
77
        if tmp_file is not None:
79
82
    return invoker(args[0], args[1:], cleanup)
80
83
 
81
84
 
 
85
def _get_executable_path(exe):
 
86
    if os.path.isabs(exe):
 
87
        return exe
 
88
    return osutils.find_executable_on_path(exe)
 
89
 
 
90
 
82
91
def _subst_filename(args, filename):
83
92
    subst_names = {
84
93
        'base': filename + u'.BASE',