From 089dc302e56adedf9346044722d36bc12219d87c Mon Sep 17 00:00:00 2001 From: Benjamin Zeiss Date: Sat, 22 Jan 2022 00:08:29 +0100 Subject: [PATCH] restructuring towards python client library #455 (#613) * python client library clean branch for PR. #455 * removed superfluous file. #455 * removed one more superfluous file. #455 * README.md, .pylintrc and pylint based fixes. #455 * updated wrt. to the review comments. #455 * removed pylint documentation duplication. #455 --- .gitignore | 9 +- easyinstall.sh | 24 +- python/.pylintrc | 4 +- python/README.md | 32 ++ python/{common/src/.gitkeep => __init__.py} | 0 python/common/requirements.txt | 2 + python/common/src/README.md | 30 + python/common/src/__init__.py | 0 python/common/src/rascsi/__init__.py | 0 python/common/src/rascsi/common_settings.py | 21 + python/common/src/rascsi/exceptions.py | 15 + python/common/src/rascsi/file_cmds.py | 601 ++++++++++++++++++++ python/common/src/rascsi/ractl_cmds.py | 444 +++++++++++++++ python/common/src/rascsi/return_codes.py | 25 + python/common/src/rascsi/socket_cmds.py | 91 +++ python/oled/.pylintrc | 1 - python/oled/README.md | 11 - python/oled/src/__init__.py | 0 python/oled/src/interrupt_handler.py | 3 +- python/oled/src/pi_cmds.py | 1 + python/oled/src/ractl_cmds.py | 70 --- python/oled/src/rascsi_oled_monitor.py | 25 +- python/oled/src/socket_cmds.py | 73 --- python/oled/start.sh | 3 + python/web/.pylintrc | 1 - python/web/README.md | 14 - python/web/__init__.py | 0 python/web/src/__init__.py | 0 python/web/src/device_utils.py | 1 + python/web/src/file_cmds.py | 538 ------------------ python/web/src/pi_cmds.py | 29 +- python/web/src/ractl_cmds.py | 465 --------------- python/web/src/return_code_mapper.py | 45 ++ python/web/src/settings.py | 15 +- python/web/src/socket_cmds.py | 100 ---- python/web/src/socket_cmds_flask.py | 60 ++ python/web/src/web.py | 285 +++++----- python/web/start.sh | 2 + 38 files changed, 1573 insertions(+), 1467 deletions(-) create mode 100644 python/README.md rename python/{common/src/.gitkeep => __init__.py} (100%) create mode 100644 python/common/requirements.txt create mode 100644 python/common/src/README.md create mode 100644 python/common/src/__init__.py create mode 100644 python/common/src/rascsi/__init__.py create mode 100644 python/common/src/rascsi/common_settings.py create mode 100644 python/common/src/rascsi/exceptions.py create mode 100644 python/common/src/rascsi/file_cmds.py create mode 100644 python/common/src/rascsi/ractl_cmds.py create mode 100644 python/common/src/rascsi/return_codes.py create mode 100644 python/common/src/rascsi/socket_cmds.py delete mode 100644 python/oled/.pylintrc create mode 100644 python/oled/src/__init__.py delete mode 100644 python/oled/src/ractl_cmds.py delete mode 100644 python/oled/src/socket_cmds.py delete mode 100644 python/web/.pylintrc create mode 100644 python/web/__init__.py create mode 100644 python/web/src/__init__.py delete mode 100644 python/web/src/file_cmds.py delete mode 100644 python/web/src/ractl_cmds.py create mode 100644 python/web/src/return_code_mapper.py delete mode 100644 python/web/src/socket_cmds.py create mode 100644 python/web/src/socket_cmds_flask.py diff --git a/.gitignore b/.gitignore index 05087471..dd1853b0 100644 --- a/.gitignore +++ b/.gitignore @@ -5,11 +5,12 @@ core .DS_Store *.swp __pycache__ -python/web/current -python/web/src/rascsi_interface_pb2.py -python/oled/current -python/oled/src/rascsi_interface_pb2.py +current +rascsi_interface_pb2.py src/raspberrypi/hfdisk/ *~ messages.pot messages.mo + +# temporary user files +s.sh \ No newline at end of file diff --git a/easyinstall.sh b/easyinstall.sh index 25c67909..a446fd13 100755 --- a/easyinstall.sh +++ b/easyinstall.sh @@ -52,6 +52,7 @@ VIRTUAL_DRIVER_PATH="$HOME/images" CFG_PATH="$HOME/.config/rascsi" WEB_INSTALL_PATH="$BASE/python/web" OLED_INSTALL_PATH="$BASE/python/oled" +PYTHON_COMMON_PATH="$BASE/python/common" SYSTEMD_PATH="/etc/systemd/system" HFS_FORMAT=/usr/bin/hformat HFDISK_BIN=/usr/bin/hfdisk @@ -94,15 +95,17 @@ function installRaScsi() { sudo make install CONNECT_TYPE="${CONNECT_TYPE:-FULLSPEC}" = 4: + # Extracting the response header to get the length of the response message + response_length = unpack("= 4: - # Extracting the response header to get the length of the response message - response_length = unpack("= 4: - # Extracting the response header to get the length of the response message - response_length = unpack("