diff options
Diffstat (limited to 'python-crudini.spec')
| -rw-r--r-- | python-crudini.spec | 421 |
1 files changed, 421 insertions, 0 deletions
diff --git a/python-crudini.spec b/python-crudini.spec new file mode 100644 index 0000000..b3e7323 --- /dev/null +++ b/python-crudini.spec @@ -0,0 +1,421 @@ +%global _empty_manifest_terminate_build 0 +Name: python-crudini +Version: 0.9.4 +Release: 1 +Summary: A utility for manipulating ini files +License: GPLv2 +URL: http://github.com/pixelb/crudini +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/ec/40/9bd5195e07dd521d852c021a18b0388fe1672240d7f70aaa8800154462fe/crudini-0.9.4.tar.gz +BuildArch: noarch + +Requires: python3-iniparse + +%description +# crudini - A utility for manipulating ini files + +## Usage: +``` +crudini --set [OPTION]... config_file section [param] [value] +crudini --get [OPTION]... config_file [section] [param] +crudini --del [OPTION]... config_file section [param] [list value] +crudini --merge [OPTION]... config_file [section] + +SECTION can be empty ("") or "DEFAULT" in which case, +params not in a section, i.e. global parameters are operated on. +If 'DEFAULT' is used with --set, an explicit [DEFAULT] section is added. + +``` +## Options: +``` + + --existing[=WHAT] For --set, --del and --merge, fail if item is missing, + where WHAT is 'file', 'section', or 'param', + or if WHAT not specified; all specified items. + --format=FMT For --get, select the output FMT. + Formats are 'sh','ini','lines' + --ini-options=OPT Set options for handling ini files. Options are: + 'nospace': use format name=value not name = value + --inplace Lock and write files in place. + This is not atomic but has less restrictions + than the default replacement method. + --list For --set and --del, update a list (set) of values + --list-sep=STR Delimit list values with "STR" instead of " ,". + An empty STR means any whitespace is a delimiter. + --output=FILE Write output to FILE instead. '-' means stdout + --verbose Indicate on stderr if changes were made + --help Write this help to stdout + --version Write version to stdout + +``` +## Examples: +``` + +# Add/Update a var + crudini --set config_file section parameter value + +# Add/Update a var in the root or global area. +# I.e. that's not under a [section]. + crudini --set config_file "" parameter value + +# Update an existing var + crudini --set --existing config_file section parameter value + +# Add/Append a value to a comma separated list +# Note any whitespace around commas is ignored + crudini --set --list config_file section parameter a_value + +# Add/Append a value to a whitespace separated list +# Note multiline lists are supported (as newline is whitespace) + crudini --set --list --list-sep= config_file section parameter a_value + +# Delete a var + crudini --del config_file section parameter + +# Delete a section + crudini --del config_file section + +# output a value + crudini --get config_file section parameter + +# output a global value not in a section + crudini --get config_file "" parameter + +# output a section + crudini --get config_file section + +# output a section, parseable by shell + eval "$(crudini --get --format=sh config_file section)" + +# update an ini file from shell variable(s) + echo name="$name" | crudini --merge config_file section + +# merge an ini file from another ini + crudini --merge config_file < another.ini + +# compare two ini files using standard UNIX text processing + diff <(crudini --get --format=lines file1.ini|sort) \ + <(crudini --get --format=lines file2.ini|sort) + +# Rewrite ini file to use name=value format rather than name = value + crudini --ini-options=nospace --set config_file "" + +# Add/Update a var, ensuring complete file in name=value format + crudini --ini-options=nospace --set config_file section parameter value +``` +## Installation + +On windows ensure a python interpreter is installed. +For example installing from https://www.python.org/downloads/ +will put the py launcher and pip in the PATH. + +Then ensure the iniparse module is installed by +running the following from a "cmd" prompt: + +``` +pip install iniparse +``` + +Then crudini can be invoked by downloading just the crudini.py +file and running like: + +``` +py crudini.py --help +``` + +On Linux systems crudini is generally available from your standard +package manager, and installing will also ensure the iniparse +dependency is appropriately installed on your system. +You can also download and run the single crudini.py file directly +to use latest version. + + +%package -n python3-crudini +Summary: A utility for manipulating ini files +Provides: python-crudini +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-crudini +# crudini - A utility for manipulating ini files + +## Usage: +``` +crudini --set [OPTION]... config_file section [param] [value] +crudini --get [OPTION]... config_file [section] [param] +crudini --del [OPTION]... config_file section [param] [list value] +crudini --merge [OPTION]... config_file [section] + +SECTION can be empty ("") or "DEFAULT" in which case, +params not in a section, i.e. global parameters are operated on. +If 'DEFAULT' is used with --set, an explicit [DEFAULT] section is added. + +``` +## Options: +``` + + --existing[=WHAT] For --set, --del and --merge, fail if item is missing, + where WHAT is 'file', 'section', or 'param', + or if WHAT not specified; all specified items. + --format=FMT For --get, select the output FMT. + Formats are 'sh','ini','lines' + --ini-options=OPT Set options for handling ini files. Options are: + 'nospace': use format name=value not name = value + --inplace Lock and write files in place. + This is not atomic but has less restrictions + than the default replacement method. + --list For --set and --del, update a list (set) of values + --list-sep=STR Delimit list values with "STR" instead of " ,". + An empty STR means any whitespace is a delimiter. + --output=FILE Write output to FILE instead. '-' means stdout + --verbose Indicate on stderr if changes were made + --help Write this help to stdout + --version Write version to stdout + +``` +## Examples: +``` + +# Add/Update a var + crudini --set config_file section parameter value + +# Add/Update a var in the root or global area. +# I.e. that's not under a [section]. + crudini --set config_file "" parameter value + +# Update an existing var + crudini --set --existing config_file section parameter value + +# Add/Append a value to a comma separated list +# Note any whitespace around commas is ignored + crudini --set --list config_file section parameter a_value + +# Add/Append a value to a whitespace separated list +# Note multiline lists are supported (as newline is whitespace) + crudini --set --list --list-sep= config_file section parameter a_value + +# Delete a var + crudini --del config_file section parameter + +# Delete a section + crudini --del config_file section + +# output a value + crudini --get config_file section parameter + +# output a global value not in a section + crudini --get config_file "" parameter + +# output a section + crudini --get config_file section + +# output a section, parseable by shell + eval "$(crudini --get --format=sh config_file section)" + +# update an ini file from shell variable(s) + echo name="$name" | crudini --merge config_file section + +# merge an ini file from another ini + crudini --merge config_file < another.ini + +# compare two ini files using standard UNIX text processing + diff <(crudini --get --format=lines file1.ini|sort) \ + <(crudini --get --format=lines file2.ini|sort) + +# Rewrite ini file to use name=value format rather than name = value + crudini --ini-options=nospace --set config_file "" + +# Add/Update a var, ensuring complete file in name=value format + crudini --ini-options=nospace --set config_file section parameter value +``` +## Installation + +On windows ensure a python interpreter is installed. +For example installing from https://www.python.org/downloads/ +will put the py launcher and pip in the PATH. + +Then ensure the iniparse module is installed by +running the following from a "cmd" prompt: + +``` +pip install iniparse +``` + +Then crudini can be invoked by downloading just the crudini.py +file and running like: + +``` +py crudini.py --help +``` + +On Linux systems crudini is generally available from your standard +package manager, and installing will also ensure the iniparse +dependency is appropriately installed on your system. +You can also download and run the single crudini.py file directly +to use latest version. + + +%package help +Summary: Development documents and examples for crudini +Provides: python3-crudini-doc +%description help +# crudini - A utility for manipulating ini files + +## Usage: +``` +crudini --set [OPTION]... config_file section [param] [value] +crudini --get [OPTION]... config_file [section] [param] +crudini --del [OPTION]... config_file section [param] [list value] +crudini --merge [OPTION]... config_file [section] + +SECTION can be empty ("") or "DEFAULT" in which case, +params not in a section, i.e. global parameters are operated on. +If 'DEFAULT' is used with --set, an explicit [DEFAULT] section is added. + +``` +## Options: +``` + + --existing[=WHAT] For --set, --del and --merge, fail if item is missing, + where WHAT is 'file', 'section', or 'param', + or if WHAT not specified; all specified items. + --format=FMT For --get, select the output FMT. + Formats are 'sh','ini','lines' + --ini-options=OPT Set options for handling ini files. Options are: + 'nospace': use format name=value not name = value + --inplace Lock and write files in place. + This is not atomic but has less restrictions + than the default replacement method. + --list For --set and --del, update a list (set) of values + --list-sep=STR Delimit list values with "STR" instead of " ,". + An empty STR means any whitespace is a delimiter. + --output=FILE Write output to FILE instead. '-' means stdout + --verbose Indicate on stderr if changes were made + --help Write this help to stdout + --version Write version to stdout + +``` +## Examples: +``` + +# Add/Update a var + crudini --set config_file section parameter value + +# Add/Update a var in the root or global area. +# I.e. that's not under a [section]. + crudini --set config_file "" parameter value + +# Update an existing var + crudini --set --existing config_file section parameter value + +# Add/Append a value to a comma separated list +# Note any whitespace around commas is ignored + crudini --set --list config_file section parameter a_value + +# Add/Append a value to a whitespace separated list +# Note multiline lists are supported (as newline is whitespace) + crudini --set --list --list-sep= config_file section parameter a_value + +# Delete a var + crudini --del config_file section parameter + +# Delete a section + crudini --del config_file section + +# output a value + crudini --get config_file section parameter + +# output a global value not in a section + crudini --get config_file "" parameter + +# output a section + crudini --get config_file section + +# output a section, parseable by shell + eval "$(crudini --get --format=sh config_file section)" + +# update an ini file from shell variable(s) + echo name="$name" | crudini --merge config_file section + +# merge an ini file from another ini + crudini --merge config_file < another.ini + +# compare two ini files using standard UNIX text processing + diff <(crudini --get --format=lines file1.ini|sort) \ + <(crudini --get --format=lines file2.ini|sort) + +# Rewrite ini file to use name=value format rather than name = value + crudini --ini-options=nospace --set config_file "" + +# Add/Update a var, ensuring complete file in name=value format + crudini --ini-options=nospace --set config_file section parameter value +``` +## Installation + +On windows ensure a python interpreter is installed. +For example installing from https://www.python.org/downloads/ +will put the py launcher and pip in the PATH. + +Then ensure the iniparse module is installed by +running the following from a "cmd" prompt: + +``` +pip install iniparse +``` + +Then crudini can be invoked by downloading just the crudini.py +file and running like: + +``` +py crudini.py --help +``` + +On Linux systems crudini is generally available from your standard +package manager, and installing will also ensure the iniparse +dependency is appropriately installed on your system. +You can also download and run the single crudini.py file directly +to use latest version. + + +%prep +%autosetup -n crudini-0.9.4 + +%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-crudini -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Wed Apr 12 2023 Python_Bot <Python_Bot@openeuler.org> - 0.9.4-1 +- Package Spec generated |
