Skip to content

Commit

Permalink
ran 2to3 on BuildTools directory
Browse files Browse the repository at this point in the history
  • Loading branch information
jedwards4b committed Oct 10, 2017
1 parent 4db671c commit 848d748
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
4 changes: 2 additions & 2 deletions scripts/lib/CIME/BuildTools/macroconditiontree.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def __init__(self, name, settings):
# To make merging more effective, sort the conditions.
all_conditions = []
for setting in settings:
all_conditions += setting.conditions.keys()
all_conditions += list(setting.conditions.keys())
if all_conditions:
condition = sorted(all_conditions)[0]
if condition is None:
Expand Down Expand Up @@ -119,7 +119,7 @@ def merge(self, other):
return other.merge(self)
# If neither is a leaf and their conditions match, merge
# their sets of branches.
for (cond_val, other_branch) in other._branches.items():
for (cond_val, other_branch) in list(other._branches.items()):
if cond_val in self._branches:
self._branches[cond_val] = \
self._branches[cond_val].merge(other_branch)
Expand Down
16 changes: 7 additions & 9 deletions scripts/lib/CIME/BuildTools/macrowriterbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def _get_components(value):

return components

class MacroWriterBase(object):
class MacroWriterBase(object, metaclass=ABCMeta):

"""Abstract base class for macro file writers.
Expand Down Expand Up @@ -101,8 +101,6 @@ class MacroWriterBase(object):
end_ifeq
"""

__metaclass__ = ABCMeta

indent_increment = 2

def __init__(self, output):
Expand Down Expand Up @@ -132,7 +130,7 @@ def write_line(self, line):
A trailing newline is added, whether or not the input has one.
"""
self.output.write(unicode(self.indent_string() + line + "\n"))
self.output.write(str(self.indent_string() + line + "\n"))

@abstractmethod
def environment_variable_string(self, name):
Expand Down Expand Up @@ -222,7 +220,7 @@ def write_macros_file_v1(macros, compiler, os_, machine, macros_file="Macros", o
fd.write("#\n# Makefile Macros \n")

# print the settings out to the Macros file
for key, value in sorted(macros.iteritems()):
for key, value in sorted(macros.items()):
if key == "_COND_":
pass
elif key.startswith("ADD_"):
Expand All @@ -248,7 +246,7 @@ def write_macros_file_v1(macros, compiler, os_, machine, macros_file="Macros", o
# print the settings out to the Macros file, do it in
# two passes so that path values appear first in the
# file.
for key, value in sorted(macros.iteritems()):
for key, value in sorted(macros.items()):
if key == "_COND_":
pass
else:
Expand All @@ -262,7 +260,7 @@ def write_macros_file_v1(macros, compiler, os_, machine, macros_file="Macros", o
fd.write("set({} {})\n".format(cmake_var, value))
fd.write("list(APPEND CMAKE_PREFIX_PATH {})\n\n".format(value))

for key, value in sorted(macros.iteritems()):
for key, value in sorted(macros.items()):
if key == "_COND_":
pass
else:
Expand Down Expand Up @@ -301,10 +299,10 @@ def write_macros_file_v1(macros, compiler, os_, machine, macros_file="Macros", o

def _parse_hash(macros, fd, depth, output_format, cmakedebug=""):
width = 2 * depth
for key, value in macros.iteritems():
for key, value in macros.items():
if type(value) is dict:
if output_format == "make" or "DEBUG" in key:
for key2, value2 in value.iteritems():
for key2, value2 in value.items():
if output_format == "make":
fd.write("{}ifeq ($({}), {}) \n".format(" " * width, key, key2))

Expand Down

0 comments on commit 848d748

Please sign in to comment.