Skip to content

Commit fd09b13

Browse files
Drop dependency on python-six
There's no reason to try keeping compatibility with Python 2. Signed-off-by: Sandro Bonazzola <[email protected]>
1 parent 88ec659 commit fd09b13

File tree

11 files changed

+8
-24
lines changed

11 files changed

+8
-24
lines changed

.github/workflows/build.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ jobs:
5757
python3-pycurl \
5858
python3-pygments \
5959
python3-pyflakes \
60-
python3-six \
6160
python3-wheel \
6261
rpm-build \
6362
tar \

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
PKG-INFO
33
setup.py
44
version.py
5+
lib/ovirtsdk4/__pycache__/

examples/asynchronous_inventory.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717
# limitations under the License.
1818
#
1919

20+
from itertools import zip_longest
2021
import logging
2122
import ovirtsdk4 as sdk
2223

23-
from six.moves import zip_longest
2424

2525
# This example shows how to use the asynchronous and pipelining capabilities
2626
# of the SDK to download from the server large amounts of data in an efficient
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
pycurl>=7.19.0
2-
six

lib/ovirtsdk4/__init__.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import os
2222
import pycurl
2323
import re
24-
import six
2524
import sys
2625
import threading
2726

@@ -764,7 +763,7 @@ def test(self, raise_exception=False):
764763
return True
765764
except Error:
766765
if raise_exception:
767-
six.reraise(*sys.exc_info())
766+
raise
768767
return False
769768
except Exception as exception:
770769
if raise_exception:
@@ -951,7 +950,7 @@ def __parse_error(self, error):
951950
elif e_code == pycurl.E_OPERATION_TIMEOUTED:
952951
clazz = TimeoutError
953952

954-
six.reraise(clazz, clazz(error_msg), sys.exc_info()[2])
953+
raise clazz(error_msg).with_traceback(sys.exc_info()[2])
955954

956955
def _get_header_value(self, headers, name):
957956
"""

lib/ovirtsdk4/reader.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import time
2121
import io
2222
import re
23-
import six
2423

2524
from ovirtsdk4 import Error
2625
from ovirtsdk4 import xml
@@ -304,8 +303,7 @@ def read(cls, source):
304303
# In Python 3 str is a list of 16 bits characters, so it
305304
# needs to be converted to an array of bytes, using UTF-8,
306305
# before trying to parse it.
307-
if six.PY3:
308-
source = source.encode('utf-8')
306+
source = source.encode('utf-8')
309307
cursor = xml.XmlReader(io.BytesIO(source))
310308
elif isinstance(source, bytes):
311309
cursor = xml.XmlReader(io.BytesIO(source))

lib/ovirtsdk4/service.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616
# limitations under the License.
1717
#
1818

19-
import six
20-
2119
from ovirtsdk4 import AuthError
2220
from ovirtsdk4 import Error
2321
from ovirtsdk4 import NotFoundError
@@ -103,7 +101,7 @@ def _raise_error(response, detail=None):
103101
msg += ' '
104102
msg = msg + 'HTTP response message is "%s".' % response.message
105103

106-
if isinstance(detail, six.string_types):
104+
if isinstance(detail, str):
107105
if msg:
108106
msg += ' '
109107
msg = msg + detail + '.'

python-ovirt-engine-sdk4.spec.in

-3
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ BuildRequires: python3-devel
2121
Requires: libxml2
2222
Requires: python3
2323
Requires: python3-pycurl >= 7.43.0-6
24-
Requires: python3-six
2524

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

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

5249
%description -n python3.12-ovirt-engine-sdk4
5350
This package contains the Python 3.12 SDK for version 4 of the oVirt Engine

setup.py.in

-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ import sys
2727
# Required packages:
2828
requires = [
2929
'pycurl >= 7.19.0',
30-
'six',
3130
]
3231

3332
# Python before version 3.4 doesn't support enum types, which we need,

tests/test_vm_reader.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616
# limitations under the License.
1717
#
1818

19-
import six
20-
2119
import ovirtsdk4.types as types
2220

2321
from io import BytesIO
@@ -33,8 +31,7 @@ def make_buffer(text):
3331
"""
3432
Creates an IO object to be used for writing.
3533
"""
36-
if six.PY3:
37-
text = text.encode('utf-8')
34+
text = text.encode('utf-8')
3835
return BytesIO(text)
3936

4037

tests/test_xml_reader.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616
# limitations under the License.
1717
#
1818

19-
import six
20-
2119
from io import BytesIO
2220
from nose.tools import *
2321
from ovirtsdk4.xml import XmlReader
@@ -27,8 +25,7 @@ def make_reader(text):
2725
"""
2826
Creates an IO objec that reads from the given text.
2927
"""
30-
if six.PY3:
31-
text = text.encode('utf-8')
28+
text = text.encode('utf-8')
3229
return XmlReader(BytesIO(text))
3330

3431

0 commit comments

Comments
 (0)