Commit 5535cfdb authored by Jason R. Coombs's avatar Jason R. Coombs

Resave with excess whitespace removed

parent ecb026c6
......@@ -38,7 +38,7 @@ def _run_command(args, stdout=_PIPE, stderr=_PIPE, encoding=None, stream=0):
except OSError:
return 1, ''
#doubled checked and
#doubled checked and
data = decode_as_string(data, encoding)
#communciate calls wait()
......@@ -77,19 +77,19 @@ def determine_console_encoding():
try:
#try for the preferred encoding
encoding = locale.getpreferredencoding()
#see if the locale.getdefaultlocale returns null
#some versions of python\platforms return US-ASCII
#when it cannot determine an encoding
if not encoding or encoding == "US-ASCII":
encoding = locale.getdefaultlocale()[1]
if encoding:
codecs.lookup(encoding) # make sure a lookup error is not made
except (locale.Error, LookupError):
encoding = None
is_osx = sys.platform == "darwin"
if not encoding:
return ["US-ASCII", "utf-8"][is_osx]
......@@ -99,30 +99,30 @@ def determine_console_encoding():
return "utf-8"
else:
return encoding
_console_encoding = determine_console_encoding()
def decode_as_string(text, encoding=None):
"""
Decode the console or file output explicitly using getpreferredencoding.
The text paraemeter should be a encoded string, if not no decode occurs
If no encoding is given, getpreferredencoding is used. If encoding is
specified, that is used instead. This would be needed for SVN --xml
If no encoding is given, getpreferredencoding is used. If encoding is
specified, that is used instead. This would be needed for SVN --xml
output. Unicode is explicitly put in composed NFC form.
--xml should be UTF-8 (SVN Issue 2938) the discussion on the Subversion
--xml should be UTF-8 (SVN Issue 2938) the discussion on the Subversion
DEV List from 2007 seems to indicate the same.
"""
#text should be a byte string
#text should be a byte string
if encoding is None:
encoding = _console_encoding
if not isinstance(text, unicode):
text = text.decode(encoding)
text = unicodedata.normalize('NFC', text)
return text
......@@ -158,7 +158,7 @@ def parse_externals_xml(decoded_str, prefix=''):
path = path[len(prefix)+1:]
data = _get_target_property(node)
#data should be decoded already
#data should be decoded already
for external in parse_external_prop(data):
externals.append(joinpath(path, external))
......@@ -262,7 +262,7 @@ class SvnInfo(object):
except ValueError:
base_svn_version = tuple()
if has_svn and (code or not base_svn_version
if has_svn and (code or not base_svn_version
or base_svn_version < (1, 3)):
warnings.warn(("No SVN 1.3+ command found: falling back "
"on pre 1.7 .svn parsing"), DeprecationWarning)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment