summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMonty Taylor <mordred@inaugust.com>2013-03-10 21:24:29 -0400
committerMonty Taylor <mordred@inaugust.com>2013-03-10 21:24:29 -0400
commitcf8971c5d9ac657fac446625d6a11f01b0676728 (patch)
tree6bb3d7229979ed3d09ec14dfce90b3f496971e25
parent8a4789883a38aef43e558abee7c5a27f0d7cc03b (diff)
downloadpbr-cf8971c5d9ac657fac446625d6a11f01b0676728.tar.gz
pep8/pyflakes fixes.
Change-Id: I61fe65815d924fdcaf742e4e6af6a2885e8c2354
-rw-r--r--oslo/packaging/core.py3
-rw-r--r--oslo/packaging/extern/six.py19
-rw-r--r--oslo/packaging/util.py23
3 files changed, 26 insertions, 19 deletions
diff --git a/oslo/packaging/core.py b/oslo/packaging/core.py
index 9e78b49..b6d8e04 100644
--- a/oslo/packaging/core.py
+++ b/oslo/packaging/core.py
@@ -55,7 +55,6 @@ from setuptools.dist import _get_unpatched
from .extern import six
from oslo.packaging import util
-from oslo.packaging import packaging
_Distribution = _get_unpatched(_Distribution)
log.set_verbosity(log.INFO)
@@ -63,7 +62,7 @@ log.set_verbosity(log.INFO)
def setup(dist, attr, value):
"""Implements the actual oslo.packaging setup() keyword.
-
+
When used, this should be the only keyword in your setup() aside from
`setup_requires`.
diff --git a/oslo/packaging/extern/six.py b/oslo/packaging/extern/six.py
index 0cdd1c7..5335015 100644
--- a/oslo/packaging/extern/six.py
+++ b/oslo/packaging/extern/six.py
@@ -129,7 +129,6 @@ class MovedAttribute(_LazyDescr):
return getattr(module, self.attr)
-
class _MovedItems(types.ModuleType):
"""Lazy loading of moved objects"""
@@ -163,8 +162,10 @@ _moved_attributes = [
MovedModule("tkinter", "Tkinter"),
MovedModule("tkinter_dialog", "Dialog", "tkinter.dialog"),
MovedModule("tkinter_filedialog", "FileDialog", "tkinter.filedialog"),
- MovedModule("tkinter_scrolledtext", "ScrolledText", "tkinter.scrolledtext"),
- MovedModule("tkinter_simpledialog", "SimpleDialog", "tkinter.simpledialog"),
+ MovedModule("tkinter_scrolledtext", "ScrolledText",
+ "tkinter.scrolledtext"),
+ MovedModule("tkinter_simpledialog", "SimpleDialog",
+ "tkinter.simpledialog"),
MovedModule("tkinter_tix", "Tix", "tkinter.tix"),
MovedModule("tkinter_constants", "Tkconstants", "tkinter.constants"),
MovedModule("tkinter_dnd", "Tkdnd", "tkinter.dnd"),
@@ -265,18 +266,22 @@ def iterkeys(d):
"""Return an iterator over the keys of a dictionary."""
return iter(getattr(d, _iterkeys)())
+
def itervalues(d):
"""Return an iterator over the values of a dictionary."""
return iter(getattr(d, _itervalues)())
+
def iteritems(d):
"""Return an iterator over the (key, value) pairs of a dictionary."""
return iter(getattr(d, _iteritems)())
if PY3:
+
def b(s):
return s.encode("latin-1")
+
def u(s):
return s
if sys.version_info[1] <= 1:
@@ -289,8 +294,10 @@ if PY3:
StringIO = io.StringIO
BytesIO = io.BytesIO
else:
+
def b(s):
return s
+
def u(s):
return unicode(s, "unicode_escape")
int2byte = chr
@@ -304,17 +311,16 @@ if PY3:
import builtins
exec_ = getattr(builtins, "exec")
-
def reraise(tp, value, tb=None):
if value.__traceback__ is not tb:
raise value.with_traceback(tb)
raise value
-
print_ = getattr(builtins, "print")
del builtins
else:
+
def exec_(code, globs=None, locs=None):
"""Execute code in a namespace."""
if globs is None:
@@ -327,17 +333,16 @@ else:
locs = globs
exec("""exec code in globs, locs""")
-
exec_("""def reraise(tp, value, tb=None):
raise tp, value, tb
""")
-
def print_(*args, **kwargs):
"""The new-style print function."""
fp = kwargs.pop("file", sys.stdout)
if fp is None:
return
+
def write(data):
if not isinstance(data, basestring):
data = str(data)
diff --git a/oslo/packaging/util.py b/oslo/packaging/util.py
index b3dda90..05ebb28 100644
--- a/oslo/packaging/util.py
+++ b/oslo/packaging/util.py
@@ -13,23 +13,24 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-# Copyright (C) 2013 Association of Universities for Research in Astronomy (AURA)
-
+# Copyright (C) 2013 Association of Universities for Research in Astronomy
+# (AURA)
+#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
-#
+#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
-#
+#
# 2. Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following
# disclaimer in the documentation and/or other materials provided
# with the distribution.
-#
+#
# 3. The name of AURA and its representatives may not be used to
# endorse or promote products derived from this software without
# specific prior written permission.
-#
+#
# THIS SOFTWARE IS PROVIDED BY AURA ``AS IS'' AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
@@ -224,7 +225,7 @@ def cfg_to_args(path='setup.cfg'):
setup_hooks = split_multiline(setup_hooks)
for hook in setup_hooks:
hook_fn = resolve_name(hook)
- try :
+ try:
hook_fn(config)
except:
e = sys.exc_info()[1]
@@ -257,6 +258,7 @@ def cfg_to_args(path='setup.cfg'):
raise DistutilsFileError(
'%s from the extra_files option in setup.cfg does not '
'exist' % filename)
+
# Unfortunately the only really sensible way to do this is to
# monkey-patch the manifest_maker class
@monkeypatch_method(manifest_maker)
@@ -298,6 +300,7 @@ def setup_cfg_to_setup_kwargs(config):
in_cfg_value = has_get_option(config, section, option)
if not in_cfg_value:
+
# There is no such option in the setup.cfg
if arg == "long_description":
in_cfg_value = has_get_option(config, section,
@@ -537,9 +540,9 @@ def run_command_hooks(cmd_obj, hook_kind):
try:
hook_obj = resolve_name(hook)
except ImportError:
- err = sys.exc_info()[1] # For py3k
+ err = sys.exc_info()[1] # For py3k
raise DistutilsModuleError('cannot find hook %s: %s' %
- (hook,err))
+ (hook, err))
else:
hook_obj = hook
@@ -549,7 +552,7 @@ def run_command_hooks(cmd_obj, hook_kind):
log.info('running %s %s for command %s',
hook_kind, hook, cmd_obj.get_command_name())
- try :
+ try:
hook_obj(cmd_obj)
except:
e = sys.exc_info()[1]