diff options
author | Todd Gamblin <tgamblin@llnl.gov> | 2017-03-07 14:25:48 -0800 |
---|---|---|
committer | Todd Gamblin <tgamblin@llnl.gov> | 2017-03-31 13:40:41 -0700 |
commit | 1d1a14dbe9cfc512cedff7430b694df87b2cd5ee (patch) | |
tree | 0736128966d347b5cf84a9f9781562b5ec3a17bf /lib/spack/llnl/util/tty/__init__.py | |
parent | 0331b08c64abbc3d7c185d9650007be1de238cfc (diff) | |
download | spack-1d1a14dbe9cfc512cedff7430b694df87b2cd5ee.tar.gz spack-1d1a14dbe9cfc512cedff7430b694df87b2cd5ee.tar.bz2 spack-1d1a14dbe9cfc512cedff7430b694df87b2cd5ee.tar.xz spack-1d1a14dbe9cfc512cedff7430b694df87b2cd5ee.zip |
Convert Python 2 idioms to Python 2/3-compatible ones.
- convert print, StringIO, except as, octals, izip
- convert print statement to print function
- convert StringIO to six.StringIO
- remove usage of csv reader in Spec, in favor of simple regex
- csv reader only does byte strings
- convert 0755 octal literals to 0o755
- convert `except Foo, e` to `except Foo as e`
- fix a few places `str` is used.
- may need to switch everything to str later.
- convert iteritems usages to use six.iteritems
- fix urllib and HTMLParser
- port metaclasses to use six.with_metaclass
- More octal literal conversions for Python 2/3
- Fix a new octal literal.
- Convert `basestring` to `six.string_types`
- Convert xrange -> range
- Fix various issues with encoding, iteritems, and Python3 semantics.
- Convert contextlib.nested to explicitly nexted context managers.
- Convert use of filter() to list comprehensions.
- Replace reduce() with list comprehensions.
- Clean up composite: replace inspect.ismethod() with callable()
- Python 3 doesn't have "method" objects; inspect.ismethod returns False.
- Need to use callable in Composite to make it work.
- Update colify to use future division.
- Fix zip() usages that need to be lists.
- Python3: Use line-buffered logging instead of unbuffered.
- Python3 raises an error with unbuffered I/O
- See https://bugs.python.org/issue17404
Diffstat (limited to 'lib/spack/llnl/util/tty/__init__.py')
-rw-r--r-- | lib/spack/llnl/util/tty/__init__.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/spack/llnl/util/tty/__init__.py b/lib/spack/llnl/util/tty/__init__.py index f73d96a4e4..f78d889037 100644 --- a/lib/spack/llnl/util/tty/__init__.py +++ b/lib/spack/llnl/util/tty/__init__.py @@ -29,7 +29,7 @@ import fcntl import termios import struct import traceback -from StringIO import StringIO +from six import StringIO from llnl.util.tty.color import * @@ -93,7 +93,7 @@ def msg(message, *args, **kwargs): else: cwrite("@*b{%s==>} %s" % (st_text, cescape(message))) for arg in args: - print indent + str(arg) + print(indent + str(arg)) def info(message, *args, **kwargs): @@ -201,7 +201,7 @@ def get_yes_or_no(prompt, **kwargs): if not ans: result = default_value if result is None: - print "Please enter yes or no." + print("Please enter yes or no.") else: if ans == 'y' or ans == 'yes': result = True @@ -239,7 +239,7 @@ def hline(label=None, **kwargs): out.write(label) out.write(suffix) - print out.getvalue() + print(out.getvalue()) def terminal_size(): |