/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/diff.py

  • Committer: Alexander Belchenko
  • Date: 2007-03-07 00:57:40 UTC
  • mto: This revision was merged to the branch mainline in revision 2335.
  • Revision ID: bialix@ukr.net-20070307005740-bjpjks1bgk8efuo0
win32 fixes for test_external_diff_binary (gettext on win32 rely on $LANGUAGE)

Show diffs side-by-side

added added

removed removed

Lines of Context:
95
95
    print >>to_file
96
96
 
97
97
 
98
 
def _set_lang_C():
99
 
    """Set the env vars LANG=C and LC_ALL=C."""
100
 
    osutils.set_or_unset_env('LANG', 'C')
101
 
    osutils.set_or_unset_env('LC_ALL', 'C')
102
 
    osutils.set_or_unset_env('LC_CTYPE', None)
103
 
    osutils.set_or_unset_env('LANGUAGE', None)
104
 
 
105
 
 
106
98
def _spawn_external_diff(diffcmd, capture_errors=True):
107
99
    """Spawn the externall diff process, and return the child handle.
108
100
 
113
105
    :return: A Popen object.
114
106
    """
115
107
    if capture_errors:
 
108
        # construct minimal environment
 
109
        env = {}
 
110
        path = os.environ.get('PATH')
 
111
        if path is not None:
 
112
            env['PATH'] = path
116
113
        if sys.platform == 'win32':
117
 
            # Win32 doesn't support preexec_fn, but that is
118
 
            # okay, because it doesn't support LANG and LC_ALL either.
119
 
            preexec_fn = None
 
114
            # diffutils+gettext from http://gnuwin32.sf.net use only LANGUAGE
 
115
            env['LANGUAGE'] = 'C'
120
116
        else:
121
 
            preexec_fn = _set_lang_C
 
117
            env['LANG'] = 'C'
 
118
            env['LC_ALL'] = 'C'
122
119
        stderr = subprocess.PIPE
123
120
    else:
124
 
        preexec_fn = None
 
121
        env = None
125
122
        stderr = None
126
123
 
127
124
    try:
129
126
                                stdin=subprocess.PIPE,
130
127
                                stdout=subprocess.PIPE,
131
128
                                stderr=stderr,
132
 
                                preexec_fn=preexec_fn)
 
129
                                env=env)
133
130
    except OSError, e:
134
131
        if e.errno == errno.ENOENT:
135
132
            raise errors.NoDiff(str(e))