%global _empty_manifest_terminate_build 0 Name: python-iniparser2 Version: 3.0.0 Release: 1 Summary: An INI parser or config parser License: MIT URL: https://github.com/HugeBrain16/iniparser2 Source0: https://mirrors.aliyun.com/pypi/web/packages/99/64/50218bd32e838c9e6c2c8e485db64acbd186a78775dc5c7163eacd4ab85a/iniparser2-3.0.0.tar.gz BuildArch: noarch %description ## Installation - using pip - from pypi - `pip install iniparser2` - `pip install iniparser2 --upgrade` - from github repository - `pip install git+https://github.com/HugeBrain16/iniparser2.git` - from source - `pip install .` - from source - `python setup.py install` ## Examples #### read string ```py import iniparser2 string = """ [me] name = josh age = 0 """ parser = iniparser2.INI() parser.read(string) print(parser) ``` #### using parser methods ```py import iniparser2 parser = iniparser2.INI() parser.set_section("me") parser.set("name", "josh", section="me") parser.set("age", 0, section="me") print(parser) ``` or ```py import iniparser2 parser = iniparser2.INI() parser.set_section("me") parser["me"]["name"] = "josh" parser["me"]["age"] = 0 print(parser) ``` #### read from file ```py import iniparser2 parser = iniparser2.INI() parser.read_file("filename.ini") print(parser) ``` #### read-write file `file.ini` ```ini car = 1 bike = 1 ``` `main.py` ```py import iniparser2 parser = iniparser2.INI(convert_property=True) parser.read_file("file.ini") parser.set("car", parser.get("car") + 1) parser.remove_property("bike") parser.write("file.ini") parser.read_file("file.ini") print(parser) ``` or ```py import iniparser2 parser = iniparser2.INI(convert_property=True) parser.read_file("file.ini") parser["car"] += 1 del parser["bike"] parser.write("file.ini") parser.read_file("file.ini") print(parser) ``` ### Exceptions exceptions because why not - base exception - `ParsingError` - `ParseSectionError` - `ParsePropertyError` - `ParseDuplicateError` - something else - `DuplicateError` - `PropertyError` - `SectionError` %package -n python3-iniparser2 Summary: An INI parser or config parser Provides: python-iniparser2 BuildRequires: python3-devel BuildRequires: python3-setuptools BuildRequires: python3-pip %description -n python3-iniparser2 ## Installation - using pip - from pypi - `pip install iniparser2` - `pip install iniparser2 --upgrade` - from github repository - `pip install git+https://github.com/HugeBrain16/iniparser2.git` - from source - `pip install .` - from source - `python setup.py install` ## Examples #### read string ```py import iniparser2 string = """ [me] name = josh age = 0 """ parser = iniparser2.INI() parser.read(string) print(parser) ``` #### using parser methods ```py import iniparser2 parser = iniparser2.INI() parser.set_section("me") parser.set("name", "josh", section="me") parser.set("age", 0, section="me") print(parser) ``` or ```py import iniparser2 parser = iniparser2.INI() parser.set_section("me") parser["me"]["name"] = "josh" parser["me"]["age"] = 0 print(parser) ``` #### read from file ```py import iniparser2 parser = iniparser2.INI() parser.read_file("filename.ini") print(parser) ``` #### read-write file `file.ini` ```ini car = 1 bike = 1 ``` `main.py` ```py import iniparser2 parser = iniparser2.INI(convert_property=True) parser.read_file("file.ini") parser.set("car", parser.get("car") + 1) parser.remove_property("bike") parser.write("file.ini") parser.read_file("file.ini") print(parser) ``` or ```py import iniparser2 parser = iniparser2.INI(convert_property=True) parser.read_file("file.ini") parser["car"] += 1 del parser["bike"] parser.write("file.ini") parser.read_file("file.ini") print(parser) ``` ### Exceptions exceptions because why not - base exception - `ParsingError` - `ParseSectionError` - `ParsePropertyError` - `ParseDuplicateError` - something else - `DuplicateError` - `PropertyError` - `SectionError` %package help Summary: Development documents and examples for iniparser2 Provides: python3-iniparser2-doc %description help ## Installation - using pip - from pypi - `pip install iniparser2` - `pip install iniparser2 --upgrade` - from github repository - `pip install git+https://github.com/HugeBrain16/iniparser2.git` - from source - `pip install .` - from source - `python setup.py install` ## Examples #### read string ```py import iniparser2 string = """ [me] name = josh age = 0 """ parser = iniparser2.INI() parser.read(string) print(parser) ``` #### using parser methods ```py import iniparser2 parser = iniparser2.INI() parser.set_section("me") parser.set("name", "josh", section="me") parser.set("age", 0, section="me") print(parser) ``` or ```py import iniparser2 parser = iniparser2.INI() parser.set_section("me") parser["me"]["name"] = "josh" parser["me"]["age"] = 0 print(parser) ``` #### read from file ```py import iniparser2 parser = iniparser2.INI() parser.read_file("filename.ini") print(parser) ``` #### read-write file `file.ini` ```ini car = 1 bike = 1 ``` `main.py` ```py import iniparser2 parser = iniparser2.INI(convert_property=True) parser.read_file("file.ini") parser.set("car", parser.get("car") + 1) parser.remove_property("bike") parser.write("file.ini") parser.read_file("file.ini") print(parser) ``` or ```py import iniparser2 parser = iniparser2.INI(convert_property=True) parser.read_file("file.ini") parser["car"] += 1 del parser["bike"] parser.write("file.ini") parser.read_file("file.ini") print(parser) ``` ### Exceptions exceptions because why not - base exception - `ParsingError` - `ParseSectionError` - `ParsePropertyError` - `ParseDuplicateError` - something else - `DuplicateError` - `PropertyError` - `SectionError` %prep %autosetup -n iniparser2-3.0.0 %build %py3_build %install %py3_install install -d -m755 %{buildroot}/%{_pkgdocdir} if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi pushd %{buildroot} if [ -d usr/lib ]; then find usr/lib -type f -printf "\"/%h/%f\"\n" >> filelist.lst fi if [ -d usr/lib64 ]; then find usr/lib64 -type f -printf "\"/%h/%f\"\n" >> filelist.lst fi if [ -d usr/bin ]; then find usr/bin -type f -printf "\"/%h/%f\"\n" >> filelist.lst fi if [ -d usr/sbin ]; then find usr/sbin -type f -printf "\"/%h/%f\"\n" >> filelist.lst fi touch doclist.lst if [ -d usr/share/man ]; then find usr/share/man -type f -printf "\"/%h/%f.gz\"\n" >> doclist.lst fi popd mv %{buildroot}/filelist.lst . mv %{buildroot}/doclist.lst . %files -n python3-iniparser2 -f filelist.lst %dir %{python3_sitelib}/* %files help -f doclist.lst %{_docdir}/* %changelog * Fri Jun 09 2023 Python_Bot - 3.0.0-1 - Package Spec generated