diff options
author | CoprDistGit <infra@openeuler.org> | 2023-04-11 20:52:07 +0000 |
---|---|---|
committer | CoprDistGit <infra@openeuler.org> | 2023-04-11 20:52:07 +0000 |
commit | edf3572fa250caef8aabf1404d2ed49579f521c9 (patch) | |
tree | 0f84b7459324c174e83055468b0adadc371e5450 | |
parent | 0fb04a05a8f512d49819480c7e0b71aa08271b3b (diff) |
automatic import of python-striprtf
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | python-striprtf.spec | 240 | ||||
-rw-r--r-- | sources | 1 |
3 files changed, 242 insertions, 0 deletions
@@ -0,0 +1 @@ +/striprtf-0.0.22.tar.gz diff --git a/python-striprtf.spec b/python-striprtf.spec new file mode 100644 index 0000000..0b875ba --- /dev/null +++ b/python-striprtf.spec @@ -0,0 +1,240 @@ +%global _empty_manifest_terminate_build 0 +Name: python-striprtf +Version: 0.0.22 +Release: 1 +Summary: A simple library to convert rtf to text +License: BSD-3-Clause +URL: https://github.com/joshy/striprtf +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/50/1f/61964db845c7e7720982556adcae899e2f54b7eb1a90ff3a2b0d4feabc2a/striprtf-0.0.22.tar.gz +BuildArch: noarch + + +%description +# striprtf + + +## Purpose +This is a simple library to convert rtf files to python strings. A lot of +medical documents are written in rtf format which is not ideal for parsing +and further processing. This library converts it to plain old text. + +## How to use +```python +from striprtf.striprtf import rtf_to_text +rtf = "some rtf encoded string" +text = rtf_to_text(rtf) +print(text) +``` + +If you want to use a different encoding than `utf-8` to can pass the parameter `encoding`. +```python +from striprtf.striprtf import rtf_to_text +rtf = "some rtf encoded string in latin1" +text = rtf_to_text(rtf, encoding="latin-1") +print(text) +``` + +Sometimes UnicodeDecodingErrors can happen because of various reasons. +In this case you can try to relax the encoding process like this: +```python +from striprtf.striprtf import rtf_to_text +rtf = "some rtf encoded string" +text = rtf_to_text(rtf, errors="ignore") +print(text) +``` + +## How to use online +If you don't want to install, there is also an online version available at https://striprtf.dev which can be used for free. + + +## History +[Pyth](https://github.com/brendonh/pyth) was not working for the rtf files I +had. The next best thing was this gist: +https://gist.github.com/gilsondev/7c1d2d753ddb522e7bc22511cfb08676 + +Very few additions where made, e.g. better formatting of tables. + +## Pushing to PyPi + * pip install twine + + +Run commands +``` +python setup.py sdist bdist_wheel +twine upload -r testpypi dist/* +twine upload -r pypi dist/* +``` + + + + +%package -n python3-striprtf +Summary: A simple library to convert rtf to text +Provides: python-striprtf +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-striprtf +# striprtf + + +## Purpose +This is a simple library to convert rtf files to python strings. A lot of +medical documents are written in rtf format which is not ideal for parsing +and further processing. This library converts it to plain old text. + +## How to use +```python +from striprtf.striprtf import rtf_to_text +rtf = "some rtf encoded string" +text = rtf_to_text(rtf) +print(text) +``` + +If you want to use a different encoding than `utf-8` to can pass the parameter `encoding`. +```python +from striprtf.striprtf import rtf_to_text +rtf = "some rtf encoded string in latin1" +text = rtf_to_text(rtf, encoding="latin-1") +print(text) +``` + +Sometimes UnicodeDecodingErrors can happen because of various reasons. +In this case you can try to relax the encoding process like this: +```python +from striprtf.striprtf import rtf_to_text +rtf = "some rtf encoded string" +text = rtf_to_text(rtf, errors="ignore") +print(text) +``` + +## How to use online +If you don't want to install, there is also an online version available at https://striprtf.dev which can be used for free. + + +## History +[Pyth](https://github.com/brendonh/pyth) was not working for the rtf files I +had. The next best thing was this gist: +https://gist.github.com/gilsondev/7c1d2d753ddb522e7bc22511cfb08676 + +Very few additions where made, e.g. better formatting of tables. + +## Pushing to PyPi + * pip install twine + + +Run commands +``` +python setup.py sdist bdist_wheel +twine upload -r testpypi dist/* +twine upload -r pypi dist/* +``` + + + + +%package help +Summary: Development documents and examples for striprtf +Provides: python3-striprtf-doc +%description help +# striprtf + + +## Purpose +This is a simple library to convert rtf files to python strings. A lot of +medical documents are written in rtf format which is not ideal for parsing +and further processing. This library converts it to plain old text. + +## How to use +```python +from striprtf.striprtf import rtf_to_text +rtf = "some rtf encoded string" +text = rtf_to_text(rtf) +print(text) +``` + +If you want to use a different encoding than `utf-8` to can pass the parameter `encoding`. +```python +from striprtf.striprtf import rtf_to_text +rtf = "some rtf encoded string in latin1" +text = rtf_to_text(rtf, encoding="latin-1") +print(text) +``` + +Sometimes UnicodeDecodingErrors can happen because of various reasons. +In this case you can try to relax the encoding process like this: +```python +from striprtf.striprtf import rtf_to_text +rtf = "some rtf encoded string" +text = rtf_to_text(rtf, errors="ignore") +print(text) +``` + +## How to use online +If you don't want to install, there is also an online version available at https://striprtf.dev which can be used for free. + + +## History +[Pyth](https://github.com/brendonh/pyth) was not working for the rtf files I +had. The next best thing was this gist: +https://gist.github.com/gilsondev/7c1d2d753ddb522e7bc22511cfb08676 + +Very few additions where made, e.g. better formatting of tables. + +## Pushing to PyPi + * pip install twine + + +Run commands +``` +python setup.py sdist bdist_wheel +twine upload -r testpypi dist/* +twine upload -r pypi dist/* +``` + + + + +%prep +%autosetup -n striprtf-0.0.22 + +%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-striprtf -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Tue Apr 11 2023 Python_Bot <Python_Bot@openeuler.org> - 0.0.22-1 +- Package Spec generated @@ -0,0 +1 @@ +7c45b8914621245d282c8f6b764aae92 striprtf-0.0.22.tar.gz |