Make Homebrew-related modules run on Python 3
Both the `homebrew` and `homebrew_cask` modules iterate over dictionaries using `iteritems`. This is a Python 2-specific method whose behavior is similar to `items` in Python 3+. The `iteritems` function in the six library was designed to make it possible to use the correct method.
This commit is contained in:
parent
64c994c641
commit
3a26a1bfcc
2 changed files with 6 additions and 2 deletions
|
@ -101,6 +101,8 @@ EXAMPLES = '''
|
||||||
import os.path
|
import os.path
|
||||||
import re
|
import re
|
||||||
|
|
||||||
|
from ansible.module_utils.six import iteritems
|
||||||
|
|
||||||
|
|
||||||
# exceptions -------------------------------------------------------------- {{{
|
# exceptions -------------------------------------------------------------- {{{
|
||||||
class HomebrewException(Exception):
|
class HomebrewException(Exception):
|
||||||
|
@ -348,7 +350,7 @@ class Homebrew(object):
|
||||||
self.message = ''
|
self.message = ''
|
||||||
|
|
||||||
def _setup_instance_vars(self, **kwargs):
|
def _setup_instance_vars(self, **kwargs):
|
||||||
for key, val in kwargs.iteritems():
|
for key, val in iteritems(kwargs):
|
||||||
setattr(self, key, val)
|
setattr(self, key, val)
|
||||||
|
|
||||||
def _prep(self):
|
def _prep(self):
|
||||||
|
|
|
@ -75,6 +75,8 @@ EXAMPLES = '''
|
||||||
import os.path
|
import os.path
|
||||||
import re
|
import re
|
||||||
|
|
||||||
|
from ansible.module_utils.six import iteritems
|
||||||
|
|
||||||
|
|
||||||
# exceptions -------------------------------------------------------------- {{{
|
# exceptions -------------------------------------------------------------- {{{
|
||||||
class HomebrewCaskException(Exception):
|
class HomebrewCaskException(Exception):
|
||||||
|
@ -309,7 +311,7 @@ class HomebrewCask(object):
|
||||||
self.message = ''
|
self.message = ''
|
||||||
|
|
||||||
def _setup_instance_vars(self, **kwargs):
|
def _setup_instance_vars(self, **kwargs):
|
||||||
for key, val in kwargs.iteritems():
|
for key, val in iteritems(kwargs):
|
||||||
setattr(self, key, val)
|
setattr(self, key, val)
|
||||||
|
|
||||||
def _prep(self):
|
def _prep(self):
|
||||||
|
|
Loading…
Reference in a new issue