Skip to content

Commit

Permalink
Merge pull request #412 from mshriver/move-to-py3
Browse files Browse the repository at this point in the history
Move to py3.7
  • Loading branch information
mshriver authored Sep 13, 2019
2 parents 53ab020 + f150d2f commit af4454f
Show file tree
Hide file tree
Showing 39 changed files with 96 additions and 148 deletions.
3 changes: 0 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ matrix:
- libssl-dev
- python3-dbg
- git
- name: "python 2.7"
python: "2.7"
dist: trusty # trusty required for 2.7
install:
- pip install -U pip setuptools
- pip install -Ur requirements-test.txt --upgrade-strategy eager
Expand Down
2 changes: 1 addition & 1 deletion requirements-test.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# they packaged the py2 package as universal wheel big nono
--no-binary azure-cosmosdb-table

-r ./requirements.txt
-e .

mock # bad imports in hawcular
pytest
Expand Down
47 changes: 0 additions & 47 deletions requirements.txt

This file was deleted.

46 changes: 44 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ classifier =
Environment :: Console
Intended Audience :: Developers
Operating System :: OS Independent
Programming Language :: Python :: 2
Programming Language :: Python :: 2.7
Programming Language :: Python :: 3
Programming Language :: Python :: 3.7
Topic :: Utilities
keywords =
setup
Expand All @@ -23,3 +23,45 @@ packages =
[flake8]
ignore = E128,E811,W503
max-line-length = 100

[options]
install_requires =
azure>=3.0.0
azure-storage-common>=1.0
boto3==1.6.6
botocore==1.9.6
boto
cached_property
dateparser
fauxfactory
google-api-python-client
google-compute-engine
inflection
miq-version
oauth2client
ovirt-engine-sdk-python~=4.3
openshift==0.3.4
packaging
pyvmomi>=6.5.0.2017.5.post1
python-cinderclient
python-swiftclient
python-glanceclient
python-ironicclient
python-keystoneclient
python-neutronclient==6.12.0
python-novaclient==7.1.2
python-heatclient
pyvcloud==19.1.2
py3winrm==0.0.1
redfish-client==0.1.0
requests
suds-jurko
tzlocal
vspk==5.3.2
wait_for
websocket_client
# lxml super SGML parser, needs libxml2-devel and libxslt-devel
lxml
setup_requires =
setuptools_scm
pbr
3 changes: 1 addition & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from __future__ import absolute_import

from setuptools import setup

setup(
setup_requires=['pbr'],
pbr=True,
)
4 changes: 1 addition & 3 deletions tests/test_hawkular.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
# -*- coding: utf-8 -*-
"""Unit tests for Hawkular client."""
from __future__ import absolute_import

import json
import os
from random import sample
from urllib.parse import urlparse

import pytest
from mock import patch

from six.moves.urllib.parse import urlparse
from wrapanapi.systems import HawkularSystem
from wrapanapi.systems.hawkular import (CanonicalPath, Resource, ResourceData,
ResourceType)
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = py27-openssl,py36-openssl
envlist = py37-openssl

[testenv]
setenv=
Expand Down
1 change: 0 additions & 1 deletion wrapanapi/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# Imports for convenience
from __future__ import absolute_import

from .systems.ec2 import EC2System
from .systems.google import GoogleCloudSystem
Expand Down
1 change: 0 additions & 1 deletion wrapanapi/clients/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from __future__ import absolute_import
from .rest_client import ContainerClient
from .websocket_client import WebsocketClient, HawkularWebsocketClient

Expand Down
4 changes: 1 addition & 3 deletions wrapanapi/clients/rest_client.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
from __future__ import absolute_import
import requests
import os
import json
import six
import logging

from wrapanapi.exceptions import RestClientException
Expand Down Expand Up @@ -38,7 +36,7 @@ def __init__(self, hostname, auth, protocol="https", port=6443, entry='api/v1',
self.verify = verify
if type(auth) in (list, set, tuple):
self.auth = auth
elif isinstance(auth, six.string_types):
elif isinstance(auth, str):
self.auth = BearerTokenAuth(auth)
else:
raise RestClientException('Invalid auth object')
Expand Down
1 change: 0 additions & 1 deletion wrapanapi/clients/websocket_client.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from __future__ import absolute_import
import base64
import json
import websocket
Expand Down
1 change: 0 additions & 1 deletion wrapanapi/entities/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""
wrapanapi.entities
"""
from __future__ import absolute_import

from .template import Template, TemplateMixin
from .vm import Vm, VmState, VmMixin
Expand Down
9 changes: 3 additions & 6 deletions wrapanapi/entities/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,14 @@
Provides method/class definitions for handling any entity on a provider
"""
from __future__ import absolute_import

from abc import ABCMeta, abstractmethod, abstractproperty
import six
from six.moves import reprlib
from reprlib import aRepr

from wrapanapi.utils import LoggerMixin
from wrapanapi.exceptions import NotFoundError


class Entity(six.with_metaclass(ABCMeta, LoggerMixin)):
class Entity(LoggerMixin, metaclass=ABCMeta):
"""
Base class to represent any object on a provider system as well
as methods for manipulating that entity (deleting, renaming, etc.)
Expand Down Expand Up @@ -118,7 +115,7 @@ def __repr__(self):
)

# Show kwarg key/value for each unique kwarg
a_repr = reprlib.aRepr
a_repr = aRepr
a_repr.maxstring = 100
a_repr.maxother = 100
for key, val in self._identifying_attrs.items():
Expand Down
4 changes: 1 addition & 3 deletions wrapanapi/entities/instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,13 @@
Instances which run on cloud providers
"""
from __future__ import absolute_import
import six

from abc import ABCMeta, abstractproperty

from .vm import Vm


class Instance(six.with_metaclass(ABCMeta, Vm)):
class Instance(Vm, metaclass=ABCMeta):
"""
Adds a few additional properties/methods pertaining to VMs hosted
on a cloud platform.
Expand Down
6 changes: 2 additions & 4 deletions wrapanapi/entities/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,14 @@
Networks
"""
from __future__ import absolute_import
import six

from abc import ABCMeta, abstractmethod

from wrapanapi.entities.base import Entity, EntityMixin
from wrapanapi.exceptions import MultipleItemsError, NotFoundError


class Network(six.with_metaclass(ABCMeta, Entity)):
class Network(Entity, metaclass=ABCMeta):
"""
Defines methods/properties pertaining to networks
"""
Expand All @@ -30,7 +28,7 @@ def get_details(self):
"""


class NetworkMixin(six.with_metaclass(ABCMeta, EntityMixin)):
class NetworkMixin(EntityMixin, metaclass=ABCMeta):
"""
Defines methods for systems that support networks
"""
Expand Down
3 changes: 1 addition & 2 deletions wrapanapi/entities/physical_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@
as physical servers.
"""
from abc import ABCMeta
import six

from wrapanapi.entities.base import Entity


class PhysicalContainer(six.with_metaclass(ABCMeta, Entity)):
class PhysicalContainer(Entity, metaclass=ABCMeta):
"""Represents a single physical container."""

def delete(self):
Expand Down
8 changes: 4 additions & 4 deletions wrapanapi/entities/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Implements classes and methods related to actions performed on (physical) servers
"""
import six

from abc import ABCMeta, abstractmethod

from wrapanapi.entities.base import Entity
Expand All @@ -24,12 +24,12 @@ class ServerState(object):
@classmethod
def valid_states(cls):
return [
var_val for _, var_val in vars(cls).items()
if isinstance(var_val, six.string_types) and var_val.startswith('ServerState.')
var_val for var_val in vars(cls).values()
if isinstance(var_val, str) and var_val.startswith('ServerState.')
]


class Server(six.with_metaclass(ABCMeta, Entity)):
class Server(Entity, metaclass=ABCMeta):
"""
Represents a single server on a management system.
"""
Expand Down
6 changes: 2 additions & 4 deletions wrapanapi/entities/stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,14 @@
Orchestration stacks
"""
from __future__ import absolute_import
import six

from abc import ABCMeta, abstractmethod

from wrapanapi.entities.base import Entity, EntityMixin
from wrapanapi.exceptions import MultipleItemsError, NotFoundError


class Stack(six.with_metaclass(ABCMeta, Entity)):
class Stack(Entity, metaclass=ABCMeta):
"""
Defines methods/properties pertaining to stacks
"""
Expand All @@ -30,7 +28,7 @@ def get_details(self):
"""


class StackMixin(six.with_metaclass(ABCMeta, EntityMixin)):
class StackMixin(EntityMixin, metaclass=ABCMeta):
"""
Defines methods for systems that support stacks
"""
Expand Down
5 changes: 2 additions & 3 deletions wrapanapi/entities/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@
Methods/classes pertaining to performing actions on a template
"""
import six

from abc import ABCMeta, abstractmethod

from wrapanapi.entities.base import Entity, EntityMixin
from wrapanapi.exceptions import MultipleItemsError, NotFoundError


class Template(six.with_metaclass(ABCMeta, Entity)):
class Template(Entity, metaclass=ABCMeta):
"""
Represents a template on a system
"""
Expand All @@ -24,7 +23,7 @@ def deploy(self, vm_name, timeout, **kwargs):
"""


class TemplateMixin(six.with_metaclass(ABCMeta, EntityMixin)):
class TemplateMixin(EntityMixin, metaclass=ABCMeta):
"""
Defines methods a wrapanapi.systems.System that manages Templates should have
"""
Expand Down
Loading

0 comments on commit af4454f

Please sign in to comment.