mirror of
https://codeberg.org/privacy1st/subprocess-util
synced 2024-12-22 22:06:05 +01:00
refactor: rename module to subprocess_util
This commit is contained in:
parent
326e3bf5e6
commit
c61e1a8c1d
2
Makefile
2
Makefile
@ -21,7 +21,7 @@ all:
|
|||||||
.PHONY: test
|
.PHONY: test
|
||||||
test: venv
|
test: venv
|
||||||
source venv/bin/activate
|
source venv/bin/activate
|
||||||
python3 src/p1st/test.py
|
python3 src/subprocess_util/test.py
|
||||||
|
|
||||||
venv:
|
venv:
|
||||||
if [ -d venv ]; then
|
if [ -d venv ]; then
|
||||||
|
@ -32,8 +32,8 @@ where = src
|
|||||||
[options.entry_points]
|
[options.entry_points]
|
||||||
; https://setuptools.readthedocs.io/en/latest/userguide/entry_point.html
|
; https://setuptools.readthedocs.io/en/latest/userguide/entry_point.html
|
||||||
console_scripts =
|
console_scripts =
|
||||||
btrfs-send-chunks-active = p1st.btrfs_send_chunks_active:main
|
btrfs-send-chunks-active = subprocess_util.btrfs_send_chunks_active:main
|
||||||
btrfs-receive-chunks-passive = p1st.btrfs_receive_chunks_passive:main
|
btrfs-receive-chunks-passive = subprocess_util.btrfs_receive_chunks_passive:main
|
||||||
|
|
||||||
btrfs-send-chunks-passive = p1st.btrfs_send_chunks_passive:main
|
btrfs-send-chunks-passive = subprocess_util.btrfs_send_chunks_passive:main
|
||||||
btrfs-receive-chunks-active = p1st.btrfs_receive_chunks_active:main
|
btrfs-receive-chunks-active = subprocess_util.btrfs_receive_chunks_active:main
|
||||||
|
@ -5,14 +5,12 @@ import shlex
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from queue import Queue
|
from queue import Queue
|
||||||
|
|
||||||
from p1st.common import Message1, Message2, get_chunk_path, get_inform1_path, get_inform2_path
|
from subprocess_util.common import Message1, Message2, get_chunk_path, get_inform1_path, get_inform2_path
|
||||||
from p1st.exec_consume_chunks import execute_consume_chunks
|
from subprocess_util.exec_consume_chunks import execute_consume_chunks
|
||||||
from p1st.repeat import repeat_until_successful
|
from subprocess_util.repeat import repeat_until_successful
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
||||||
|
|
||||||
args = parse_args()
|
args = parse_args()
|
||||||
#
|
#
|
||||||
ssh_source: str = args.ssh_source
|
ssh_source: str = args.ssh_source
|
@ -5,8 +5,8 @@ import socket
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from queue import Queue
|
from queue import Queue
|
||||||
|
|
||||||
from p1st.exec_consume_chunks import execute_consume_chunks
|
from subprocess_util.exec_consume_chunks import execute_consume_chunks
|
||||||
from p1st.unix_sock_input import accept_loop_until_message
|
from subprocess_util.unix_sock_input import accept_loop_until_message
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
@ -4,8 +4,8 @@ import argparse
|
|||||||
import shlex
|
import shlex
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from p1st.exec_produce_chunks import execute_produce_chunks
|
from subprocess_util.exec_produce_chunks import execute_produce_chunks
|
||||||
from p1st.repeat import repeat_until_successful
|
from subprocess_util.repeat import repeat_until_successful
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
@ -4,9 +4,9 @@ import argparse
|
|||||||
import socket
|
import socket
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from p1st.common import Message1, Message2, get_inform1_path, get_inform2_path, get_chunk_path
|
from subprocess_util.common import Message1, Message2, get_inform1_path, get_inform2_path, get_chunk_path
|
||||||
from p1st.exec_produce_chunks import execute_produce_chunks
|
from subprocess_util.exec_produce_chunks import execute_produce_chunks
|
||||||
from p1st.unix_sock_input import accept_loop_until_message
|
from subprocess_util.unix_sock_input import accept_loop_until_message
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
@ -9,7 +9,7 @@ from pathlib import Path
|
|||||||
from queue import Queue
|
from queue import Queue
|
||||||
from typing import Callable, IO, AnyStr
|
from typing import Callable, IO, AnyStr
|
||||||
|
|
||||||
from p1st.data_units import DataUnitConverter
|
from subprocess_util.data_units import DataUnitConverter
|
||||||
|
|
||||||
|
|
||||||
def execute_consume_chunks(command: list[str],
|
def execute_consume_chunks(command: list[str],
|
@ -4,7 +4,7 @@ import socket
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import IO, AnyStr, Callable
|
from typing import IO, AnyStr, Callable
|
||||||
|
|
||||||
from p1st.unix_sock_input import accept_loop_until_message
|
from subprocess_util.unix_sock_input import accept_loop_until_message
|
||||||
|
|
||||||
|
|
||||||
def receive_inform(in_pipe: IO[AnyStr],
|
def receive_inform(in_pipe: IO[AnyStr],
|
@ -1,8 +1,8 @@
|
|||||||
import time
|
import time
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from p1st.exec_print_capture import execute_print_capture
|
from subprocess_util.exec_print_capture import execute_print_capture
|
||||||
from p1st.unix_sock_input import wait_for_message
|
from subprocess_util.unix_sock_input import wait_for_message
|
||||||
|
|
||||||
|
|
||||||
def repeat_until_successful(command: list[str],
|
def repeat_until_successful(command: list[str],
|
@ -3,9 +3,9 @@
|
|||||||
import shutil
|
import shutil
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from p1st.exec_capture import execute_capture
|
from subprocess_util.exec_capture import execute_capture
|
||||||
from p1st.exec_print_capture import execute_print_capture
|
from subprocess_util.exec_print_capture import execute_print_capture
|
||||||
from p1st.exec_produce_chunks import execute_produce_chunks
|
from subprocess_util.exec_produce_chunks import execute_produce_chunks
|
||||||
|
|
||||||
|
|
||||||
def test():
|
def test():
|
||||||
@ -34,9 +34,9 @@ def test1():
|
|||||||
def test2():
|
def test2():
|
||||||
_init(2)
|
_init(2)
|
||||||
|
|
||||||
returncode, out, err = execute_print_capture(['ls', '-la'])
|
_returncode, _out, _err = execute_print_capture(['ls', '-la'])
|
||||||
print()
|
print()
|
||||||
returncode, out, err = execute_print_capture(['ls', '/foo/bar'])
|
_returncode, _out, _err = execute_print_capture(['ls', '/foo/bar'])
|
||||||
|
|
||||||
|
|
||||||
def test8():
|
def test8():
|
||||||
@ -77,14 +77,14 @@ def test9():
|
|||||||
def test10():
|
def test10():
|
||||||
_init(10)
|
_init(10)
|
||||||
|
|
||||||
source_file = Path('src/p1st/exec_capture.py')
|
source_file = Path('src/subprocess_util/exec_capture.py')
|
||||||
chunk_dir = Path('test')
|
chunk_dir = Path('test')
|
||||||
target_file = Path('test/exec_capture.py')
|
target_file = Path('test/exec_capture.py')
|
||||||
|
|
||||||
def get_chunk_path(chunk_no: int):
|
def get_chunk_path(chunk_no: int):
|
||||||
return chunk_dir.joinpath(f'{source_file.name}.CHUNK.{chunk_no}')
|
return chunk_dir.joinpath(f'{source_file.name}.CHUNK.{chunk_no}')
|
||||||
|
|
||||||
def handle_chunk(chunk_no: int, last_chunk: bool):
|
def handle_chunk(chunk_no: int, _last_chunk: bool):
|
||||||
chunk_path = get_chunk_path(chunk_no)
|
chunk_path = get_chunk_path(chunk_no)
|
||||||
print(f'Handling chunk {chunk_path}')
|
print(f'Handling chunk {chunk_path}')
|
||||||
|
|
Loading…
Reference in New Issue
Block a user