diff options
author | CoprDistGit <infra@openeuler.org> | 2023-05-31 03:30:01 +0000 |
---|---|---|
committer | CoprDistGit <infra@openeuler.org> | 2023-05-31 03:30:01 +0000 |
commit | b5dbb57f441308938fbe23b0fe08d53399c5e1cf (patch) | |
tree | 78116ee167f6f0952b4e1459fa7467319e19ce94 | |
parent | f4ac4b696150fb7f53c9c2fb379a07ab4b251ba0 (diff) |
automatic import of python-discord-rpc-py
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | python-discord-rpc-py.spec | 286 | ||||
-rw-r--r-- | sources | 1 |
3 files changed, 288 insertions, 0 deletions
@@ -0,0 +1 @@ +/discord-rpc.py-1.3.0.tar.gz diff --git a/python-discord-rpc-py.spec b/python-discord-rpc-py.spec new file mode 100644 index 0000000..0eb4cb4 --- /dev/null +++ b/python-discord-rpc-py.spec @@ -0,0 +1,286 @@ +%global _empty_manifest_terminate_build 0 +Name: python-discord-rpc.py +Version: 1.3.0 +Release: 1 +Summary: A Discord Rich Presence library for Python 2 & 3 +License: Mozilla Public License 2.0 (MPL 2.0) +URL: https://gitlab.com/somberdemise/discord-rpc.py +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/7e/e1/277990bd0a46d0b036b7678d489095805453872e776dfff633f704030562/discord-rpc.py-1.3.0.tar.gz +BuildArch: noarch + +Requires: python3-requests + +%description +# discord-rpc.py + +> A Discord RPC library for Python 2 & 3. + + +# Installation + +Install discord-rpc.py with **`pip`** + +For the latest stable version: + +> `pip install discord-rpc.py` + +For the latest development version: + +```python +git clone https://gitlab.com/somberdemise/discord-rpc.py +cd discord.py +python -m pip install -U . +``` + +# Examples + +```python +import discord_rpc +import time + +if __name__ == '__main__': + def readyCallback(current_user): + print('Our user: {}'.format(current_user)) + + def disconnectedCallback(codeno, codemsg): + print('Disconnected from Discord rich presence RPC. Code {}: {}'.format( + codeno, codemsg + )) + + def errorCallback(errno, errmsg): + print('An error occurred! Error {}: {}'.format( + errno, errmsg + )) + + # Note: 'event_name': callback + callbacks = { + 'ready': readyCallback, + 'disconnected': disconnectedCallback, + 'error': errorCallback, + } + discord_rpc.initialize('token', callbacks=callbacks, log=False) + + i = 0 + start = time.time() + while i < 10: + i += 1 + + discord_rpc.update_presence( + **{ + 'details': 'Iteration # {}'.format(i), + 'start_timestamp': start, + 'large_image_key': 'default' + } + ) + + discord_rpc.update_connection() + time.sleep(2) + discord_rpc.run_callbacks() + + discord_rpc.shutdown() + +``` + + + + +%package -n python3-discord-rpc.py +Summary: A Discord Rich Presence library for Python 2 & 3 +Provides: python-discord-rpc.py +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-discord-rpc.py +# discord-rpc.py + +> A Discord RPC library for Python 2 & 3. + + +# Installation + +Install discord-rpc.py with **`pip`** + +For the latest stable version: + +> `pip install discord-rpc.py` + +For the latest development version: + +```python +git clone https://gitlab.com/somberdemise/discord-rpc.py +cd discord.py +python -m pip install -U . +``` + +# Examples + +```python +import discord_rpc +import time + +if __name__ == '__main__': + def readyCallback(current_user): + print('Our user: {}'.format(current_user)) + + def disconnectedCallback(codeno, codemsg): + print('Disconnected from Discord rich presence RPC. Code {}: {}'.format( + codeno, codemsg + )) + + def errorCallback(errno, errmsg): + print('An error occurred! Error {}: {}'.format( + errno, errmsg + )) + + # Note: 'event_name': callback + callbacks = { + 'ready': readyCallback, + 'disconnected': disconnectedCallback, + 'error': errorCallback, + } + discord_rpc.initialize('token', callbacks=callbacks, log=False) + + i = 0 + start = time.time() + while i < 10: + i += 1 + + discord_rpc.update_presence( + **{ + 'details': 'Iteration # {}'.format(i), + 'start_timestamp': start, + 'large_image_key': 'default' + } + ) + + discord_rpc.update_connection() + time.sleep(2) + discord_rpc.run_callbacks() + + discord_rpc.shutdown() + +``` + + + + +%package help +Summary: Development documents and examples for discord-rpc.py +Provides: python3-discord-rpc.py-doc +%description help +# discord-rpc.py + +> A Discord RPC library for Python 2 & 3. + + +# Installation + +Install discord-rpc.py with **`pip`** + +For the latest stable version: + +> `pip install discord-rpc.py` + +For the latest development version: + +```python +git clone https://gitlab.com/somberdemise/discord-rpc.py +cd discord.py +python -m pip install -U . +``` + +# Examples + +```python +import discord_rpc +import time + +if __name__ == '__main__': + def readyCallback(current_user): + print('Our user: {}'.format(current_user)) + + def disconnectedCallback(codeno, codemsg): + print('Disconnected from Discord rich presence RPC. Code {}: {}'.format( + codeno, codemsg + )) + + def errorCallback(errno, errmsg): + print('An error occurred! Error {}: {}'.format( + errno, errmsg + )) + + # Note: 'event_name': callback + callbacks = { + 'ready': readyCallback, + 'disconnected': disconnectedCallback, + 'error': errorCallback, + } + discord_rpc.initialize('token', callbacks=callbacks, log=False) + + i = 0 + start = time.time() + while i < 10: + i += 1 + + discord_rpc.update_presence( + **{ + 'details': 'Iteration # {}'.format(i), + 'start_timestamp': start, + 'large_image_key': 'default' + } + ) + + discord_rpc.update_connection() + time.sleep(2) + discord_rpc.run_callbacks() + + discord_rpc.shutdown() + +``` + + + + +%prep +%autosetup -n discord-rpc.py-1.3.0 + +%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-discord-rpc.py -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Wed May 31 2023 Python_Bot <Python_Bot@openeuler.org> - 1.3.0-1 +- Package Spec generated @@ -0,0 +1 @@ +be224d20cf078d6664d1b7dfdb23880a discord-rpc.py-1.3.0.tar.gz |