From 2d31aafa36234a2c569dac99a95e3620df6f7857 Mon Sep 17 00:00:00 2001 From: Randall Winkhart Date: Tue, 18 Apr 2023 13:35:55 -0400 Subject: [PATCH] port-jobs: Added initial script for removal of server-only code Former-commit-id: a5539fd86288aabf392b8f226100d232ee46514d Former-commit-id: 19306b84cf881ba17d119675195bef84e6ab5fa2 --- lib/sshync.py | 2 ++ port-jobs/RMSERVER.PY | 17 +++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100755 port-jobs/RMSERVER.PY diff --git a/lib/sshync.py b/lib/sshync.py index aca082c..7c2d162 100755 --- a/lib/sshync.py +++ b/lib/sshync.py @@ -6,6 +6,7 @@ from sys import exit as s_exit home = expanduser("~") +# PORT START SSHYNC-REMOTE # REMOTE # prints all necessary remote data to stdout def remote_list_gen(_client_device_name, _remote_dir): @@ -27,6 +28,7 @@ def remote_list_gen(_client_device_name, _remote_dir): print('\x1d') # titles and mod times get_local_data(_remote_dir, 'server') +# PORT END SSHYNC-REMOTE # HYBRID diff --git a/port-jobs/RMSERVER.PY b/port-jobs/RMSERVER.PY new file mode 100755 index 0000000..0f3c2e4 --- /dev/null +++ b/port-jobs/RMSERVER.PY @@ -0,0 +1,17 @@ +#!/usr/bin/env python3 +import re +from sys import argv, exit as s_exit + +# define PORT target +string1 = '# PORT START SSHYNC-REMOTE' +string2 = '# PORT END SSHYNC-REMOTE' + +# read input file +text = open('working/sshync.py', 'r').read() + +# find and replace the defined PORT target +regex = re.compile(f"\n{string1}.*?{string2}\n\n", re.DOTALL) +new_text = re.sub(regex, '', text) + +# write updated text +open('working/sshync.py', 'w').write(new_text)