Hello community,

here is the log from the commit of package python-osc-tiny for openSUSE:Factory 
checked in at 2020-06-29 21:17:14
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-osc-tiny (Old)
 and      /work/SRC/openSUSE:Factory/.python-osc-tiny.new.3060 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-osc-tiny"

Mon Jun 29 21:17:14 2020 rev:6 rq:817628 version:0.2.3

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-osc-tiny/python-osc-tiny.changes  
2020-06-10 00:45:48.246542560 +0200
+++ 
/work/SRC/openSUSE:Factory/.python-osc-tiny.new.3060/python-osc-tiny.changes    
    2020-06-29 21:18:02.909725175 +0200
@@ -1,0 +2,6 @@
+Mon Jun 29 06:38:31 UTC 2020 - Andreas Hasenkopf <[email protected]>
+
+- version update to 0.2.3
+  * Added the `distributions` extension
+
+-------------------------------------------------------------------

Old:
----
  osc-tiny-0.2.2.tar.gz

New:
----
  osc-tiny-0.2.3.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-osc-tiny.spec ++++++
--- /var/tmp/diff_new_pack.Fz5XFZ/_old  2020-06-29 21:18:03.653727477 +0200
+++ /var/tmp/diff_new_pack.Fz5XFZ/_new  2020-06-29 21:18:03.657727490 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package python-osc-tiny
 #
-# Copyright (c) 2020 SUSE LLC
+# Copyright (c) 2020 SUSE LINUX GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -19,7 +19,7 @@
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
 %bcond_without python2
 Name:           python-osc-tiny
-Version:        0.2.2
+Version:        0.2.3
 Release:        0
 Summary:        Client API for openSUSE BuildService
 License:        MIT

++++++ osc-tiny-0.2.2.tar.gz -> osc-tiny-0.2.3.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/osc-tiny-0.2.2/PKG-INFO new/osc-tiny-0.2.3/PKG-INFO
--- old/osc-tiny-0.2.2/PKG-INFO 2020-02-04 09:22:19.000000000 +0100
+++ new/osc-tiny-0.2.3/PKG-INFO 2020-06-15 16:20:25.000000000 +0200
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: osc-tiny
-Version: 0.2.2
+Version: 0.2.3
 Summary: Client API for openSUSE BuildService
 Home-page: http://github.com/crazyscientist/osc-tiny
 Author: Andreas Hasenkopf
@@ -22,7 +22,7 @@
         This is a very basic example:
         
         ```python
-        from ostiny import Osc
+        from osctiny import Osc
         
         osc = Osc(
             url="https://api.opensuse.org";,
@@ -50,6 +50,7 @@
         * https://osc-tiny.readthedocs.io/en/latest/
         * https://openbuildservice.org/
         * https://build.opensuse.org/apidocs/index
+        
 Platform: UNKNOWN
 Classifier: Development Status :: 5 - Production/Stable
 Classifier: Intended Audience :: Developers
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/osc-tiny-0.2.2/README.md new/osc-tiny-0.2.3/README.md
--- old/osc-tiny-0.2.2/README.md        2020-02-04 09:21:59.000000000 +0100
+++ new/osc-tiny-0.2.3/README.md        2020-06-15 16:20:04.000000000 +0200
@@ -13,7 +13,7 @@
 This is a very basic example:
 
 ```python
-from ostiny import Osc
+from osctiny import Osc
 
 osc = Osc(
     url="https://api.opensuse.org";,
@@ -40,4 +40,4 @@
 
 * https://osc-tiny.readthedocs.io/en/latest/
 * https://openbuildservice.org/
-* https://build.opensuse.org/apidocs/index
\ No newline at end of file
+* https://build.opensuse.org/apidocs/index
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/osc-tiny-0.2.2/osc_tiny.egg-info/PKG-INFO 
new/osc-tiny-0.2.3/osc_tiny.egg-info/PKG-INFO
--- old/osc-tiny-0.2.2/osc_tiny.egg-info/PKG-INFO       2020-02-04 
09:22:19.000000000 +0100
+++ new/osc-tiny-0.2.3/osc_tiny.egg-info/PKG-INFO       2020-06-15 
16:20:24.000000000 +0200
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: osc-tiny
-Version: 0.2.2
+Version: 0.2.3
 Summary: Client API for openSUSE BuildService
 Home-page: http://github.com/crazyscientist/osc-tiny
 Author: Andreas Hasenkopf
@@ -22,7 +22,7 @@
         This is a very basic example:
         
         ```python
-        from ostiny import Osc
+        from osctiny import Osc
         
         osc = Osc(
             url="https://api.opensuse.org";,
@@ -50,6 +50,7 @@
         * https://osc-tiny.readthedocs.io/en/latest/
         * https://openbuildservice.org/
         * https://build.opensuse.org/apidocs/index
+        
 Platform: UNKNOWN
 Classifier: Development Status :: 5 - Production/Stable
 Classifier: Intended Audience :: Developers
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/osc-tiny-0.2.2/osc_tiny.egg-info/SOURCES.txt 
new/osc-tiny-0.2.3/osc_tiny.egg-info/SOURCES.txt
--- old/osc-tiny-0.2.2/osc_tiny.egg-info/SOURCES.txt    2020-02-04 
09:22:19.000000000 +0100
+++ new/osc-tiny-0.2.3/osc_tiny.egg-info/SOURCES.txt    2020-06-15 
16:20:24.000000000 +0200
@@ -17,6 +17,7 @@
 osctiny/extensions/bs_requests.py
 osctiny/extensions/buildresults.py
 osctiny/extensions/comments.py
+osctiny/extensions/distributions.py
 osctiny/extensions/issues.py
 osctiny/extensions/packages.py
 osctiny/extensions/projects.py
@@ -29,6 +30,7 @@
 osctiny/tests/test_cache.py
 osctiny/tests/test_comments.py
 osctiny/tests/test_datadir.py
+osctiny/tests/test_distributions.py
 osctiny/tests/test_issues.py
 osctiny/tests/test_packages.py
 osctiny/tests/test_projects.py
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/osc-tiny-0.2.2/osctiny/__init__.py 
new/osc-tiny-0.2.3/osctiny/__init__.py
--- old/osc-tiny-0.2.2/osctiny/__init__.py      2020-02-04 09:21:59.000000000 
+0100
+++ new/osc-tiny-0.2.3/osctiny/__init__.py      2020-06-15 16:20:04.000000000 
+0200
@@ -6,4 +6,4 @@
 
 __all__ = ['Osc', 'bs_requests', 'buildresults', 'comments', 'packages',
            'projects', 'search', 'users']
-__version__ = "0.2.2"
+__version__ = "0.2.3"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/osc-tiny-0.2.2/osctiny/extensions/distributions.py 
new/osc-tiny-0.2.3/osctiny/extensions/distributions.py
--- old/osc-tiny-0.2.2/osctiny/extensions/distributions.py      1970-01-01 
01:00:00.000000000 +0100
+++ new/osc-tiny-0.2.3/osctiny/extensions/distributions.py      2020-06-15 
16:20:04.000000000 +0200
@@ -0,0 +1,57 @@
+"""
+Distributions extension
+-----------------------
+"""
+from __future__ import unicode_literals
+
+from six.moves.urllib.parse import urljoin
+from six import text_type
+
+from ..utils.base import ExtensionBase
+
+
+class Distribution(ExtensionBase):
+    """
+    Osc extension to interact with distributions
+
+    .. versionadded:: 0.2.3
+    """
+    base_path = "/distributions"
+
+    def get_list(self, include_remotes=False):
+        """
+        Get list of base distributions
+
+        :param bool include_remotes: If ``True`` response will include 
distributions also from
+                                     remote instances
+        :return: Objectified XML element
+        :rtype: lxml.objectify.ObjectifiedElement
+        """
+        url = urljoin(self.osc.url, self.base_path)
+        if include_remotes:
+            url += "/include_remotes"
+
+        response = self.osc.request(
+            url=url,
+            method="GET"
+        )
+
+        return self.osc.get_objectified_xml(response)
+
+    def get(self, distribution_id):
+        """
+        Get data of one base distributions hosted on this OBS instance
+
+        :param int distribution_id: ID of distribution
+        :return: Objectified XML element
+        :rtype: lxml.objectify.ObjectifiedElement
+        """
+        response = self.osc.request(
+            url=urljoin(
+                self.osc.url,
+                "/".join((self.base_path, text_type(distribution_id)))
+            ),
+            method="GET"
+        )
+
+        return self.osc.get_objectified_xml(response)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/osc-tiny-0.2.2/osctiny/extensions/issues.py 
new/osc-tiny-0.2.3/osctiny/extensions/issues.py
--- old/osc-tiny-0.2.2/osctiny/extensions/issues.py     2020-02-04 
09:21:59.000000000 +0100
+++ new/osc-tiny-0.2.3/osctiny/extensions/issues.py     2020-06-15 
16:20:04.000000000 +0200
@@ -1,6 +1,6 @@
 """
 Issues extension
-------------------
+----------------
 """
 from __future__ import unicode_literals
 import os
@@ -14,8 +14,9 @@
     from functools import lru_cache
 except ImportError:
     # Whoever had the grandiose idea to backport this to Python2?
-    # pylint: disable=unused-argument, missing-function-docstring
+    # pylint: disable=unused-argument
     def lru_cache(*args, **kwargs):
+        """Dummy wrapper"""
         def wrapper(fun):
             return fun
 
@@ -81,9 +82,10 @@
             method="GET",
             params={'force_update': force_update}
         )
+        response = self.osc.get_objectified_xml(response)
 
         if not force_update and can_get_details and all(can_get_details):
             if not getattr(getattr(response, "summary", None), "text", None):
                 return self.get(tracker, name, force_update=True)
 
-        return self.osc.get_objectified_xml(response)
+        return response
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/osc-tiny-0.2.2/osctiny/osc.py 
new/osc-tiny-0.2.3/osctiny/osc.py
--- old/osc-tiny-0.2.2/osctiny/osc.py   2020-02-04 09:21:59.000000000 +0100
+++ new/osc-tiny-0.2.3/osctiny/osc.py   2020-06-15 16:20:04.000000000 +0200
@@ -19,6 +19,7 @@
 
 from .extensions.buildresults import Build
 from .extensions.comments import Comment
+from .extensions.distributions import Distribution
 from .extensions.issues import Issue
 from .extensions.packages import Package
 from .extensions.projects import Project
@@ -67,6 +68,8 @@
           - :py:attr:`build`
         * - :py:class:`osctiny.extensions.comments.Comment`
           - :py:attr:`comments`
+        * - :py:class:`osctiny.extensions.distributions.Distribution`
+          - :py:attr:`distributions`
 
     :param url: API URL of a BuildService instance
     :param username: Credential for login
@@ -81,7 +84,10 @@
         The ``comments`` extension
 
     .. versionadded:: 0.2.2
-        The `issues`` extension
+        The ``issues`` extension
+
+    .. versionadded:: 0.2.3
+        The ``distributions`` extension
 
     .. _SSL Cert Verification:
         http://docs.python-requests.org/en/master/user/advanced/
@@ -110,6 +116,7 @@
         # API endpoints
         self.build = Build(osc_obj=self)
         self.comments = Comment(osc_obj=self)
+        self.distributions = Distribution(osc_obj=self)
         self.groups = Group(osc_obj=self)
         self.issues = Issue(osc_obj=self)
         self.packages = Package(osc_obj=self)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/osc-tiny-0.2.2/osctiny/tests/test_distributions.py 
new/osc-tiny-0.2.3/osctiny/tests/test_distributions.py
--- old/osc-tiny-0.2.2/osctiny/tests/test_distributions.py      1970-01-01 
01:00:00.000000000 +0100
+++ new/osc-tiny-0.2.3/osctiny/tests/test_distributions.py      2020-06-15 
16:20:04.000000000 +0200
@@ -0,0 +1,100 @@
+# -*- coding: utf8 -*-
+from __future__ import unicode_literals
+import re
+
+from requests.exceptions import HTTPError
+import responses
+
+from .base import OscTest, CallbackFactory
+
+
+class TestDistribution(OscTest):
+    @responses.activate
+    def test_get_list(self):
+        def _base(include_remotes):
+            response = 
self.osc.distributions.get_list(include_remotes=include_remotes)
+            self.assertEqual({int(d.get("id")) for d in response.distribution},
+                             {14495, 14498, 14501})
+
+        def dist_list_callback(headers, params, request):
+            status, body = 200, """
+            <distributions>
+              <distribution vendor="openSUSE" version="Tumbleweed" id="14495">
+                <name>openSUSE Tumbleweed</name>
+                <project>openSUSE:Factory</project>
+                <reponame>openSUSE_Tumbleweed</reponame>
+                <repository>snapshot</repository>
+                <link>http://www.opensuse.org/</link>
+                <architecture>i586</architecture>
+                <architecture>x86_64</architecture>
+              </distribution>
+              <distribution vendor="openSUSE" version="15.2" id="14498">
+                <name>openSUSE Leap 15.2</name>
+                <project>openSUSE:Leap:15.2</project>
+                <reponame>openSUSE_Leap_15.2</reponame>
+                <repository>standard</repository>
+                <link>http://www.opensuse.org/</link>
+                <architecture>x86_64</architecture>
+              </distribution>
+              <distribution vendor="openSUSE" version="15.1" id="14501">
+                <name>openSUSE Leap 15.1</name>
+                <project>openSUSE:Leap:15.1</project>
+                <reponame>openSUSE_Leap_15.1</reponame>
+                <repository>standard</repository>
+                <link>http://www.opensuse.org/</link>
+                <architecture>x86_64</architecture>
+              </distribution>
+            </distributions>"""
+            return status, headers, body
+
+        self.mock_request(
+            method=responses.GET,
+            url=re.compile(self.osc.url + 
r'/distributions(/include_remotes)?/?$'),
+            callback=CallbackFactory(dist_list_callback)
+        )
+
+        with self.subTest("include remotes"):
+            _base(True)
+
+        with self.subTest("do not include remotes"):
+            _base(False)
+
+    @responses.activate
+    def test_get(self):
+        def dist_callback(headers, params, request):
+            if re.search("14498/?$", request.url):
+                status, body = 200, """<?xml version="1.0" encoding="UTF-8"?>
+                <hash>
+                  <id type="integer">14498</id>
+                  <vendor>openSUSE</vendor>
+                  <version>15.2</version>
+                  <name>openSUSE Leap 15.2</name>
+                  <project>openSUSE:Leap:15.2</project>
+                  <reponame>openSUSE_Leap_15.2</reponame>
+                  <repository>standard</repository>
+                  <link>http://www.opensuse.org/</link>
+                  <architectures type="array">
+                    <architecture>x86_64</architecture>
+                  </architectures>
+                </hash>"""
+            else:
+                status, body = 404, """
+                <status code="not_found">
+                  <summary>Couldn't find Distribution with 
'id'=******</summary>
+                </status>"""
+            return status, headers, body
+
+        self.mock_request(
+            method=responses.GET,
+            url=re.compile(self.osc.url + r'/distributions/\d+/?$'),
+            callback=CallbackFactory(dist_callback)
+        )
+
+        with self.subTest("existing distro"):
+            response = self.osc.distributions.get(14498)
+            self.assertEqual(response.id, 14498)
+            self.assertEqual(response.vendor, "openSUSE")
+            self.assertEqual(response.version, 15.2)
+
+        with self.subTest("unknown distro"):
+            self.assertRaises(HTTPError, self.osc.distributions.get, 99999)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/osc-tiny-0.2.2/osctiny/tests/test_issues.py 
new/osc-tiny-0.2.3/osctiny/tests/test_issues.py
--- old/osc-tiny-0.2.2/osctiny/tests/test_issues.py     2020-02-04 
09:21:59.000000000 +0100
+++ new/osc-tiny-0.2.3/osctiny/tests/test_issues.py     2020-06-15 
16:20:04.000000000 +0200
@@ -12,7 +12,7 @@
 
 class TestIssue(OscTest):
     def setUp(self):
-        super(TestIssue, self).setUpClass()
+        super(TestIssue, self).setUp()
 
         def callback(headers, params, request):
             status, body = 200, """
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/osc-tiny-0.2.2/setup.py new/osc-tiny-0.2.3/setup.py
--- old/osc-tiny-0.2.2/setup.py 2020-02-04 09:21:59.000000000 +0100
+++ new/osc-tiny-0.2.3/setup.py 2020-06-15 16:20:04.000000000 +0200
@@ -22,7 +22,7 @@
 
 setup(
     name='osc-tiny',
-    version='0.2.2',
+    version='0.2.3',
     description='Client API for openSUSE BuildService',
     long_description=long_description,
     long_description_content_type="text/markdown",


Reply via email to