Change charm to py3

The tests are still py2; they'll need an update to zaza at some point.

Change-Id: I2c4b1ba0212f96cf4a725c80d87b8b2bfed2186f
This commit is contained in:
Alex Kavanagh 2018-09-26 17:14:56 +01:00
parent c31f3e289b
commit 79a1ea26d6
167 changed files with 129 additions and 92 deletions

View File

@ -1,5 +1,5 @@
#!/usr/bin/make
PYTHON := /usr/bin/env python
PYTHON := /usr/bin/env python3
CHARM_DIR := $(PWD)
HOOKS_DIR := $(PWD)/hooks
TEST_PREFIX := PYTHONPATH=$(HOOKS_DIR)
@ -21,7 +21,7 @@ sync: bin/charm_helpers_sync.py
test:
@echo Starting unit tests...
@tox -e py27
@tox -e py36
functional_test:
@echo Starting amulet tests...

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python3
#
# Copyright 2016 Canonical Ltd
#
@ -15,15 +15,22 @@
# limitations under the License.
import os
import sys
import re
from subprocess import check_output, CalledProcessError
import sys
from subprocess import (
check_output,
CalledProcessError,
)
sys.path.append('hooks/')
_path = os.path.dirname(os.path.realpath(__file__))
_root = os.path.abspath(os.path.join(_path, '..'))
_hooks = os.path.abspath(os.path.join(_path, '../hooks'))
def _add_path(path):
if path not in sys.path:
sys.path.insert(1, path)
_add_path(_root)
_add_path(_hooks)
from charmhelpers.core.hookenv import (
action_fail,
@ -33,7 +40,7 @@ from charmhelpers.core.hookenv import (
leader_set,
)
from rabbit_utils import (
from hooks.rabbit_utils import (
ConfigRenderer,
CONFIG_FILES,
pause_unit_helper,
@ -80,7 +87,7 @@ def check_queues(args):
queue_pattern = re.compile('.*\t[0-9]*')
try:
queues = check_output(['rabbitmqctl', 'list_queues',
'-p', vhost]).split('\n')
'-p', vhost]).decode('utf-8').split('\n')
result = list({queue: size for (queue, size) in
[i.split('\t') for i in queues
if re.search(queue_pattern, i)]

View File

@ -1,4 +1,4 @@
destination: hooks/charmhelpers
destination: charmhelpers
repo: https://github.com/juju/charm-helpers
include:
- fetch

Some files were not shown because too many files have changed in this diff Show More