Skip to content

Commit

Permalink
Update python-conu to version 1.0.0 / rev 3 via SR 1073107
Browse files Browse the repository at this point in the history
https://build.opensuse.org/request/show/1073107
by user mcepl + dimstar_suse
- do not require six
- added patches
  fix user-cont/conu#390
  + python-conu-no-six.patch
  • Loading branch information
mcepl authored and bmwiedemann committed Mar 21, 2023
1 parent 753e8a3 commit 7c1a454
Show file tree
Hide file tree
Showing 5 changed files with 318 additions and 6 deletions.
Binary file modified packages/p/python-conu/.files
Binary file not shown.
11 changes: 11 additions & 0 deletions packages/p/python-conu/.rev
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,15 @@
* Docker backend supports Skopeo for copying</comment>
<requestid>870735</requestid>
</revision>
<revision rev="3" vrev="2">
<srcmd5>7ac56b570f917d466b53b97d0d417483</srcmd5>
<version>1.0.0</version>
<time>1679416884</time>
<user>dimstar_suse</user>
<comment>- do not require six
- added patches
fix https://github.com/user-cont/conu/issues/390
+ python-conu-no-six.patch</comment>
<requestid>1073107</requestid>
</revision>
</revisionlist>
293 changes: 293 additions & 0 deletions packages/p/python-conu/python-conu-no-six.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,293 @@
Index: conu-1.0.0/conu.egg-info/requires.txt
===================================================================
--- conu-1.0.0.orig/conu.egg-info/requires.txt
+++ conu-1.0.0/conu.egg-info/requires.txt
@@ -1,5 +1,4 @@
requests
-six
docker
kubernetes==8.0.0
pytest
Index: conu-1.0.0/conu/apidefs/container.py
===================================================================
--- conu-1.0.0.orig/conu/apidefs/container.py
+++ conu-1.0.0/conu/apidefs/container.py
@@ -13,7 +13,7 @@ from conu.apidefs.image import Image
from conu.utils.http_client import HttpClient, get_url

import requests
-from six.moves.urllib.parse import urlunsplit
+from urllib.parse import urlunsplit
from contextlib import contextmanager


Index: conu-1.0.0/conu/backend/buildah/image.py
===================================================================
--- conu-1.0.0.orig/conu/backend/buildah/image.py
+++ conu-1.0.0/conu/backend/buildah/image.py
@@ -15,8 +15,6 @@ import logging
import os
import subprocess

-import six
-
from conu.apidefs.backend import get_backend_tmpdir
from conu.apidefs.image import Image
from conu.apidefs.metadata import ImageMetadata
@@ -75,7 +73,7 @@ class BuildahImage(Image):
:param pull_policy: enum, strategy to apply for pulling the image
"""
super(BuildahImage, self).__init__(repository, tag=tag)
- if not isinstance(tag, (six.string_types, None.__class__)):
+ if not isinstance(tag, (str, None.__class__)):
raise ConuException("'tag' is not a string type")
if not isinstance(pull_policy, BuildahImagePullPolicy):
raise ConuException("'pull_policy' is not an instance of BuildahImagePullPolicy")
Index: conu-1.0.0/conu/backend/docker/image.py
===================================================================
--- conu-1.0.0.orig/conu/backend/docker/image.py
+++ conu-1.0.0/conu/backend/docker/image.py
@@ -16,8 +16,6 @@ import subprocess
import enum
from tempfile import mkdtemp

-import six
-
from kubernetes.client.rest import ApiException

from conu.apidefs.metadata import ImageMetadata
@@ -110,7 +108,7 @@ class DockerImage(Image):
:param pull_policy: enum, strategy to apply for pulling the image
"""
super(DockerImage, self).__init__(repository, tag=tag)
- if not isinstance(tag, (six.string_types, None.__class__)):
+ if not isinstance(tag, (str, None.__class__)):
raise ConuException("'tag' is not a string type")
if not isinstance(pull_policy, DockerImagePullPolicy):
raise ConuException("'pull_policy' is not an instance of DockerImagePullPolicy")
Index: conu-1.0.0/conu/backend/podman/image.py
===================================================================
--- conu-1.0.0.orig/conu/backend/podman/image.py
+++ conu-1.0.0/conu/backend/podman/image.py
@@ -15,8 +15,6 @@ import logging
import os
import subprocess

-import six
-
from conu.apidefs.backend import get_backend_tmpdir
from conu.apidefs.image import Image
from conu.apidefs.metadata import ImageMetadata
@@ -61,7 +59,7 @@ class PodmanImage(Image):
:param pull_policy: enum, strategy to apply for pulling the image
"""
super(PodmanImage, self).__init__(repository, tag=tag)
- if not isinstance(tag, (six.string_types, None.__class__)):
+ if not isinstance(tag, (str, None.__class__)):
raise ConuException("'tag' is not a string type")
if not isinstance(pull_policy, PodmanImagePullPolicy):
raise ConuException("'pull_policy' is not an instance of PodmanImagePullPolicy")
Index: conu-1.0.0/conu/utils/filesystem.py
===================================================================
--- conu-1.0.0.orig/conu/utils/filesystem.py
+++ conu-1.0.0/conu/utils/filesystem.py
@@ -14,9 +14,6 @@ import pwd
from conu.exceptions import ConuException
from conu.utils import run_cmd, is_selinux_disabled, setfacl_command_exists, chcon_command_exists

-import six
-
-
logger = logging.getLogger(__name__)


@@ -85,14 +82,14 @@ class Directory(object):
self.facl_rules = facl_rules

# os.chown wants int
- if isinstance(user_owner, six.string_types):
+ if isinstance(user_owner, str):
try:
self.owner = pwd.getpwnam(user_owner)[2]
except KeyError as ex:
raise ConuException("User %r not found, error message: %r" % (user_owner, ex))
else:
self.owner = user_owner
- if isinstance(group_owner, six.string_types):
+ if isinstance(group_owner, str):
try:
self.group = pwd.getpwnam(group_owner)[3]
except KeyError as ex:
@@ -246,7 +243,7 @@ class Volume(object):
:param volume: tuple in one one of the following forms: target | source,target | source,target,mode
:return: instance of Volume
"""
- if isinstance(volume, six.string_types):
+ if isinstance(volume, str):
return Volume(target=volume)
elif len(volume) == 2:
return Volume(source=volume[0],
Index: conu-1.0.0/conu/utils/http_client.py
===================================================================
--- conu-1.0.0.orig/conu/utils/http_client.py
+++ conu-1.0.0/conu/utils/http_client.py
@@ -4,7 +4,7 @@
# SPDX-License-Identifier: MIT
#
from requests import Session
-from six.moves.urllib.parse import urlunsplit
+from urllib.parse import urlunsplit


def get_url(path, host, port, method="http"):
Index: conu-1.0.0/requirements.txt
===================================================================
--- conu-1.0.0.orig/requirements.txt
+++ conu-1.0.0/requirements.txt
@@ -1,5 +1,4 @@
requests
-six
docker
kubernetes==8.0.0
pytest
Index: conu-1.0.0/tests/integration/test_buildah.py
===================================================================
--- conu-1.0.0.orig/tests/integration/test_buildah.py
+++ conu-1.0.0/tests/integration/test_buildah.py
@@ -3,7 +3,6 @@ from __future__ import print_function, u
import subprocess

import pytest
-from six import string_types

from conu import ConuException, random_str
from conu.fixtures import buildah_backend
@@ -31,7 +30,7 @@ def test_buildah_image(buildah_backend):
assert "registry.fedoraproject.org/fedora-minimal:33" == str(image)
assert "BuildahImage(repository=%s, tag=%s)" % (FEDORA_MINIMAL_REPOSITORY,
FEDORA_MINIMAL_REPOSITORY_TAG) == repr(image)
- assert isinstance(image.get_id(), string_types)
+ assert isinstance(image.get_id(), str)
new_image = image.tag_image(tag="test")
assert new_image.is_present()
new_image.rmi(via_name=True)
@@ -55,7 +54,7 @@ def test_buildah_container(buildah_backe
assert "Config" in c.inspect()
assert c.get_id() == str(c)
assert repr(c)
- assert isinstance(c.get_id(), string_types)
+ assert isinstance(c.get_id(), str)
finally:
c.delete(force=True)

Index: conu-1.0.0/tests/integration/test_docker.py
===================================================================
--- conu-1.0.0.orig/tests/integration/test_docker.py
+++ conu-1.0.0/tests/integration/test_docker.py
@@ -30,7 +30,6 @@ from conu import \
Directory

from conu.backend.docker.skopeo import SkopeoTransport
-from six import string_types


@pytest.mark.parametrize("reference,result", [
@@ -129,7 +128,7 @@ def test_image():
assert "registry.fedoraproject.org/fedora-minimal:33" == str(image)
assert "DockerImage(repository=%s, tag=%s)" % (FEDORA_MINIMAL_REPOSITORY,
FEDORA_MINIMAL_REPOSITORY_TAG) == repr(image)
- assert isinstance(image.get_id(), string_types)
+ assert isinstance(image.get_id(), str)
new_image = image.tag_image(tag="test")
new_image.rmi(via_name=True)

@@ -155,7 +154,7 @@ def test_container():
assert "Config" in c.inspect()
assert c.get_id() == str(c)
assert repr(c)
- assert isinstance(c.get_id(), string_types)
+ assert isinstance(c.get_id(), str)
finally:
c.delete(force=True)

@@ -618,6 +617,6 @@ def test_run_via_api():
assert "Config" in c.inspect()
assert c.get_id() == str(c)
assert repr(c)
- assert isinstance(c.get_id(), string_types)
+ assert isinstance(c.get_id(), str)
finally:
c.delete(force=True)
Index: conu-1.0.0/tests/integration/test_filesystem.py
===================================================================
--- conu-1.0.0.orig/tests/integration/test_filesystem.py
+++ conu-1.0.0/tests/integration/test_filesystem.py
@@ -6,7 +6,6 @@
import os

import pytest
-import six

from conu.backend.docker.backend import DockerBackend
from conu.backend.docker.container import ConuException
@@ -53,12 +52,8 @@ def test_container_copy_from(docker_cont
assert fd.read() == FEDORA_RELEASE

tmpdir.mkdir("etc")
- if six.PY2:
- with pytest.raises(OSError):
- fs.copy_from("/etc", str(tmpdir))
- else:
- with pytest.raises(FileExistsError):
- fs.copy_from("/etc", str(tmpdir))
+ with pytest.raises(FileExistsError):
+ fs.copy_from("/etc", str(tmpdir))


def test_container_get_file(docker_container):
@@ -119,12 +114,8 @@ def test_image_copy_from(docker_image, t
assert fd.read() == FEDORA_RELEASE

tmpdir.mkdir("etc")
- if six.PY2:
- with pytest.raises(OSError):
- fs.copy_from("/etc", str(tmpdir))
- else:
- with pytest.raises(FileExistsError):
- fs.copy_from("/etc", str(tmpdir))
+ with pytest.raises(FileExistsError):
+ fs.copy_from("/etc", str(tmpdir))


def test_image_get_file(docker_image):
Index: conu-1.0.0/tests/integration/test_podman.py
===================================================================
--- conu-1.0.0.orig/tests/integration/test_podman.py
+++ conu-1.0.0/tests/integration/test_podman.py
@@ -15,8 +15,6 @@ from conu.apidefs.metadata import Contai
from conu.exceptions import ConuException
from conu import Directory

-from six import string_types
-
import pytest


@@ -55,7 +53,7 @@ def test_podman_image(podman_backend):
assert "registry.fedoraproject.org/fedora-minimal:33" == str(image)
assert "PodmanImage(repository=%s, tag=%s)" % (FEDORA_MINIMAL_REPOSITORY,
FEDORA_MINIMAL_REPOSITORY_TAG) == repr(image)
- assert isinstance(image.get_id(), string_types)
+ assert isinstance(image.get_id(), str)
new_image = image.tag_image(tag="test")
assert new_image.is_present()
new_image.rmi(via_name=True)
@@ -82,7 +80,7 @@ def test_container(podman_backend, podma
assert "Config" in c.inspect()
assert c.get_id() == str(c)
assert repr(c)
- assert isinstance(c.get_id(), string_types)
+ assert isinstance(c.get_id(), str)
finally:
c.delete(force=True)

8 changes: 8 additions & 0 deletions packages/p/python-conu/python-conu.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
-------------------------------------------------------------------
Mon Mar 20 10:16:36 UTC 2023 - pgajdos@suse.com

- do not require six
- added patches
fix https://github.com/user-cont/conu/issues/390
+ python-conu-no-six.patch

-------------------------------------------------------------------
Wed Feb 10 04:31:04 UTC 2021 - Steve Kowalik <steven.kowalik@suse.com>

Expand Down
12 changes: 6 additions & 6 deletions packages/p/python-conu/python-conu.spec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#
# spec file for package python-conu
#
# Copyright (c) 2021 SUSE LLC
# Copyright (c) 2023 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
Expand All @@ -16,7 +16,6 @@
#


%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%define skip_python2 1
Name: python-conu
Version: 1.0.0
Expand All @@ -25,6 +24,8 @@ Summary: Python container testing library
License: MIT
URL: https://github.com/user-cont/conu
Source: https://files.pythonhosted.org/packages/source/c/conu/conu-%{version}.tar.gz
# https://github.com/user-cont/conu/issues/390
Patch0: python-conu-no-six.patch
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
Expand All @@ -33,7 +34,6 @@ Requires: python-flexmock
Requires: python-kubernetes >= 8
Requires: python-pytest
Requires: python-requests
Requires: python-six
Recommends: docker
Recommends: podman
BuildArch: noarch
Expand All @@ -43,7 +43,6 @@ BuildRequires: %{python_module flexmock}
BuildRequires: %{python_module kubernetes >= 8}
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module requests}
BuildRequires: %{python_module six}
BuildRequires: acl
BuildRequires: docker
BuildRequires: podman
Expand All @@ -55,7 +54,7 @@ BuildRequires: user(nobody)
Python container testing library.

%prep
%setup -q -n conu-%{version}
%autosetup -p1 -n conu-%{version}
rm tests/integration/test_k8s.py tests/integration/test_openshift.py tests/release/test_release.py

%build
Expand All @@ -71,6 +70,7 @@ rm tests/integration/test_k8s.py tests/integration/test_openshift.py tests/relea
%files %{python_files}
%doc README.md
%license LICENSE
%{python_sitelib}/*
%{python_sitelib}/conu
%{python_sitelib}/conu-%{version}*-info

%changelog

0 comments on commit 7c1a454

Please sign in to comment.