diff --git a/horizon/test/tests/utils.py b/horizon/test/tests/utils.py index bf7146a4b8..aceee4e76e 100644 --- a/horizon/test/tests/utils.py +++ b/horizon/test/tests/utils.py @@ -189,8 +189,8 @@ class SecretKeyTests(test.TestCase): self.assertEqual(key, secret_key.generate_or_read_from_file(key_file)) # Key file only be read/writable by user: - self.assertEqual(oct(os.stat(key_file).st_mode & 0777), "0600") - os.chmod(key_file, 0777) + self.assertEqual(oct(os.stat(key_file).st_mode & 0o777), "0600") + os.chmod(key_file, 0o777) self.assertRaises(secret_key.FilePermissionError, secret_key.generate_or_read_from_file, key_file) os.remove(key_file) diff --git a/horizon/utils/secret_key.py b/horizon/utils/secret_key.py index 6df5533f1c..a9c845568a 100644 --- a/horizon/utils/secret_key.py +++ b/horizon/utils/secret_key.py @@ -55,12 +55,12 @@ def generate_or_read_from_file(key_file='.secret_key', key_length=64): with lock: if not os.path.exists(key_file): key = generate_key(key_length) - old_umask = os.umask(0177) # Use '0600' file permissions + old_umask = os.umask(0o177) # Use '0600' file permissions with open(key_file, 'w') as f: f.write(key) os.umask(old_umask) else: - if oct(os.stat(key_file).st_mode & 0777) != '0600': + if oct(os.stat(key_file).st_mode & 0o777) != '0600': raise FilePermissionError("Insecure key file permissions!") with open(key_file, 'r') as f: key = f.readline() diff --git a/openstack_dashboard/dashboards/project/networks/workflows.py b/openstack_dashboard/dashboards/project/networks/workflows.py index 4ad0297907..c94a3a5305 100644 --- a/openstack_dashboard/dashboards/project/networks/workflows.py +++ b/openstack_dashboard/dashboards/project/networks/workflows.py @@ -172,7 +172,8 @@ class CreateSubnetDetailAction(workflows.Action): return netaddr.IPAddress(ip) except (netaddr.AddrFormatError, ValueError): msg = _('%(field_name)s: Invalid IP address ' - '(value=%(ip)s)') % locals() + '(value=%(ip)s)' % dict( + field_name=field_name, ip=ip)) raise forms.ValidationError(msg) def _convert_ip_network(self, network, field_name): @@ -180,7 +181,8 @@ class CreateSubnetDetailAction(workflows.Action): return netaddr.IPNetwork(network) except (netaddr.AddrFormatError, ValueError): msg = _('%(field_name)s: Invalid IP address ' - '(value=%(network)s)') % locals() + '(value=%(network)s)' % dict( + field_name=field_name, network=network)) raise forms.ValidationError(msg) def _check_allocation_pools(self, allocation_pools): diff --git a/openstack_dashboard/hooks.py b/openstack_dashboard/hooks.py new file mode 100644 index 0000000000..fc30a8becf --- /dev/null +++ b/openstack_dashboard/hooks.py @@ -0,0 +1,27 @@ +# vim: tabstop=4 shiftwidth=4 softtabstop=4 + +# Copyright 2013 Hewlett-Packard Development Company, L.P. +# All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +from distutils.command import install + + +def setup_hook(config): + """Filter config parsed from a setup.cfg to inject our defaults.""" + # Tell distutils not to put the data_files in platform-specific + # installation locations. See here for an explanation: + # https://groups.google.com/forum/#!topic/comp.lang.python/Nex7L-026uw + for scheme in install.INSTALL_SCHEMES.values(): + scheme['data'] = scheme['purelib'] diff --git a/requirements.txt b/requirements.txt index b5ef7e6786..c1946282d8 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,11 +1,10 @@ -d2to1>=0.2.10,<0.3 -pbr>=0.5.16,<0.6 +pbr>=0.5.21,<1.0 # Horizon Core Requirements -django>=1.4,<1.6 +Django>=1.4,<1.6 django_compressor>=1.3 -django_openstack_auth>=1.0.11,!=1.1.0 -eventlet>=0.12.0 -kombu>2.4.7 +django_openstack_auth>=1.1.1 +eventlet>=0.13.0 +kombu>=2.4.8 iso8601>=0.1.4 netaddr python-cinderclient>=1.0.4 diff --git a/setup.cfg b/setup.cfg index 4409c1f330..beaa3c7825 100644 --- a/setup.cfg +++ b/setup.cfg @@ -25,7 +25,7 @@ classifier = [global] setup-hooks = - pbr.hooks.setup_hook + openstack_dashboard.hooks.setup_hook [files] packages = diff --git a/setup.py b/setup.py index da49794000..2a0786a8b2 100755 --- a/setup.py +++ b/setup.py @@ -14,15 +14,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -from distutils.command import install +# THIS FILE IS MANAGED BY THE GLOBAL REQUIREMENTS REPO - DO NOT EDIT import setuptools -# Tell distutils not to put the data_files in platform-specific installation -# locations. See here for an explanation: -# https://groups.google.com/forum/#!topic/comp.lang.python/Nex7L-026uw -for scheme in install.INSTALL_SCHEMES.values(): - scheme['data'] = scheme['purelib'] - setuptools.setup( - setup_requires=['d2to1>=0.2.10,<0.3', 'pbr>=0.5,<0.6'], - d2to1=True) + setup_requires=['pbr>=0.5.21,<1.0'], + pbr=True) diff --git a/test-requirements.txt b/test-requirements.txt index 276886ebad..e634373b3c 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,8 +1,5 @@ -# Install bounded pep8/pyflakes first, then let flake8 install -pep8==1.4.5 -pyflakes==0.7.2 -flake8==2.0 -hacking>=0.5.3,<0.6 +hacking>=0.5.6,<0.7 + # Testing Requirements coverage>=3.6 django-nose diff --git a/tox.ini b/tox.ini index e413e8d418..5025a96d47 100644 --- a/tox.ini +++ b/tox.ini @@ -38,9 +38,10 @@ exclude = .venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build,p # E128 continuation line under-indented for visual indent # F403 'from import *' used; unable to detect undefined names # F999 syntax error in doctest +# H102 Apache 2.0 license header not found # H201 no 'except:' at least use 'except Exception:' # H302 import only modules.'from optparse import make_option' does not import a module # H4xx docstrings # H701 empty localization string # H702 Formatting operation should be outside of localization method call -ignore = E121,E126,E127,E128,F403,F999,H201,H302,H4,H701,H702 +ignore = E121,E126,E127,E128,F403,F999,H102,H201,H302,H4,H701,H702