refactor: rename module to subprocess_util

This commit is contained in:
Daniel Langbein 2023-03-18 16:45:15 +01:00
parent 326e3bf5e6
commit c61e1a8c1d
18 changed files with 26 additions and 28 deletions

View File

@ -21,7 +21,7 @@ all:
.PHONY: test
test: venv
source venv/bin/activate
python3 src/p1st/test.py
python3 src/subprocess_util/test.py
venv:
if [ -d venv ]; then

View File

@ -32,8 +32,8 @@ where = src
[options.entry_points]
; https://setuptools.readthedocs.io/en/latest/userguide/entry_point.html
console_scripts =
btrfs-send-chunks-active = p1st.btrfs_send_chunks_active:main
btrfs-receive-chunks-passive = p1st.btrfs_receive_chunks_passive:main
btrfs-send-chunks-active = subprocess_util.btrfs_send_chunks_active:main
btrfs-receive-chunks-passive = subprocess_util.btrfs_receive_chunks_passive:main
btrfs-send-chunks-passive = p1st.btrfs_send_chunks_passive:main
btrfs-receive-chunks-active = p1st.btrfs_receive_chunks_active:main
btrfs-send-chunks-passive = subprocess_util.btrfs_send_chunks_passive:main
btrfs-receive-chunks-active = subprocess_util.btrfs_receive_chunks_active:main

View File

@ -5,14 +5,12 @@ import shlex
from pathlib import Path
from queue import Queue
from p1st.common import Message1, Message2, get_chunk_path, get_inform1_path, get_inform2_path
from p1st.exec_consume_chunks import execute_consume_chunks
from p1st.repeat import repeat_until_successful
from subprocess_util.common import Message1, Message2, get_chunk_path, get_inform1_path, get_inform2_path
from subprocess_util.exec_consume_chunks import execute_consume_chunks
from subprocess_util.repeat import repeat_until_successful
def main():
args = parse_args()
#
ssh_source: str = args.ssh_source

View File

@ -5,8 +5,8 @@ import socket
from pathlib import Path
from queue import Queue
from p1st.exec_consume_chunks import execute_consume_chunks
from p1st.unix_sock_input import accept_loop_until_message
from subprocess_util.exec_consume_chunks import execute_consume_chunks
from subprocess_util.unix_sock_input import accept_loop_until_message
def main():

View File

@ -4,8 +4,8 @@ import argparse
import shlex
from pathlib import Path
from p1st.exec_produce_chunks import execute_produce_chunks
from p1st.repeat import repeat_until_successful
from subprocess_util.exec_produce_chunks import execute_produce_chunks
from subprocess_util.repeat import repeat_until_successful
def main():

View File

@ -4,9 +4,9 @@ import argparse
import socket
from pathlib import Path
from p1st.common import Message1, Message2, get_inform1_path, get_inform2_path, get_chunk_path
from p1st.exec_produce_chunks import execute_produce_chunks
from p1st.unix_sock_input import accept_loop_until_message
from subprocess_util.common import Message1, Message2, get_inform1_path, get_inform2_path, get_chunk_path
from subprocess_util.exec_produce_chunks import execute_produce_chunks
from subprocess_util.unix_sock_input import accept_loop_until_message
def main():

View File

@ -9,7 +9,7 @@ from pathlib import Path
from queue import Queue
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],

View File

@ -4,7 +4,7 @@ import socket
from pathlib import Path
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],

View File

@ -1,8 +1,8 @@
import time
from pathlib import Path
from p1st.exec_print_capture import execute_print_capture
from p1st.unix_sock_input import wait_for_message
from subprocess_util.exec_print_capture import execute_print_capture
from subprocess_util.unix_sock_input import wait_for_message
def repeat_until_successful(command: list[str],

View File

@ -3,9 +3,9 @@
import shutil
from pathlib import Path
from p1st.exec_capture import execute_capture
from p1st.exec_print_capture import execute_print_capture
from p1st.exec_produce_chunks import execute_produce_chunks
from subprocess_util.exec_capture import execute_capture
from subprocess_util.exec_print_capture import execute_print_capture
from subprocess_util.exec_produce_chunks import execute_produce_chunks
def test():
@ -34,9 +34,9 @@ def test1():
def test2():
_init(2)
returncode, out, err = execute_print_capture(['ls', '-la'])
_returncode, _out, _err = execute_print_capture(['ls', '-la'])
print()
returncode, out, err = execute_print_capture(['ls', '/foo/bar'])
_returncode, _out, _err = execute_print_capture(['ls', '/foo/bar'])
def test8():
@ -77,14 +77,14 @@ def test9():
def test10():
_init(10)
source_file = Path('src/p1st/exec_capture.py')
source_file = Path('src/subprocess_util/exec_capture.py')
chunk_dir = Path('test')
target_file = Path('test/exec_capture.py')
def get_chunk_path(chunk_no: int):
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)
print(f'Handling chunk {chunk_path}')