diff options
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | python-ustache.spec | 513 | ||||
| -rw-r--r-- | sources | 1 |
3 files changed, 515 insertions, 0 deletions
@@ -0,0 +1 @@ +/ustache-0.1.5.tar.gz diff --git a/python-ustache.spec b/python-ustache.spec new file mode 100644 index 0000000..2f58e37 --- /dev/null +++ b/python-ustache.spec @@ -0,0 +1,513 @@ +%global _empty_manifest_terminate_build 0 +Name: python-ustache +Version: 0.1.5 +Release: 1 +Summary: ustache, Mustache for Python +License: MIT +URL: https://gitlab.com/ergoithz/ustache +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/d2/78/8ded586be90aca0bbdc939654648046575067affcf82c649b06ec21f7b5c/ustache-0.1.5.tar.gz +BuildArch: noarch + +Requires: python3-chevron +Requires: python3-flake8 +Requires: python3-flake8-blind-except +Requires: python3-flake8-bugbear +Requires: python3-flake8-builtins +Requires: python3-flake8-commas +Requires: python3-flake8-docstrings +Requires: python3-flake8-import-order +Requires: python3-flake8-logging-format +Requires: python3-flake8-rst-docstrings +Requires: python3-flake8-simplify +Requires: python3-mypy +Requires: python3-coverage +Requires: python3-recommonmark +Requires: python3-sphinx +Requires: python3-sphinx-autodoc-typehints +Requires: python3-xxhash +Requires: python3-wheel +Requires: python3-twine +Requires: python3-coverage +Requires: python3-xxhash + +%description +# ustache + +Mustache for Python. + +Documentation: [ustache.readthedocs.io](https://ustache.readthedocs.io) + +## Installation + +```python +pip install ustache +``` + +## Usage + +Python: + +```python +import ustache + +print(ustache.render('Hello {{v}}', {'v': 'World!'})) +# Hello World! +``` + +Command line: + +```sh +$ ustache -j data.json -o output.html template.mustache +``` + +## Highlights + +- The fastest pure-python Mustache implementation to this date. +- Command line interface. +- Spec compliant, but also highly compatible with `Mustache.js`. +- Small codebase, efficiently rendering to `str` or `bytes`, + supporting streaming. +- Customizable (property getter, partial resolver, and stringify, escape + and lambda render functions). +- Customizable template caching, with an optional memory-efficient mode + (see [xxhash optional dependency below](#xxhash)). +- No dynamic code generation, jit and transpiler friendly. + +## Considerations + +For inter-compatibility with JavaScript (especially `Mustache.js`, enabling +client-side rendering with the same templates), **ustache** exposes some +atypical behavior: + +- Mustache blocks stick to JavaScript falseness (`__bool__` is not honored): + `None`, `False`, `0`, `nan`, and empty sequences (including strings) + are taken as falsy, while everything else (including empty mappings) will + be considered truthy (`Mustache.js` `Boolean` and empty `Array` handling). +- Mustache blocks receiving any iterable other than mappings and strings + will result on a loop (`Mustache.js` `Array` handling). +- Non-mapping sized objects will expose a virtual `length` property + (JavaScript `Array.length` emulation). + Customizable via `getter` parameter. +- Mapping keys containing dot (`.`) or whitespace (` `) are unreachable, + (`Mustache.js` property name limitation). + Customizable via `getter` parameter. +- Sequence elements are accessible by positive index in the same way mapping + integer-keyed items are also accessible when no string key conflicts, as + properties (JavaScript `Object` emulation). + Customizable via `getter` parameter. + +## Optional dependencies + +For minimalism and portability, **ustache** has no hard dependencies, while +still supporting some libraries for added functionality: + +- <a id="xxhash"></a>[xxhash](https://pypi.org/project/xxhash) + will be used, if available, to avoid storing the whole template data as + part of the template cache, dramatically reducing its memory footprint in + many situations. + +Optional but generally recommended dependencies can be easily installed +all at once using **ustache** `optional` extra target: + +```sh +$ pip install ustache[optional] +``` + +## Syntax + +Check out the [mustache(5) manual](https://mustache.github.io/mustache.5.html). + +For quick reference, here is a quick overview of the Mustache syntax. + +Template (`template.mustache`): +```handlebars +{{!comment}} +<ul> +{{#object}}<li>{{property}}</li>{{/object}} +{{^object}}<li>As <b>object</b> is truthy, this won't be shown</li>{{/object}} +{{^null}}<li><b>null</b> is falsy</li>{{/null}} +{{#array}}<li>{{property}}</li> +{{/array}} +{{^array}}<li>Array isn't empty, this won't be shown.</li>{{/array}} +{{#empty_array}}<li>Empty Array, this won't be shown</li>{{/empty_array}} +{{^empty_array}}<li>empty_array is empty</li>{{/empty_array}} +{{&unescaped_html}} +</ul> +``` + +Data (`data.json`): +```json +{ + "object": { + "property": "Object property value" + }, + "null": null, + "array": [ + {"property": "Array item1 property"}, + {"property": "Array item2 property"}, + {"property": "Array item3 property"} + ], + "empty_array": [], + "unescaped_html": "<li>this is unescaped html</li>" +} +``` + +Command: +```sh +$ ustache -j data.json -o output.html template.mustache +``` + +Output: +```html +<ul> +<li>Object property value</li> +<li><b>null</b> is falsy</li> +<li>Array item1 property</li> +<li>Array item2 property</li> +<li>Array item3 property</li> +<li>empty_array is empty</li> +<li>this is unescaped html</li> +</ul> +``` + + + + +%package -n python3-ustache +Summary: ustache, Mustache for Python +Provides: python-ustache +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-ustache +# ustache + +Mustache for Python. + +Documentation: [ustache.readthedocs.io](https://ustache.readthedocs.io) + +## Installation + +```python +pip install ustache +``` + +## Usage + +Python: + +```python +import ustache + +print(ustache.render('Hello {{v}}', {'v': 'World!'})) +# Hello World! +``` + +Command line: + +```sh +$ ustache -j data.json -o output.html template.mustache +``` + +## Highlights + +- The fastest pure-python Mustache implementation to this date. +- Command line interface. +- Spec compliant, but also highly compatible with `Mustache.js`. +- Small codebase, efficiently rendering to `str` or `bytes`, + supporting streaming. +- Customizable (property getter, partial resolver, and stringify, escape + and lambda render functions). +- Customizable template caching, with an optional memory-efficient mode + (see [xxhash optional dependency below](#xxhash)). +- No dynamic code generation, jit and transpiler friendly. + +## Considerations + +For inter-compatibility with JavaScript (especially `Mustache.js`, enabling +client-side rendering with the same templates), **ustache** exposes some +atypical behavior: + +- Mustache blocks stick to JavaScript falseness (`__bool__` is not honored): + `None`, `False`, `0`, `nan`, and empty sequences (including strings) + are taken as falsy, while everything else (including empty mappings) will + be considered truthy (`Mustache.js` `Boolean` and empty `Array` handling). +- Mustache blocks receiving any iterable other than mappings and strings + will result on a loop (`Mustache.js` `Array` handling). +- Non-mapping sized objects will expose a virtual `length` property + (JavaScript `Array.length` emulation). + Customizable via `getter` parameter. +- Mapping keys containing dot (`.`) or whitespace (` `) are unreachable, + (`Mustache.js` property name limitation). + Customizable via `getter` parameter. +- Sequence elements are accessible by positive index in the same way mapping + integer-keyed items are also accessible when no string key conflicts, as + properties (JavaScript `Object` emulation). + Customizable via `getter` parameter. + +## Optional dependencies + +For minimalism and portability, **ustache** has no hard dependencies, while +still supporting some libraries for added functionality: + +- <a id="xxhash"></a>[xxhash](https://pypi.org/project/xxhash) + will be used, if available, to avoid storing the whole template data as + part of the template cache, dramatically reducing its memory footprint in + many situations. + +Optional but generally recommended dependencies can be easily installed +all at once using **ustache** `optional` extra target: + +```sh +$ pip install ustache[optional] +``` + +## Syntax + +Check out the [mustache(5) manual](https://mustache.github.io/mustache.5.html). + +For quick reference, here is a quick overview of the Mustache syntax. + +Template (`template.mustache`): +```handlebars +{{!comment}} +<ul> +{{#object}}<li>{{property}}</li>{{/object}} +{{^object}}<li>As <b>object</b> is truthy, this won't be shown</li>{{/object}} +{{^null}}<li><b>null</b> is falsy</li>{{/null}} +{{#array}}<li>{{property}}</li> +{{/array}} +{{^array}}<li>Array isn't empty, this won't be shown.</li>{{/array}} +{{#empty_array}}<li>Empty Array, this won't be shown</li>{{/empty_array}} +{{^empty_array}}<li>empty_array is empty</li>{{/empty_array}} +{{&unescaped_html}} +</ul> +``` + +Data (`data.json`): +```json +{ + "object": { + "property": "Object property value" + }, + "null": null, + "array": [ + {"property": "Array item1 property"}, + {"property": "Array item2 property"}, + {"property": "Array item3 property"} + ], + "empty_array": [], + "unescaped_html": "<li>this is unescaped html</li>" +} +``` + +Command: +```sh +$ ustache -j data.json -o output.html template.mustache +``` + +Output: +```html +<ul> +<li>Object property value</li> +<li><b>null</b> is falsy</li> +<li>Array item1 property</li> +<li>Array item2 property</li> +<li>Array item3 property</li> +<li>empty_array is empty</li> +<li>this is unescaped html</li> +</ul> +``` + + + + +%package help +Summary: Development documents and examples for ustache +Provides: python3-ustache-doc +%description help +# ustache + +Mustache for Python. + +Documentation: [ustache.readthedocs.io](https://ustache.readthedocs.io) + +## Installation + +```python +pip install ustache +``` + +## Usage + +Python: + +```python +import ustache + +print(ustache.render('Hello {{v}}', {'v': 'World!'})) +# Hello World! +``` + +Command line: + +```sh +$ ustache -j data.json -o output.html template.mustache +``` + +## Highlights + +- The fastest pure-python Mustache implementation to this date. +- Command line interface. +- Spec compliant, but also highly compatible with `Mustache.js`. +- Small codebase, efficiently rendering to `str` or `bytes`, + supporting streaming. +- Customizable (property getter, partial resolver, and stringify, escape + and lambda render functions). +- Customizable template caching, with an optional memory-efficient mode + (see [xxhash optional dependency below](#xxhash)). +- No dynamic code generation, jit and transpiler friendly. + +## Considerations + +For inter-compatibility with JavaScript (especially `Mustache.js`, enabling +client-side rendering with the same templates), **ustache** exposes some +atypical behavior: + +- Mustache blocks stick to JavaScript falseness (`__bool__` is not honored): + `None`, `False`, `0`, `nan`, and empty sequences (including strings) + are taken as falsy, while everything else (including empty mappings) will + be considered truthy (`Mustache.js` `Boolean` and empty `Array` handling). +- Mustache blocks receiving any iterable other than mappings and strings + will result on a loop (`Mustache.js` `Array` handling). +- Non-mapping sized objects will expose a virtual `length` property + (JavaScript `Array.length` emulation). + Customizable via `getter` parameter. +- Mapping keys containing dot (`.`) or whitespace (` `) are unreachable, + (`Mustache.js` property name limitation). + Customizable via `getter` parameter. +- Sequence elements are accessible by positive index in the same way mapping + integer-keyed items are also accessible when no string key conflicts, as + properties (JavaScript `Object` emulation). + Customizable via `getter` parameter. + +## Optional dependencies + +For minimalism and portability, **ustache** has no hard dependencies, while +still supporting some libraries for added functionality: + +- <a id="xxhash"></a>[xxhash](https://pypi.org/project/xxhash) + will be used, if available, to avoid storing the whole template data as + part of the template cache, dramatically reducing its memory footprint in + many situations. + +Optional but generally recommended dependencies can be easily installed +all at once using **ustache** `optional` extra target: + +```sh +$ pip install ustache[optional] +``` + +## Syntax + +Check out the [mustache(5) manual](https://mustache.github.io/mustache.5.html). + +For quick reference, here is a quick overview of the Mustache syntax. + +Template (`template.mustache`): +```handlebars +{{!comment}} +<ul> +{{#object}}<li>{{property}}</li>{{/object}} +{{^object}}<li>As <b>object</b> is truthy, this won't be shown</li>{{/object}} +{{^null}}<li><b>null</b> is falsy</li>{{/null}} +{{#array}}<li>{{property}}</li> +{{/array}} +{{^array}}<li>Array isn't empty, this won't be shown.</li>{{/array}} +{{#empty_array}}<li>Empty Array, this won't be shown</li>{{/empty_array}} +{{^empty_array}}<li>empty_array is empty</li>{{/empty_array}} +{{&unescaped_html}} +</ul> +``` + +Data (`data.json`): +```json +{ + "object": { + "property": "Object property value" + }, + "null": null, + "array": [ + {"property": "Array item1 property"}, + {"property": "Array item2 property"}, + {"property": "Array item3 property"} + ], + "empty_array": [], + "unescaped_html": "<li>this is unescaped html</li>" +} +``` + +Command: +```sh +$ ustache -j data.json -o output.html template.mustache +``` + +Output: +```html +<ul> +<li>Object property value</li> +<li><b>null</b> is falsy</li> +<li>Array item1 property</li> +<li>Array item2 property</li> +<li>Array item3 property</li> +<li>empty_array is empty</li> +<li>this is unescaped html</li> +</ul> +``` + + + + +%prep +%autosetup -n ustache-0.1.5 + +%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-ustache -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Mon May 29 2023 Python_Bot <Python_Bot@openeuler.org> - 0.1.5-1 +- Package Spec generated @@ -0,0 +1 @@ +09669d65fb3f88eb11201bb9fb1d3d7c ustache-0.1.5.tar.gz |
