~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/mergetools.py

  • Committer: Jelmer Vernooij
  • Date: 2012-02-01 19:18:09 UTC
  • mfrom: (6459 +trunk)
  • mto: This revision was merged to the branch mainline in revision 6460.
  • Revision ID: jelmer@samba.org-20120201191809-xn340a5i5v4fqsfu
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
 
        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
 
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
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
75
72
    args, tmp_file = _subst_filename(cmd_list, filename)
76
73
    def cleanup(retcode):
77
74
        if tmp_file is not None:
82
79
    return invoker(args[0], args[1:], cleanup)
83
80
 
84
81
 
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
 
 
91
82
def _subst_filename(args, filename):
92
83
    subst_names = {
93
84
        'base': filename + u'.BASE',