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): ...@@ -38,7 +38,7 @@ def _run_command(args, stdout=_PIPE, stderr=_PIPE, encoding=None, stream=0):
except OSError: except OSError:
return 1, '' return 1, ''
#doubled checked and #doubled checked and
data = decode_as_string(data, encoding) data = decode_as_string(data, encoding)
#communciate calls wait() #communciate calls wait()
...@@ -77,19 +77,19 @@ def determine_console_encoding(): ...@@ -77,19 +77,19 @@ def determine_console_encoding():
try: try:
#try for the preferred encoding #try for the preferred encoding
encoding = locale.getpreferredencoding() encoding = locale.getpreferredencoding()
#see if the locale.getdefaultlocale returns null #see if the locale.getdefaultlocale returns null
#some versions of python\platforms return US-ASCII #some versions of python\platforms return US-ASCII
#when it cannot determine an encoding #when it cannot determine an encoding
if not encoding or encoding == "US-ASCII": if not encoding or encoding == "US-ASCII":
encoding = locale.getdefaultlocale()[1] encoding = locale.getdefaultlocale()[1]
if encoding: if encoding:
codecs.lookup(encoding) # make sure a lookup error is not made codecs.lookup(encoding) # make sure a lookup error is not made
except (locale.Error, LookupError): except (locale.Error, LookupError):
encoding = None encoding = None
is_osx = sys.platform == "darwin" is_osx = sys.platform == "darwin"
if not encoding: if not encoding:
return ["US-ASCII", "utf-8"][is_osx] return ["US-ASCII", "utf-8"][is_osx]
...@@ -99,30 +99,30 @@ def determine_console_encoding(): ...@@ -99,30 +99,30 @@ def determine_console_encoding():
return "utf-8" return "utf-8"
else: else:
return encoding return encoding
_console_encoding = determine_console_encoding() _console_encoding = determine_console_encoding()
def decode_as_string(text, encoding=None): def decode_as_string(text, encoding=None):
""" """
Decode the console or file output explicitly using getpreferredencoding. Decode the console or file output explicitly using getpreferredencoding.
The text paraemeter should be a encoded string, if not no decode occurs The text paraemeter should be a encoded string, if not no decode occurs
If no encoding is given, getpreferredencoding is used. If encoding is If no encoding is given, getpreferredencoding is used. If encoding is
specified, that is used instead. This would be needed for SVN --xml specified, that is used instead. This would be needed for SVN --xml
output. Unicode is explicitly put in composed NFC form. 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. 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: if encoding is None:
encoding = _console_encoding encoding = _console_encoding
if not isinstance(text, unicode): if not isinstance(text, unicode):
text = text.decode(encoding) text = text.decode(encoding)
text = unicodedata.normalize('NFC', text) text = unicodedata.normalize('NFC', text)
return text return text
...@@ -158,7 +158,7 @@ def parse_externals_xml(decoded_str, prefix=''): ...@@ -158,7 +158,7 @@ def parse_externals_xml(decoded_str, prefix=''):
path = path[len(prefix)+1:] path = path[len(prefix)+1:]
data = _get_target_property(node) data = _get_target_property(node)
#data should be decoded already #data should be decoded already
for external in parse_external_prop(data): for external in parse_external_prop(data):
externals.append(joinpath(path, external)) externals.append(joinpath(path, external))
...@@ -262,7 +262,7 @@ class SvnInfo(object): ...@@ -262,7 +262,7 @@ class SvnInfo(object):
except ValueError: except ValueError:
base_svn_version = tuple() 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)): or base_svn_version < (1, 3)):
warnings.warn(("No SVN 1.3+ command found: falling back " warnings.warn(("No SVN 1.3+ command found: falling back "
"on pre 1.7 .svn parsing"), DeprecationWarning) "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