From c6e0db63569a3bdc47b9375857d2944566f2d267 Mon Sep 17 00:00:00 2001 From: CoprDistGit Date: Wed, 31 May 2023 03:36:05 +0000 Subject: automatic import of python-iniparser2 --- .gitignore | 1 + python-iniparser2.spec | 333 +++++++++++++++++++++++++++++++++++++++++++++++++ sources | 1 + 3 files changed, 335 insertions(+) create mode 100644 python-iniparser2.spec create mode 100644 sources diff --git a/.gitignore b/.gitignore index e69de29..89dc0c4 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +/iniparser2-3.0.0.tar.gz diff --git a/python-iniparser2.spec b/python-iniparser2.spec new file mode 100644 index 0000000..d2b83e6 --- /dev/null +++ b/python-iniparser2.spec @@ -0,0 +1,333 @@ +%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.nju.edu.cn/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 +* Wed May 31 2023 Python_Bot - 3.0.0-1 +- Package Spec generated diff --git a/sources b/sources new file mode 100644 index 0000000..48a6110 --- /dev/null +++ b/sources @@ -0,0 +1 @@ +716a07fcda574d7b65cf1e0b58529e3f iniparser2-3.0.0.tar.gz -- cgit v1.2.3