forked from pool/python-redfish
Accepting request 768944 from home:mnhauke
Initial package for python-redfish OBS-URL: https://build.opensuse.org/request/show/768944 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-redfish?expand=0&rev=1
This commit is contained in:
23
.gitattributes
vendored
Normal file
23
.gitattributes
vendored
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
## Default LFS
|
||||||
|
*.7z filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.bsp filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.gem filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.gz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.jar filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.lz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.lzma filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.obscpio filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.oxt filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pdf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.png filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.rpm filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tbz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tbz2 filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tgz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.ttf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.txz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.whl filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.xz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.zip filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.zst filter=lfs diff=lfs merge=lfs -text
|
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
.osc
|
130
0001-remove-urlparse2-dependncy.patch
Normal file
130
0001-remove-urlparse2-dependncy.patch
Normal file
@@ -0,0 +1,130 @@
|
|||||||
|
From 953e3bd640b79ff621ba2b4cc7215581916ddb99 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Bill Dodd <billdodd@gmail.com>
|
||||||
|
Date: Wed, 29 Jan 2020 17:18:25 -0600
|
||||||
|
Subject: [PATCH] remove urlparse2 dependncy
|
||||||
|
|
||||||
|
---
|
||||||
|
requirements.txt | 4 ++--
|
||||||
|
setup.py | 12 +++++++++---
|
||||||
|
src/redfish/ris/rmc_helper.py | 5 +++--
|
||||||
|
tests/ris/test_rmc_helper.py | 29 +++++++++++++++++++++++++++++
|
||||||
|
tox.ini | 8 ++++++++
|
||||||
|
5 files changed, 51 insertions(+), 7 deletions(-)
|
||||||
|
create mode 100644 tests/ris/test_rmc_helper.py
|
||||||
|
|
||||||
|
diff --git a/requirements.txt b/requirements.txt
|
||||||
|
index 060d85f..fba487f 100644
|
||||||
|
--- a/requirements.txt
|
||||||
|
+++ b/requirements.txt
|
||||||
|
@@ -1,4 +1,4 @@
|
||||||
|
-jsonpatch
|
||||||
|
+jsonpatch<=1.24 ; python_version == '3.4'
|
||||||
|
+jsonpatch ; python_version >= '3.5' or python_version == '2.7'
|
||||||
|
jsonpath_rw
|
||||||
|
jsonpointer
|
||||||
|
-urlparse2
|
||||||
|
\ No newline at end of file
|
||||||
|
diff --git a/setup.py b/setup.py
|
||||||
|
index 344e597..c5ea3b7 100644
|
||||||
|
--- a/setup.py
|
||||||
|
+++ b/setup.py
|
||||||
|
@@ -24,8 +24,14 @@ setup(name='redfish',
|
||||||
|
packages=find_packages('src'),
|
||||||
|
package_dir={'': 'src'},
|
||||||
|
install_requires=[
|
||||||
|
- 'jsonpatch',
|
||||||
|
'jsonpath_rw',
|
||||||
|
'jsonpointer',
|
||||||
|
- 'urlparse2',
|
||||||
|
- ])
|
||||||
|
+ ],
|
||||||
|
+ extras_require={
|
||||||
|
+ ':python_version == "3.4"': [
|
||||||
|
+ 'jsonpatch<=1.24'
|
||||||
|
+ ],
|
||||||
|
+ ':python_version >= "3.5" or python_version == "2.7"': [
|
||||||
|
+ 'jsonpatch'
|
||||||
|
+ ]
|
||||||
|
+ })
|
||||||
|
diff --git a/src/redfish/ris/rmc_helper.py b/src/redfish/ris/rmc_helper.py
|
||||||
|
index e633a49..5e7b5dc 100644
|
||||||
|
--- a/src/redfish/ris/rmc_helper.py
|
||||||
|
+++ b/src/redfish/ris/rmc_helper.py
|
||||||
|
@@ -12,9 +12,10 @@ import json
|
||||||
|
import errno
|
||||||
|
import logging
|
||||||
|
import hashlib
|
||||||
|
-import urlparse2
|
||||||
|
import redfish.rest
|
||||||
|
|
||||||
|
+from six.moves.urllib.parse import urlparse
|
||||||
|
+
|
||||||
|
from .ris import (RisMonolith)
|
||||||
|
from .sharedtypes import (JSONEncoder)
|
||||||
|
from .config import (AutoConfigParser)
|
||||||
|
@@ -146,7 +147,7 @@ class RmcClient(object):
|
||||||
|
|
||||||
|
def get_cache_dirname(self):
|
||||||
|
"""The rest client's current base URL converted to path"""
|
||||||
|
- parts = urlparse2.urlparse(self.get_base_url())
|
||||||
|
+ parts = urlparse(self.get_base_url())
|
||||||
|
pathstr = '%s/%s' % (parts.netloc, parts.path)
|
||||||
|
return pathstr.replace('//', '/')
|
||||||
|
|
||||||
|
diff --git a/tests/ris/test_rmc_helper.py b/tests/ris/test_rmc_helper.py
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000..dbf4a29
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/tests/ris/test_rmc_helper.py
|
||||||
|
@@ -0,0 +1,29 @@
|
||||||
|
+# Copyright Notice:
|
||||||
|
+# Copyright 2020 DMTF. All rights reserved.
|
||||||
|
+# License: BSD 3-Clause License. For full text see link:
|
||||||
|
+# https://github.com/DMTF/Redfish-Protocol-Validator/blob/master/LICENSE.md
|
||||||
|
+
|
||||||
|
+import unittest
|
||||||
|
+try:
|
||||||
|
+ from unittest import mock
|
||||||
|
+except ImportError:
|
||||||
|
+ import mock
|
||||||
|
+
|
||||||
|
+from redfish.ris import rmc_helper
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+class RmcHelper(unittest.TestCase):
|
||||||
|
+ def setUp(self):
|
||||||
|
+ super(RmcHelper, self).setUp()
|
||||||
|
+
|
||||||
|
+ @mock.patch('redfish.rest.v1.HttpClient')
|
||||||
|
+ def test_get_cache_dirname(self, mock_http_client):
|
||||||
|
+ url = 'http://example.com'
|
||||||
|
+ helper = rmc_helper.RmcClient(url=url, username='oper', password='xyz')
|
||||||
|
+ mock_http_client.return_value.get_base_url.return_value = url
|
||||||
|
+ dir_name = helper.get_cache_dirname()
|
||||||
|
+ self.assertEqual(dir_name, 'example.com/')
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+if __name__ == '__main__':
|
||||||
|
+ unittest.main()
|
||||||
|
diff --git a/tox.ini b/tox.ini
|
||||||
|
index 986f141..b1b8a84 100644
|
||||||
|
--- a/tox.ini
|
||||||
|
+++ b/tox.ini
|
||||||
|
@@ -14,6 +14,14 @@ commands =
|
||||||
|
--with-timer \
|
||||||
|
--with-coverage --cover-erase --cover-package=src
|
||||||
|
|
||||||
|
+[testenv:py27]
|
||||||
|
+deps =
|
||||||
|
+ coverage
|
||||||
|
+ fixtures
|
||||||
|
+ mock
|
||||||
|
+ nose
|
||||||
|
+ nose-timer
|
||||||
|
+
|
||||||
|
[testenv:pep8]
|
||||||
|
basepython = python3.6
|
||||||
|
deps = flake8
|
||||||
|
--
|
||||||
|
2.25.0
|
||||||
|
|
6
python-redfish.changes
Normal file
6
python-redfish.changes
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Thu Jan 30 21:40:14 UTC 2020 - Martin Hauke <mardnh@gmx.de>
|
||||||
|
|
||||||
|
- Initial package, version 2.1.4
|
||||||
|
- Add patch:
|
||||||
|
* 0001-remove-urlparse2-dependncy.patch
|
68
python-redfish.spec
Normal file
68
python-redfish.spec
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
#
|
||||||
|
# spec file for package python-redfish
|
||||||
|
#
|
||||||
|
# Copyright (c) 2020, Martin Hauke <mardnh@gmx.de>
|
||||||
|
#
|
||||||
|
# All modifications and additions to the file contributed by third parties
|
||||||
|
# remain the property of their copyright owners, unless otherwise agreed
|
||||||
|
# upon. The license for this file, and modifications and additions to the
|
||||||
|
# file, is the same license as for the pristine package itself (unless the
|
||||||
|
# license for the pristine package is not an Open Source License, in which
|
||||||
|
# case the license is the MIT License). An "Open Source License" is a
|
||||||
|
# license that conforms to the Open Source Definition (Version 1.9)
|
||||||
|
# published by the Open Source Initiative.
|
||||||
|
|
||||||
|
# Please submit bugfixes or comments via http://bugs.opensuse.org/
|
||||||
|
|
||||||
|
|
||||||
|
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
|
||||||
|
Name: python-redfish
|
||||||
|
Version: 2.1.4
|
||||||
|
Release: 0
|
||||||
|
Summary: Redfish Python Library
|
||||||
|
License: BSD-3-Clause
|
||||||
|
Group: Development/Languages/Python
|
||||||
|
URL: https://github.com/DMTF/python-redfish-library
|
||||||
|
Source: https://github.com/DMTF/python-redfish-library/archive/%{version}.tar.gz#/redfish-%{version}.tar.gz
|
||||||
|
Patch0: 0001-remove-urlparse2-dependncy.patch
|
||||||
|
BuildRequires: %{python_module setuptools}
|
||||||
|
BuildRequires: fdupes
|
||||||
|
BuildRequires: python-rpm-macros
|
||||||
|
Requires: python-jsonpatch
|
||||||
|
Requires: python-jsonpath-rw
|
||||||
|
Requires: python-jsonpointer
|
||||||
|
BuildArch: noarch
|
||||||
|
# SECTION test requirements
|
||||||
|
BuildRequires: %{python_module jsonpatch}
|
||||||
|
BuildRequires: %{python_module jsonpath-rw}
|
||||||
|
BuildRequires: %{python_module jsonpointer}
|
||||||
|
BuildRequires: %{python_module mock}
|
||||||
|
BuildRequires: %{python_module pytest}
|
||||||
|
# /SECTION
|
||||||
|
%python_subpackages
|
||||||
|
|
||||||
|
%description
|
||||||
|
The Redfish library performs the basic HTTPS operations GET, POST,
|
||||||
|
PUT, PATCH and DELETE on resources using the HATEOAS (Hypermedia as
|
||||||
|
the Engine of Application State) Redfish architecture.
|
||||||
|
|
||||||
|
%prep
|
||||||
|
%setup -q -n %{name}-library-%{version}
|
||||||
|
%patch0 -p1
|
||||||
|
|
||||||
|
%build
|
||||||
|
%python_build
|
||||||
|
|
||||||
|
%install
|
||||||
|
%python_install
|
||||||
|
%python_expand %fdupes %{buildroot}%{$python_sitelib}
|
||||||
|
|
||||||
|
%check
|
||||||
|
%pytest
|
||||||
|
|
||||||
|
%files %{python_files}
|
||||||
|
%license LICENSE.md
|
||||||
|
%doc README.rst CHANGELOG.md
|
||||||
|
%{python_sitelib}/redfish*
|
||||||
|
|
||||||
|
%changelog
|
3
redfish-2.1.4.tar.gz
Normal file
3
redfish-2.1.4.tar.gz
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:d03909a0b36f668a89f9ca5742d094c4a7d373890e63dd2ff6b98ef4e3fecaa2
|
||||||
|
size 37435
|
Reference in New Issue
Block a user