Accepting request 767696 from home:mnhauke:branches:home:ojkastl_buildservice:Redfish_openSUSE

Initial package for python-formats

OBS-URL: https://build.opensuse.org/request/show/767696
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-formats?expand=0&rev=1
This commit is contained in:
Tomáš Chvátal 2020-01-28 08:10:08 +00:00 committed by Git OBS Bridge
commit 7737c504e1
7 changed files with 1180 additions and 0 deletions

23
.gitattributes vendored Normal file
View 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
View File

@ -0,0 +1 @@
.osc

1048
LICENSE Normal file

File diff suppressed because it is too large Load Diff

3
formats-0.1.1.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:feb7e3d268d7a4182872f739f7a1af833032c624ddd3121741c47ac37b94385d
size 3686

17
python-formats.changes Normal file
View File

@ -0,0 +1,17 @@
-------------------------------------------------------------------
Sat Jan 25 22:29:10 UTC 2020 - Martin Hauke <mardnh@gmx.de>
- Package license file
- Run testsuite
- Remove not unneeded dependencies
-------------------------------------------------------------------
Wed Oct 18 18:49:17 UTC 2017 - opensuse_buildservice@ojkastl.de
- adjusted spec to comply with singlespec convention
-------------------------------------------------------------------
Tue Sep 6 11:27:37 UTC 2016 - mardnh@gmx.de
- initial package, version 0.1.1

58
python-formats.spec Normal file
View File

@ -0,0 +1,58 @@
#
# spec file for package python-formats
#
# Copyright (c) 2016-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-formats
Version: 0.1.1
Release: 0
Summary: Support multiple formats with ease
License: MIT
Group: Development/Languages/Python
URL: https://github.com/redodo/formats
Source: https://files.pythonhosted.org/packages/source/f/formats/formats-%{version}.tar.gz
Source1: https://github.com/redodo/formats/blob/master/LICENSE
Source2: https://raw.githubusercontent.com/redodo/formats/master/test_formats.py
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
BuildArch: noarch
%python_subpackages
%description
Formats will provide you with a consistent API to parse and compose data.
%prep
%setup -q -n formats-%{version}
cp %{SOURCE1} .
cp %{SOURCE2} .
%build
%python_build
%install
%python_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%check
%python_expand %python_exec -m unittest discover -v
%files %{python_files}
%license LICENSE
%doc README.rst
%{python_sitelib}/formats*
%changelog

30
test_formats.py Normal file
View File

@ -0,0 +1,30 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
from formats import FormatBank
class TestFormats(unittest.TestCase):
def test_discovery(self):
formats = FormatBank()
formats.discover()
def test_registering(self):
formats = FormatBank()
formats.discover_json()
def composer(text):
return '1:%s' % text
def parser(text):
return text[2:]
formats.register('test', parser, composer)
assert formats.parse('test', '1:hello') == 'hello'
assert formats.compose('test', 'hello') == '1:hello'
assert formats.convert('test', 'json', '1:hello') == '"hello"'
assert formats.convert('test', 'test', '1:hello') == '1:hello'
if __name__ == '__main__':
unittest.main()