Updated port-jobs to allow for packaging the new config setup, fixed offline mode error

Former-commit-id: 511d1d887fb34b8613f063fc7992418bb614a740
Former-commit-id: 03f6817527864c52012de1d02bb2c34e8fed8a18
This commit is contained in:
2023-05-13 20:48:51 -04:00
parent aeb3df7aed
commit 2747aff0bf
9 changed files with 73 additions and 46 deletions
+6 -5
View File
@@ -8,11 +8,12 @@ arguments = argv[1:]
# define replacement text depending on arguments
if len(arguments) > 0:
if arguments[0] == 'WSL':
replacement = """run(['powershell.exe', '-c', "Set-Clipboard '" + _copy_line[_index].rstrip().replace("'", "''") + "'"])
replacement = """run(['powershell.exe', '-c', "Set-Clipboard '" + _copy_line[_index].rstrip()\
.replace("'", "''") + "'"])
Popen("sleep 30; pwsh.exe -c 'echo \\"\\" | Set-Clipboard'", shell=True)"""
elif arguments[0] == 'MAC':
replacement = """run(['pbcopy'], stdin=Popen(['printf', _copy_line[_index].rstrip().replace('\\\\\\', '\\\\\\\\\\\\\\').replace('%', '%%')],
stdout=PIPE).stdout)
replacement = """run(['pbcopy'], stdin=Popen(['printf', _copy_line[_index].rstrip()\
.replace('\\\\\\', '\\\\\\\\\\\\\\').replace('%', '%%')],stdout=PIPE).stdout)
Popen("sleep 30; printf '' | pbcopy", shell=True)"""
elif arguments[0] == 'HAIKU':
replacement = """run(['clipboard', '-c', _copy_line[_index].rstrip()])
@@ -25,8 +26,8 @@ if len(arguments) > 0:
run(['wl-copy', _copy_line[_index].rstrip()])
Popen('sleep 30; wl-copy -c', shell=True)
else:
run(['xclip', '-sel', 'c'], stdin=Popen(['printf', _copy_line[_index].rstrip().replace('\\\\\\', '\\\\\\\\\\\\\\')
.replace('%', '%%')], stdout=PIPE).stdout)
run(['xclip', '-sel', 'c'], stdin=Popen(['printf', _copy_line[_index].rstrip()\
.replace('\\\\\\', '\\\\\\\\\\\\\\').replace('%', '%%')], stdout=PIPE).stdout)
Popen("sleep 30; printf '' | xclip -sel c", shell=True)"""
else:
s_exit()
+11 -12
View File
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
import re
from sys import argv, exit as s_exit
from sys import argv
# read arguments
arguments = argv[1:]
@@ -13,24 +13,23 @@ string2 = '# PORT END CLIPTOOL'
if len(arguments) > 0:
regex = re.compile(f"{string1}.*?{string2}", re.DOTALL)
replacement = """# check for clipboard tool and display warning if missing
if 'WAYLAND_DISPLAY' in environ:
_display_server, _clipboard_tool, _clipboard_package = 'Wayland', 'wl-copy', 'wl-clipboard'
else:
_display_server, _clipboard_tool, _clipboard_package = 'X11', 'xclip', 'xclip'
from shutil import which
if which(_clipboard_tool) is None:
print(f'''\u001b[38;5;9mwarning: you are using {_display_server} and "{_clipboard_tool}" is not present -
if 'WAYLAND_DISPLAY' in environ:
_display_server, _clipboard_tool, _clipboard_package = 'Wayland', 'wl-copy', 'wl-clipboard'
else:
_display_server, _clipboard_tool, _clipboard_package = 'X11', 'xclip', 'xclip'
if which(_clipboard_tool) is None:
print(f'''\n\u001b[38;5;9mwarning: you are using {_display_server} and "{_clipboard_tool}" is not present -
copying entry fields will not function until "{_clipboard_package}" is installed\u001b[0m
''')"""
''')"""
else:
regex = re.compile(f"{string1}.*?{string2}\n\n", re.DOTALL)
regex = re.compile(f"{string1}.*?{string2}\n", re.DOTALL)
replacement = ''
# read input file
text = open('working/sshyp.py', 'r').read()
text = open('working/stweak.py', 'r').read()
# find and replace the defined PORT target
new_text = re.sub(regex, replacement, text)
# write updated text
open('working/sshyp.py', 'w').write(new_text)
open('working/stweak.py', 'w').write(new_text)
+11 -11
View File
@@ -31,25 +31,25 @@ new_text = re.sub(regex, '', text)
# write updated text
open('working/sshyp.py', 'w').write(new_text)
# TWEAK-DEVTYPE
# TWEAK-DEVTYPE TODO Disabled due to new config menu changes, needs re-written so that device type cannot be set to server on RMSERVER devices
# define PORT target
string1 = '# PORT START TWEAK-DEVTYPE'
string2 = '# PORT END TWEAK-DEVTYPE'
#string1 = '# PORT START TWEAK-DEVTYPE'
#string2 = '# PORT END TWEAK-DEVTYPE'
# set replacement text
replacement = """if True:
_sshyp_data = ['client']
Path(f"{home}/.local/share/sshyp").mkdir(mode=0o700, parents=True, exist_ok=True)"""
#replacement = """if True:
# _sshyp_data = ['client']
# Path(f"{home}/.local/share/sshyp").mkdir(mode=0o700, parents=True, exist_ok=True)"""
# read input file
text = open('working/sshyp.py', 'r').read()
## read input file
#text = open('working/stweak.py', 'r').read()
# find and replace the defined PORT target
regex = re.compile(f"{string1}.*?{string2}", re.DOTALL)
new_text = re.sub(regex, replacement, text)
#regex = re.compile(f"{string1}.*?{string2}", re.DOTALL)
#new_text = re.sub(regex, replacement, text)
# write updated text
open('working/sshyp.py', 'w').write(new_text)
#open('working/stweak.py', 'w').write(new_text)
# ARGS-SERVER
# define PORT target
+3 -1
View File
@@ -2,9 +2,11 @@
if [ "$1" = 'TABS' ]; then
unexpand -t 3,7,11,15,19,23,27,31,35,39,43,47,51,55,59,63,67,71,75,79,83,87,91,95,99,103,107,111,115,119,123 working/sshyp.py > working/sshyp.py.new
unexpand -t 3,7,11,15,19,23,27,31,35,39,43,47,51,55,59,63,67,71,75,79,83,87,91,95,99,103,107,111,115,119,123 working/sshync.py > working/sshync.py.new
unexpand -t 3,7,11,15,19,23,27,31,35,39,43,47,51,55,59,63,67,71,75,79,83,87,91,95,99,103,107,111,115,119,123 working/stweak.py > working/stweak.py.new
mv working/sshyp.py.new working/sshyp.py
mv working/sshync.py.new working/sshync.py
chmod +x working/sshyp.py working/sshync.py
mv working/stweak.py.new working/stweak.py
chmod +x working/sshyp.py working/sshync.py working/stweak.py
elif [ "$(grep -qP '\t' "$1" && echo TABS)" = 'TABS' ]; then
printf "$1 contains tab characters...\n"
read -rp 'replace with (4) spaces? (Y/n) ' replace
+20 -5
View File
@@ -16,10 +16,10 @@ if len(arguments) > 0:
else:
s_exit()
# UNAME-IMPORT
# UNAME-IMPORT-SSHYP
# define PORT target
string1 = '# PORT START UNAME-IMPORT'
string2 = '# PORT END UNAME-IMPORT'
string1 = '# PORT START UNAME-IMPORT-SSHYP'
string2 = '# PORT END UNAME-IMPORT-SSHYP'
# read input file
text = open('working/sshyp.py', 'r').read()
@@ -31,17 +31,32 @@ new_text = re.sub(regex, '', text)
# write updated text
open('working/sshyp.py', 'w').write(new_text)
# UNAME-IMPORT-STWEAK
# define PORT target
string1 = '# PORT START UNAME-IMPORT-STWEAK'
string2 = '# PORT END UNAME-IMPORT-STWEAK'
# read input file
text = open('working/stweak.py', 'r').read()
# find and replace the defined PORT target
regex = re.compile(f"{string1}.*?{string2}\n", re.DOTALL)
new_text = re.sub(regex, '', text)
# write updated text
open('working/stweak.py', 'w').write(new_text)
# UNAME-TMP
# define PORT target
string1 = '# PORT START UNAME-TMP'
string2 = '# PORT END UNAME-TMP'
# read input file
text = open('working/sshyp.py', 'r').read()
text = open('working/stweak.py', 'r').read()
# find and replace the defined PORT target
regex = re.compile(f"{string1}.*?{string2}", re.DOTALL)
new_text = re.sub(regex, replacement, text)
# write updated text
open('working/sshyp.py', 'w').write(new_text)
open('working/stweak.py', 'w').write(new_text)