Skip to content

Drop dependency on python-six #114

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ jobs:
python3-pycurl \
python3-pygments \
python3-pyflakes \
python3-six \
python3-wheel \
rpm-build \
tar \
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
PKG-INFO
setup.py
version.py
lib/ovirtsdk4/__pycache__/
2 changes: 1 addition & 1 deletion examples/asynchronous_inventory.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
# limitations under the License.
#

from itertools import zip_longest
import logging
import ovirtsdk4 as sdk

from six.moves import zip_longest

# This example shows how to use the asynchronous and pipelining capabilities
# of the SDK to download from the server large amounts of data in an efficient
Expand Down
1 change: 0 additions & 1 deletion lib/ovirt_engine_sdk_python.egg-info/requires.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
pycurl>=7.19.0
six
5 changes: 2 additions & 3 deletions lib/ovirtsdk4/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import os
import pycurl
import re
import six
import sys
import threading

Expand Down Expand Up @@ -764,7 +763,7 @@ def test(self, raise_exception=False):
return True
except Error:
if raise_exception:
six.reraise(*sys.exc_info())
raise
return False
except Exception as exception:
if raise_exception:
Expand Down Expand Up @@ -951,7 +950,7 @@ def __parse_error(self, error):
elif e_code == pycurl.E_OPERATION_TIMEOUTED:
clazz = TimeoutError

six.reraise(clazz, clazz(error_msg), sys.exc_info()[2])
raise clazz(error_msg).with_traceback(sys.exc_info()[2])

def _get_header_value(self, headers, name):
"""
Expand Down
4 changes: 1 addition & 3 deletions lib/ovirtsdk4/reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import time
import io
import re
import six

from ovirtsdk4 import Error
from ovirtsdk4 import xml
Expand Down Expand Up @@ -304,8 +303,7 @@ def read(cls, source):
# In Python 3 str is a list of 16 bits characters, so it
# needs to be converted to an array of bytes, using UTF-8,
# before trying to parse it.
if six.PY3:
source = source.encode('utf-8')
source = source.encode('utf-8')
cursor = xml.XmlReader(io.BytesIO(source))
elif isinstance(source, bytes):
cursor = xml.XmlReader(io.BytesIO(source))
Expand Down
4 changes: 1 addition & 3 deletions lib/ovirtsdk4/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
# limitations under the License.
#

import six

from ovirtsdk4 import AuthError
from ovirtsdk4 import Error
from ovirtsdk4 import NotFoundError
Expand Down Expand Up @@ -103,7 +101,7 @@ def _raise_error(response, detail=None):
msg += ' '
msg = msg + 'HTTP response message is "%s".' % response.message

if isinstance(detail, six.string_types):
if isinstance(detail, str):
if msg:
msg += ' '
msg = msg + detail + '.'
Expand Down
3 changes: 0 additions & 3 deletions python-ovirt-engine-sdk4.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ BuildRequires: python3-devel
Requires: libxml2
Requires: python3
Requires: python3-pycurl >= 7.43.0-6
Requires: python3-six

%description -n python3-ovirt-engine-sdk4
This package contains the Python 3 SDK for version 4 of the oVirt Engine
Expand All @@ -34,7 +33,6 @@ BuildRequires: python3.11-setuptools
Requires: libxml2
Requires: python3.11
Requires: python3.11-pycurl >= 7.43.0-6
Requires: python3.11-six

%description -n python3.11-ovirt-engine-sdk4
This package contains the Python 3.11 SDK for version 4 of the oVirt Engine
Expand All @@ -47,7 +45,6 @@ BuildRequires: python3.12-setuptools
Requires: libxml2
Requires: python3.12
Requires: python3.12-pycurl >= 7.43.0-6
Requires: python3.12-six

%description -n python3.12-ovirt-engine-sdk4
This package contains the Python 3.12 SDK for version 4 of the oVirt Engine
Expand Down
1 change: 0 additions & 1 deletion setup.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import sys
# Required packages:
requires = [
'pycurl >= 7.19.0',
'six',
]

# Python before version 3.4 doesn't support enum types, which we need,
Expand Down
5 changes: 1 addition & 4 deletions tests/test_vm_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
# limitations under the License.
#

import six

import ovirtsdk4.types as types

from io import BytesIO
Expand All @@ -33,8 +31,7 @@ def make_buffer(text):
"""
Creates an IO object to be used for writing.
"""
if six.PY3:
text = text.encode('utf-8')
text = text.encode('utf-8')
return BytesIO(text)


Expand Down
5 changes: 1 addition & 4 deletions tests/test_xml_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
# limitations under the License.
#

import six

from io import BytesIO
from nose.tools import *
from ovirtsdk4.xml import XmlReader
Expand All @@ -27,8 +25,7 @@ def make_reader(text):
"""
Creates an IO objec that reads from the given text.
"""
if six.PY3:
text = text.encode('utf-8')
text = text.encode('utf-8')
return XmlReader(BytesIO(text))


Expand Down