diff options
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | python-enrich.spec | 283 | ||||
| -rw-r--r-- | sources | 1 |
3 files changed, 285 insertions, 0 deletions
@@ -0,0 +1 @@ +/enrich-1.2.7.tar.gz diff --git a/python-enrich.spec b/python-enrich.spec new file mode 100644 index 0000000..550c966 --- /dev/null +++ b/python-enrich.spec @@ -0,0 +1,283 @@ +%global _empty_manifest_terminate_build 0 +Name: python-enrich +Version: 1.2.7 +Release: 1 +Summary: enrich +License: MIT +URL: https://github.com/pycontribs/enrich +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/bb/77/cb9b3d6f2e2e5f8104e907ea4c4d575267238f52c51cf9f864b865a99710/enrich-1.2.7.tar.gz +BuildArch: noarch + +Requires: python3-rich +Requires: python3-mock +Requires: python3-pytest-cov +Requires: python3-pytest-mock +Requires: python3-pytest-plus +Requires: python3-pytest-xdist +Requires: python3-pytest + +%description +# enrich + +Enriched extends [rich](https://pypi.org/project/rich/) library functionality +with a set of changes that were not accepted to rich itself. + +## Console with redirect support + +Our Console class adds one additional option to rich.Console in order to +redirect `sys.stdout` and `sys.stderr` streams using a FileProxy. + +```python +from enrich.console import Console +import sys + +console = Console( + redirect=True, # <-- not supported by rich.cosole.Console + record=True) +sys.write("foo") + +# this assert would have passed without redirect=True +assert console.export_text() == "foo" +``` + +## Console with implicit soft wrapping + +If you want to produce fluid terminal output, one where the client terminal +decides where to wrap the text instead of the application, you can now +tell the Console constructor the soft_wrap preference. + +```python +from enrich.console import Console +import sys + +console = Console(soft_wrap=True) +console.print(...) # no longer need to pass soft_wrap to each print +``` + +## Console.print can also deal with ANSI escapes + +Extends Rich Console to detect if original text already had ANSI escapes and +decodes it before processing it. This solves the case where printing +output captured from other processes that contained ANSI escapes would brake. +[upstream-404](https://github.com/willmcgugan/rich/discussions/404) + +## Soft-wrapping logger + +Rich logger assumes that you always have a fixed width console and it does +wrap logged output according to it. Our alternative logger does exactly the +opposite: it ignores the columns of the current console and prints output +using a Console with soft wrapping enabled. + +The result are logged lines that can be displayed on any terminal or web +page as they will allow the client to decide when to perform the wrapping. + +```python +import logging +from enrich.logging import RichHandler + +FORMAT = "%(message)s" +logging.basicConfig( + level="NOTSET", format=FORMAT, datefmt="[%X]", handlers=[RichHandler()] +) + +log = logging.getLogger("rich") +log.info("Text that we do not want pre-wrapped by logger: %s", 100 * "x") +``` + + + + +%package -n python3-enrich +Summary: enrich +Provides: python-enrich +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-enrich +# enrich + +Enriched extends [rich](https://pypi.org/project/rich/) library functionality +with a set of changes that were not accepted to rich itself. + +## Console with redirect support + +Our Console class adds one additional option to rich.Console in order to +redirect `sys.stdout` and `sys.stderr` streams using a FileProxy. + +```python +from enrich.console import Console +import sys + +console = Console( + redirect=True, # <-- not supported by rich.cosole.Console + record=True) +sys.write("foo") + +# this assert would have passed without redirect=True +assert console.export_text() == "foo" +``` + +## Console with implicit soft wrapping + +If you want to produce fluid terminal output, one where the client terminal +decides where to wrap the text instead of the application, you can now +tell the Console constructor the soft_wrap preference. + +```python +from enrich.console import Console +import sys + +console = Console(soft_wrap=True) +console.print(...) # no longer need to pass soft_wrap to each print +``` + +## Console.print can also deal with ANSI escapes + +Extends Rich Console to detect if original text already had ANSI escapes and +decodes it before processing it. This solves the case where printing +output captured from other processes that contained ANSI escapes would brake. +[upstream-404](https://github.com/willmcgugan/rich/discussions/404) + +## Soft-wrapping logger + +Rich logger assumes that you always have a fixed width console and it does +wrap logged output according to it. Our alternative logger does exactly the +opposite: it ignores the columns of the current console and prints output +using a Console with soft wrapping enabled. + +The result are logged lines that can be displayed on any terminal or web +page as they will allow the client to decide when to perform the wrapping. + +```python +import logging +from enrich.logging import RichHandler + +FORMAT = "%(message)s" +logging.basicConfig( + level="NOTSET", format=FORMAT, datefmt="[%X]", handlers=[RichHandler()] +) + +log = logging.getLogger("rich") +log.info("Text that we do not want pre-wrapped by logger: %s", 100 * "x") +``` + + + + +%package help +Summary: Development documents and examples for enrich +Provides: python3-enrich-doc +%description help +# enrich + +Enriched extends [rich](https://pypi.org/project/rich/) library functionality +with a set of changes that were not accepted to rich itself. + +## Console with redirect support + +Our Console class adds one additional option to rich.Console in order to +redirect `sys.stdout` and `sys.stderr` streams using a FileProxy. + +```python +from enrich.console import Console +import sys + +console = Console( + redirect=True, # <-- not supported by rich.cosole.Console + record=True) +sys.write("foo") + +# this assert would have passed without redirect=True +assert console.export_text() == "foo" +``` + +## Console with implicit soft wrapping + +If you want to produce fluid terminal output, one where the client terminal +decides where to wrap the text instead of the application, you can now +tell the Console constructor the soft_wrap preference. + +```python +from enrich.console import Console +import sys + +console = Console(soft_wrap=True) +console.print(...) # no longer need to pass soft_wrap to each print +``` + +## Console.print can also deal with ANSI escapes + +Extends Rich Console to detect if original text already had ANSI escapes and +decodes it before processing it. This solves the case where printing +output captured from other processes that contained ANSI escapes would brake. +[upstream-404](https://github.com/willmcgugan/rich/discussions/404) + +## Soft-wrapping logger + +Rich logger assumes that you always have a fixed width console and it does +wrap logged output according to it. Our alternative logger does exactly the +opposite: it ignores the columns of the current console and prints output +using a Console with soft wrapping enabled. + +The result are logged lines that can be displayed on any terminal or web +page as they will allow the client to decide when to perform the wrapping. + +```python +import logging +from enrich.logging import RichHandler + +FORMAT = "%(message)s" +logging.basicConfig( + level="NOTSET", format=FORMAT, datefmt="[%X]", handlers=[RichHandler()] +) + +log = logging.getLogger("rich") +log.info("Text that we do not want pre-wrapped by logger: %s", 100 * "x") +``` + + + + +%prep +%autosetup -n enrich-1.2.7 + +%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-enrich -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Mon Apr 10 2023 Python_Bot <Python_Bot@openeuler.org> - 1.2.7-1 +- Package Spec generated @@ -0,0 +1 @@ +272588dcb826a71e1745596514c11354 enrich-1.2.7.tar.gz |
