diff options
Diffstat (limited to 'python-pyfoldingathomecontrol.spec')
| -rw-r--r-- | python-pyfoldingathomecontrol.spec | 225 |
1 files changed, 225 insertions, 0 deletions
diff --git a/python-pyfoldingathomecontrol.spec b/python-pyfoldingathomecontrol.spec new file mode 100644 index 0000000..d7a7727 --- /dev/null +++ b/python-pyfoldingathomecontrol.spec @@ -0,0 +1,225 @@ +%global _empty_manifest_terminate_build 0 +Name: python-pyfoldingathomecontrol +Version: 3.0.1 +Release: 1 +Summary: Python library to get stats from your Folding@Home Clients +License: MIT +URL: http://github.com/eifinger/PyFoldingAtHomeControl +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/90/c6/aa1f450b320adbe5000102862648cb09530f4c4d02d284faee7f2e4495e9/pyfoldingathomecontrol-3.0.1.tar.gz +BuildArch: noarch + + +%description +# PyFoldingAtHomeControl + +Python library to get stats from your Folding@Home Clients + +[](https://github.com/eifinger/PyFoldingAtHomeControl/actions?workflow=Python+package) +[](https://pypi.python.org/pypi/PyFoldingAtHomeControl) +[](https://github.com/eifinger/PyFoldingAtHomeControl/blob/master/LICENSE) +[](https://codecov.io/gh/eifinger/PyFoldingAtHomeControl) +[](https://pepy.tech/project/pyfoldingathomecontrol) + +## Installation + +```bash +pip install PyFoldingAtHomeControl +``` + +## Usage + +```python +import asyncio +from FoldingAtHomeControl import FoldingAtHomeController +from FoldingAtHomeControl import PyOnMessageTypes + + +def callback(message_type, data): + print(f"callback for: {message_type}: ", data) + + +async def cancel_task(task_to_cancel): + task_to_cancel.cancel() + await task_to_cancel + + +if __name__ == "__main__": + Controller = FoldingAtHomeController("localhost") + Controller.register_callback(callback) + loop = asyncio.get_event_loop() + task = loop.create_task(Controller.start()) + try: + loop.run_until_complete(task) + except KeyboardInterrupt: + pass + finally: + print("Cancelling task") + try: + loop.run_until_complete(cancel_task(task)) + except asyncio.CancelledError: + print("Closing Loop") + loop.close() +``` + + + +%package -n python3-pyfoldingathomecontrol +Summary: Python library to get stats from your Folding@Home Clients +Provides: python-pyfoldingathomecontrol +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-pyfoldingathomecontrol +# PyFoldingAtHomeControl + +Python library to get stats from your Folding@Home Clients + +[](https://github.com/eifinger/PyFoldingAtHomeControl/actions?workflow=Python+package) +[](https://pypi.python.org/pypi/PyFoldingAtHomeControl) +[](https://github.com/eifinger/PyFoldingAtHomeControl/blob/master/LICENSE) +[](https://codecov.io/gh/eifinger/PyFoldingAtHomeControl) +[](https://pepy.tech/project/pyfoldingathomecontrol) + +## Installation + +```bash +pip install PyFoldingAtHomeControl +``` + +## Usage + +```python +import asyncio +from FoldingAtHomeControl import FoldingAtHomeController +from FoldingAtHomeControl import PyOnMessageTypes + + +def callback(message_type, data): + print(f"callback for: {message_type}: ", data) + + +async def cancel_task(task_to_cancel): + task_to_cancel.cancel() + await task_to_cancel + + +if __name__ == "__main__": + Controller = FoldingAtHomeController("localhost") + Controller.register_callback(callback) + loop = asyncio.get_event_loop() + task = loop.create_task(Controller.start()) + try: + loop.run_until_complete(task) + except KeyboardInterrupt: + pass + finally: + print("Cancelling task") + try: + loop.run_until_complete(cancel_task(task)) + except asyncio.CancelledError: + print("Closing Loop") + loop.close() +``` + + + +%package help +Summary: Development documents and examples for pyfoldingathomecontrol +Provides: python3-pyfoldingathomecontrol-doc +%description help +# PyFoldingAtHomeControl + +Python library to get stats from your Folding@Home Clients + +[](https://github.com/eifinger/PyFoldingAtHomeControl/actions?workflow=Python+package) +[](https://pypi.python.org/pypi/PyFoldingAtHomeControl) +[](https://github.com/eifinger/PyFoldingAtHomeControl/blob/master/LICENSE) +[](https://codecov.io/gh/eifinger/PyFoldingAtHomeControl) +[](https://pepy.tech/project/pyfoldingathomecontrol) + +## Installation + +```bash +pip install PyFoldingAtHomeControl +``` + +## Usage + +```python +import asyncio +from FoldingAtHomeControl import FoldingAtHomeController +from FoldingAtHomeControl import PyOnMessageTypes + + +def callback(message_type, data): + print(f"callback for: {message_type}: ", data) + + +async def cancel_task(task_to_cancel): + task_to_cancel.cancel() + await task_to_cancel + + +if __name__ == "__main__": + Controller = FoldingAtHomeController("localhost") + Controller.register_callback(callback) + loop = asyncio.get_event_loop() + task = loop.create_task(Controller.start()) + try: + loop.run_until_complete(task) + except KeyboardInterrupt: + pass + finally: + print("Cancelling task") + try: + loop.run_until_complete(cancel_task(task)) + except asyncio.CancelledError: + print("Closing Loop") + loop.close() +``` + + + +%prep +%autosetup -n pyfoldingathomecontrol-3.0.1 + +%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-pyfoldingathomecontrol -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Mon May 15 2023 Python_Bot <Python_Bot@openeuler.org> - 3.0.1-1 +- Package Spec generated |
