commit 5a89e2d069dffaf7926d7999c5af563129025644 Author: Sergey Cherevko Date: Tue Jan 16 12:19:15 2024 +0300 import python-toml-0.10.0-3.el8 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9e6b5ff --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/toml-0.10.0.tar.gz diff --git a/.python-toml.metadata b/.python-toml.metadata new file mode 100644 index 0000000..6528d50 --- /dev/null +++ b/.python-toml.metadata @@ -0,0 +1 @@ +53ac05074977ec92c5a3559d91c7cc9de649a440 SOURCES/toml-0.10.0.tar.gz diff --git a/SOURCES/toml_test.py b/SOURCES/toml_test.py new file mode 100644 index 0000000..f399c05 --- /dev/null +++ b/SOURCES/toml_test.py @@ -0,0 +1,56 @@ +#!/usr/bin/env python2 + +import datetime +import json +import sys +import toml + +try: + _range = xrange + iteritems = dict.iteritems +except NameError: + unicode = str + _range = range + basestring = str + unichr = chr + iteritems = dict.items + long = int + +def tag(value): + if isinstance(value, dict): + d = { } + for k, v in iteritems(value): + d[k] = tag(v) + return d + elif isinstance(value, list): + a = [] + for v in value: + a.append(tag(v)) + try: + a[0]["value"] + except KeyError: + return a + except IndexError: + pass + return {'type': 'array', 'value': a} + elif isinstance(value, basestring): + return {'type': 'string', 'value': value} + elif isinstance(value, bool): + return {'type': 'bool', 'value': str(value).lower()} + elif isinstance(value, int): + return {'type': 'integer', 'value': str(value)} + elif isinstance(value, long): + return {'type': 'integer', 'value': str(value)} + elif isinstance(value, float): + return {'type': 'float', 'value': repr(value)} + elif isinstance(value, datetime.datetime): + sdate = value.strftime('%Y-%m-%dT%H:%M:%SZ') + return {'type': 'datetime', 'value': sdate} + assert False, 'Unknown type: %s' % type(value) + + +if __name__ == '__main__': + tdata = toml.loads(sys.stdin.read()) + tagged = tag(tdata) + print(json.dumps(tagged)) + diff --git a/SOURCES/toml_test3.py b/SOURCES/toml_test3.py new file mode 100644 index 0000000..84b6351 --- /dev/null +++ b/SOURCES/toml_test3.py @@ -0,0 +1,11 @@ +#!/usr/bin/env python3 + +import toml_test +import toml +import sys +import json + +if __name__ == '__main__': + tdata = toml.loads(sys.stdin.read()) + tagged = toml_test.tag(tdata) + print(json.dumps(tagged)) diff --git a/SPECS/python-toml.spec b/SPECS/python-toml.spec new file mode 100644 index 0000000..5d84ccb --- /dev/null +++ b/SPECS/python-toml.spec @@ -0,0 +1,151 @@ +%global pypi_name toml +%global with_test 0 +%global desc TOML aims to be a minimal configuration file format that's easy to read due to \ +obvious semantics. TOML is designed to map unambiguously to a hash table. TOML \ +should be easy to parse into data structures in a wide variety of languages. \ +This package loads toml file into python dictionary and dump dictionary into \ +toml file. + +%if 0%{?fedora} +%global with_test 0 +%endif + +Name: python-%{pypi_name} +Version: 0.10.0 +Release: 3%{?dist} +Summary: Python Library for Tom's Obvious, Minimal Language + +License: MIT +URL: https://pypi.python.org/pypi/%{pypi_name} +Source0: https://files.pythonhosted.org/packages/b9/19/5cbd78eac8b1783671c40e34bb0fa83133a06d340a38b55c645076d40094/toml-0.10.0.tar.gz +# Tests files are not provided in pypi release as they require toml-test to run +Source1: https://raw.githubusercontent.com/uiri/toml/da6d593944d08569e08ff32f2bb2e73da91d3578/toml_test.py +Source2: https://raw.githubusercontent.com/uiri/toml/da6d593944d08569e08ff32f2bb2e73da91d3578/toml_test3.py + +BuildArch: noarch + +BuildRequires: python%{python3_pkgversion}-devel +%if 0%{with_test} +BuildRequires: golang-github-BurntSushi-toml-test +%endif + +%description +%desc + +%package -n python%{python3_pkgversion}-%{pypi_name} +Summary: %{summary} +BuildRequires: python%{python3_pkgversion}-devel +%{?python_provide:%python_provide python%{python3_pkgversion}-%{pypi_name}} + +%description -n python%{python3_pkgversion}-%{pypi_name} +%desc + +%prep +%setup -q -n %{pypi_name}-%{version} +%if 0%{with_test} +# Copy test files and make them executable so toml-test can work +cp -a %{SOURCE1} %{SOURCE2} . +chmod +x toml_test.py toml_test3.py +%endif + + +%build +%py3_build + + +%install +%py3_install + + +%check +# Using the language independent toml-test suite to launch tests +# link the the tests files +%if 0%{with_test} +ln -s /usr/share/toml-test/tests tests +toml-test $(pwd)/toml_test.py +toml-test $(pwd)/toml_test3.py +%endif + + +%files -n python%{python3_pkgversion}-%{pypi_name} +%license LICENSE +%doc README.rst +%{python3_sitelib}/%{pypi_name}-%{version}-py%{python3_version}.egg-info +%{python3_sitelib}/%{pypi_name}/ + + +%changelog +* Mon Jan 15 2024 Sergey Cherevko - 0.10.0-3 +- Rebuilt for MSVSphere 8.9 + +* Mon Feb 11 2019 Miro Hrončok - 0.10.0-3 +- Subpackage python2-toml has been removed + See https://fedoraproject.org/wiki/Changes/Mass_Python_2_Package_Removal + +* Sat Feb 02 2019 Fedora Release Engineering - 0.10.0-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild + +* Sun Nov 25 2018 Julien Enselme - 0.10.0-1 +- Update to 0.10.0 (#1652946) + +* Sat Jul 14 2018 Fedora Release Engineering - 0.9.4-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild + +* Tue Jun 19 2018 Miro Hrončok - 0.9.4-4 +- Rebuilt for Python 3.7 + +* Wed Feb 21 2018 Sayan Chowdhury - 0.9.4-3 +- Make changes to build the package for EPEL + +* Fri Feb 09 2018 Fedora Release Engineering - 0.9.4-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild + +* Wed Dec 27 2017 Julien Enselme - 0.9.4-1 +- Update to 0.9.4 + +* Tue Sep 26 2017 Julien Enselme - 0.9.3-1 +- Update to 0.9.3 + +* Thu Jul 27 2017 Fedora Release Engineering - 0.9.2-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild + +* Sat Feb 11 2017 Fedora Release Engineering - 0.9.2-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild + +* Mon Dec 19 2016 Miro Hrončok - 0.9.2-2 +- Rebuild for Python 3.6 + +* Thu Sep 01 2016 Julien Enselme - 0.9.2-1 +- Update to 0.9.2 +- Improve spec with %%summary and %%desc macros + +* Tue Jul 19 2016 Fedora Release Engineering - 0.9.1-7 +- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages + +* Thu Feb 04 2016 Fedora Release Engineering - 0.9.1-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild + +* Wed Nov 11 2015 Fedora Release Engineering - 0.9.1-5 +- Rebuilt for https://fedoraproject.org/wiki/Changes/python3.5 + +* Mon Nov 9 2015 Julien Enselme - 0.9.1-4 +- Correct %%python_provides for python3 + +* Thu Nov 5 2015 Julien Enselme - 0.9.1-3 +- Rebuilt for python 3.5 + +* Sat Aug 8 2015 Julien Enselme - 0.9.1-2 +- Enable tests suite +- Build python3 and python2 in the same directory +- Use %%py2_build, %%py3_build, %%py2_install and %%py2_install +- Move python2 package in its own subpackage + +* Sat Jul 11 2015 Fedora Release Monitoring - 0.9.1-1 +- Update to 0.9.1 (#1242131) + +* Sun Jun 28 2015 Julien Enselme - 0.9.0-2 +- Update description to explain what toml is +- Try to import the package in %%check + +* Mon Jun 15 2015 Julien Enselme - 0.9.0-1 +- Initial packaging