From a4b4475d39b4a7bf4fbfaa16971c5711670e772d Mon Sep 17 00:00:00 2001 From: CoprDistGit Date: Mon, 29 May 2023 09:22:25 +0000 Subject: automatic import of python-gnu-screen --- python-gnu-screen.spec | 426 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 426 insertions(+) create mode 100644 python-gnu-screen.spec (limited to 'python-gnu-screen.spec') diff --git a/python-gnu-screen.spec b/python-gnu-screen.spec new file mode 100644 index 0000000..2fa3fe7 --- /dev/null +++ b/python-gnu-screen.spec @@ -0,0 +1,426 @@ +%global _empty_manifest_terminate_build 0 +Name: python-gnu-screen +Version: 0.0.8 +Release: 1 +Summary: GNU-Screen session module handler for NodeJs +License: GNU General Public License v3 (GPLv3) +URL: https://github.com/LoucasMaillet/Lib-GNU-Screen/tree/main/Python +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/74/6d/442a3b74d72391f4851b771ffd445c8949ef2fdf1e699bb4292a6d4499c4/gnu-screen-0.0.8.tar.gz +BuildArch: noarch + + +%description +# What is this ? + +This was build to handle and manage gnu-screen session. Actually work well. + +# Table of Contents + +* [Required](#required) +* [Installation](#installation) +* [Functions](#functions) +* [Screen](#screen) +* [Exemple](#exemple) + +# Required + + * Python: 3.8 + * GNU-Screen: 4.08.00 + +# Installation + +First make sure you have gnu-screen installed: +``` +$ apt-get install screen +``` + +To run this project, use pip: +``` +$ pip install gnu-screen +``` + +# Functions + +- `getAll()` Return all available Screens. + +# Screen + +Create a representation of gnu-screen session : `Screen(id, mode="")` +If you want to save logs change mode to `'s'`. + +Events: +- `close` When screen is closed. +- `stdout` `str` When something new is append in logFile. + +Methods: +- `Screen.exist()` Check if screen's session is running. +- `Screen.setup()` Fetch self variable with running session. +- `Screen.setRule(*rules)` Rules to apply in screen session. +- `Screen.write(*stdins)` Write something in screen session. +- `Screen.setStdout(state)` Watch over logFile to call `stdout` Event. +- `Screen.logFile()` Return logFile. +- `Screen.on(call)` Set an event (`disconnect()`,`close()`,`stdout(log)`). +- `Screen.run(stdin=None)` Connect/create to screen session. +- `Screen.close()` Close screen session. +- `Screen.kill(signal=15)` Kill screen session. + +KeyValues: +- `Screen.id` `str | None` Screen session's id. +- `Screen.logFilePath` `str | None` Path of logFile is there one. +- `Screen.events` `dict` Screen session events. +- `Screen.pid` `int | None` Pid of screen session if is running. +- `Screen.date` `str | None` Date of screen session if is running. +- `Screen.state` `str | None` State of screen session if is running. + +# Exemple + +```py +import os +import gnu_screen as sc + +# Generate 10 screens session +for n in range(10): + scr = sc.Screen(id=f"test n°{n}") + print(scr) + scr.run() + +# Find and close the 10 screens session +for scr in sc.getAll(): + print(scr) + scr.close() + +# Create a new screen session +test = sc.Screen(id="final test", mode="r") +test.run() +print(test) + +# Allow "stdout" event +test.setStdout() + + +# Remove screen session +def close(): + test.close() + if not test.pid: + print("Closed final test's screen session") + else: + test.kill() + print("Killed test's screen session") + #self kill + os.kill(os.getpid(), 15) + + +# Get stdout from screen session +@test.on +def stdout(log): + print("stdout:", log) + if "!close" in log: + close() + + +# Pipe input to the screen session +while test.pid: + try: + test.write(input()) + except KeyboardInterrupt: + # Capture Ctrl + C to close screen session + close() +``` + + + + +%package -n python3-gnu-screen +Summary: GNU-Screen session module handler for NodeJs +Provides: python-gnu-screen +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-gnu-screen +# What is this ? + +This was build to handle and manage gnu-screen session. Actually work well. + +# Table of Contents + +* [Required](#required) +* [Installation](#installation) +* [Functions](#functions) +* [Screen](#screen) +* [Exemple](#exemple) + +# Required + + * Python: 3.8 + * GNU-Screen: 4.08.00 + +# Installation + +First make sure you have gnu-screen installed: +``` +$ apt-get install screen +``` + +To run this project, use pip: +``` +$ pip install gnu-screen +``` + +# Functions + +- `getAll()` Return all available Screens. + +# Screen + +Create a representation of gnu-screen session : `Screen(id, mode="")` +If you want to save logs change mode to `'s'`. + +Events: +- `close` When screen is closed. +- `stdout` `str` When something new is append in logFile. + +Methods: +- `Screen.exist()` Check if screen's session is running. +- `Screen.setup()` Fetch self variable with running session. +- `Screen.setRule(*rules)` Rules to apply in screen session. +- `Screen.write(*stdins)` Write something in screen session. +- `Screen.setStdout(state)` Watch over logFile to call `stdout` Event. +- `Screen.logFile()` Return logFile. +- `Screen.on(call)` Set an event (`disconnect()`,`close()`,`stdout(log)`). +- `Screen.run(stdin=None)` Connect/create to screen session. +- `Screen.close()` Close screen session. +- `Screen.kill(signal=15)` Kill screen session. + +KeyValues: +- `Screen.id` `str | None` Screen session's id. +- `Screen.logFilePath` `str | None` Path of logFile is there one. +- `Screen.events` `dict` Screen session events. +- `Screen.pid` `int | None` Pid of screen session if is running. +- `Screen.date` `str | None` Date of screen session if is running. +- `Screen.state` `str | None` State of screen session if is running. + +# Exemple + +```py +import os +import gnu_screen as sc + +# Generate 10 screens session +for n in range(10): + scr = sc.Screen(id=f"test n°{n}") + print(scr) + scr.run() + +# Find and close the 10 screens session +for scr in sc.getAll(): + print(scr) + scr.close() + +# Create a new screen session +test = sc.Screen(id="final test", mode="r") +test.run() +print(test) + +# Allow "stdout" event +test.setStdout() + + +# Remove screen session +def close(): + test.close() + if not test.pid: + print("Closed final test's screen session") + else: + test.kill() + print("Killed test's screen session") + #self kill + os.kill(os.getpid(), 15) + + +# Get stdout from screen session +@test.on +def stdout(log): + print("stdout:", log) + if "!close" in log: + close() + + +# Pipe input to the screen session +while test.pid: + try: + test.write(input()) + except KeyboardInterrupt: + # Capture Ctrl + C to close screen session + close() +``` + + + + +%package help +Summary: Development documents and examples for gnu-screen +Provides: python3-gnu-screen-doc +%description help +# What is this ? + +This was build to handle and manage gnu-screen session. Actually work well. + +# Table of Contents + +* [Required](#required) +* [Installation](#installation) +* [Functions](#functions) +* [Screen](#screen) +* [Exemple](#exemple) + +# Required + + * Python: 3.8 + * GNU-Screen: 4.08.00 + +# Installation + +First make sure you have gnu-screen installed: +``` +$ apt-get install screen +``` + +To run this project, use pip: +``` +$ pip install gnu-screen +``` + +# Functions + +- `getAll()` Return all available Screens. + +# Screen + +Create a representation of gnu-screen session : `Screen(id, mode="")` +If you want to save logs change mode to `'s'`. + +Events: +- `close` When screen is closed. +- `stdout` `str` When something new is append in logFile. + +Methods: +- `Screen.exist()` Check if screen's session is running. +- `Screen.setup()` Fetch self variable with running session. +- `Screen.setRule(*rules)` Rules to apply in screen session. +- `Screen.write(*stdins)` Write something in screen session. +- `Screen.setStdout(state)` Watch over logFile to call `stdout` Event. +- `Screen.logFile()` Return logFile. +- `Screen.on(call)` Set an event (`disconnect()`,`close()`,`stdout(log)`). +- `Screen.run(stdin=None)` Connect/create to screen session. +- `Screen.close()` Close screen session. +- `Screen.kill(signal=15)` Kill screen session. + +KeyValues: +- `Screen.id` `str | None` Screen session's id. +- `Screen.logFilePath` `str | None` Path of logFile is there one. +- `Screen.events` `dict` Screen session events. +- `Screen.pid` `int | None` Pid of screen session if is running. +- `Screen.date` `str | None` Date of screen session if is running. +- `Screen.state` `str | None` State of screen session if is running. + +# Exemple + +```py +import os +import gnu_screen as sc + +# Generate 10 screens session +for n in range(10): + scr = sc.Screen(id=f"test n°{n}") + print(scr) + scr.run() + +# Find and close the 10 screens session +for scr in sc.getAll(): + print(scr) + scr.close() + +# Create a new screen session +test = sc.Screen(id="final test", mode="r") +test.run() +print(test) + +# Allow "stdout" event +test.setStdout() + + +# Remove screen session +def close(): + test.close() + if not test.pid: + print("Closed final test's screen session") + else: + test.kill() + print("Killed test's screen session") + #self kill + os.kill(os.getpid(), 15) + + +# Get stdout from screen session +@test.on +def stdout(log): + print("stdout:", log) + if "!close" in log: + close() + + +# Pipe input to the screen session +while test.pid: + try: + test.write(input()) + except KeyboardInterrupt: + # Capture Ctrl + C to close screen session + close() +``` + + + + +%prep +%autosetup -n gnu-screen-0.0.8 + +%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-gnu-screen -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Mon May 29 2023 Python_Bot - 0.0.8-1 +- Package Spec generated -- cgit v1.2.3