machineconfig 2.0__py3-none-any.whl → 2.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of machineconfig might be problematic. Click here for more details.
- machineconfig/cluster/cloud_manager.py +0 -3
- machineconfig/cluster/data_transfer.py +0 -1
- machineconfig/cluster/file_manager.py +0 -1
- machineconfig/cluster/job_params.py +0 -3
- machineconfig/cluster/loader_runner.py +0 -3
- machineconfig/cluster/remote_machine.py +0 -1
- machineconfig/cluster/script_notify_upon_completion.py +0 -1
- machineconfig/cluster/sessions_managers/archive/create_zellij_template.py +5 -6
- machineconfig/cluster/sessions_managers/archive/session_managers.py +0 -1
- machineconfig/cluster/sessions_managers/enhanced_command_runner.py +17 -57
- machineconfig/cluster/sessions_managers/wt_local.py +36 -110
- machineconfig/cluster/sessions_managers/wt_local_manager.py +42 -112
- machineconfig/cluster/sessions_managers/wt_remote.py +23 -30
- machineconfig/cluster/sessions_managers/wt_remote_manager.py +20 -62
- machineconfig/cluster/sessions_managers/wt_utils/layout_generator.py +10 -15
- machineconfig/cluster/sessions_managers/wt_utils/process_monitor.py +27 -127
- machineconfig/cluster/sessions_managers/wt_utils/remote_executor.py +10 -43
- machineconfig/cluster/sessions_managers/wt_utils/session_manager.py +22 -101
- machineconfig/cluster/sessions_managers/wt_utils/status_reporter.py +11 -39
- machineconfig/cluster/sessions_managers/zellij_local.py +49 -102
- machineconfig/cluster/sessions_managers/zellij_local_manager.py +34 -78
- machineconfig/cluster/sessions_managers/zellij_remote.py +17 -24
- machineconfig/cluster/sessions_managers/zellij_remote_manager.py +7 -13
- machineconfig/cluster/sessions_managers/zellij_utils/example_usage.py +4 -2
- machineconfig/cluster/sessions_managers/zellij_utils/layout_generator.py +6 -6
- machineconfig/cluster/sessions_managers/zellij_utils/process_monitor.py +18 -88
- machineconfig/cluster/sessions_managers/zellij_utils/remote_executor.py +2 -6
- machineconfig/cluster/sessions_managers/zellij_utils/session_manager.py +12 -40
- machineconfig/cluster/sessions_managers/zellij_utils/status_reporter.py +3 -2
- machineconfig/cluster/templates/cli_click.py +0 -1
- machineconfig/cluster/templates/cli_gooey.py +0 -2
- machineconfig/cluster/templates/cli_trogon.py +0 -1
- machineconfig/cluster/templates/run_cloud.py +0 -1
- machineconfig/cluster/templates/run_cluster.py +0 -1
- machineconfig/cluster/templates/run_remote.py +0 -1
- machineconfig/cluster/templates/utils.py +27 -46
- machineconfig/jobs/__pycache__/__init__.cpython-313.pyc +0 -0
- machineconfig/jobs/linux/msc/cli_agents.sh +16 -0
- machineconfig/jobs/python/check_installations.py +2 -1
- machineconfig/jobs/python/create_bootable_media.py +0 -2
- machineconfig/jobs/python/python_ve_symlink.py +9 -11
- machineconfig/jobs/python/tasks.py +0 -1
- machineconfig/jobs/python/vscode/api.py +5 -5
- machineconfig/jobs/python/vscode/link_ve.py +13 -14
- machineconfig/jobs/python/vscode/select_interpreter.py +21 -22
- machineconfig/jobs/python/vscode/sync_code.py +9 -13
- machineconfig/jobs/python_custom_installers/archive/ngrok.py +13 -13
- machineconfig/jobs/python_custom_installers/dev/aider.py +7 -15
- machineconfig/jobs/python_custom_installers/dev/alacritty.py +9 -18
- machineconfig/jobs/python_custom_installers/dev/brave.py +10 -19
- machineconfig/jobs/python_custom_installers/dev/bypass_paywall.py +8 -15
- machineconfig/jobs/python_custom_installers/dev/code.py +12 -32
- machineconfig/jobs/python_custom_installers/dev/cursor.py +3 -14
- machineconfig/jobs/python_custom_installers/dev/docker_desktop.py +8 -7
- machineconfig/jobs/python_custom_installers/dev/espanso.py +15 -19
- machineconfig/jobs/python_custom_installers/dev/goes.py +5 -12
- machineconfig/jobs/python_custom_installers/dev/lvim.py +9 -17
- machineconfig/jobs/python_custom_installers/dev/nerdfont.py +12 -19
- machineconfig/jobs/python_custom_installers/dev/redis.py +12 -20
- machineconfig/jobs/python_custom_installers/dev/wezterm.py +12 -19
- machineconfig/jobs/python_custom_installers/dev/winget.py +5 -23
- machineconfig/jobs/python_custom_installers/docker.py +12 -21
- machineconfig/jobs/python_custom_installers/gh.py +11 -19
- machineconfig/jobs/python_custom_installers/hx.py +32 -16
- machineconfig/jobs/python_custom_installers/warp-cli.py +12 -20
- machineconfig/jobs/python_generic_installers/__pycache__/__init__.cpython-313.pyc +0 -0
- machineconfig/jobs/python_generic_installers/config.json +1 -1
- machineconfig/jobs/python_linux_installers/__pycache__/__init__.cpython-313.pyc +0 -0
- machineconfig/jobs/windows/archive/archive_pygraphviz.ps1 +1 -1
- machineconfig/jobs/windows/msc/cli_agents.bat +0 -0
- machineconfig/jobs/windows/msc/cli_agents.ps1 +0 -0
- machineconfig/jobs/windows/start_terminal.ps1 +1 -1
- machineconfig/profile/create.py +38 -26
- machineconfig/profile/create_hardlinks.py +29 -20
- machineconfig/profile/shell.py +56 -32
- machineconfig/scripts/__init__.py +0 -2
- machineconfig/scripts/__pycache__/__init__.cpython-313.pyc +0 -0
- machineconfig/scripts/cloud/init.sh +2 -2
- machineconfig/scripts/linux/checkout_versions +1 -1
- machineconfig/scripts/linux/choose_wezterm_theme +1 -1
- machineconfig/scripts/linux/cloud_copy +1 -1
- machineconfig/scripts/linux/cloud_manager +1 -1
- machineconfig/scripts/linux/cloud_mount +1 -1
- machineconfig/scripts/linux/cloud_repo_sync +1 -1
- machineconfig/scripts/linux/cloud_sync +1 -1
- machineconfig/scripts/linux/croshell +1 -1
- machineconfig/scripts/linux/devops +7 -7
- machineconfig/scripts/linux/fire +1 -1
- machineconfig/scripts/linux/fire_agents +3 -2
- machineconfig/scripts/linux/ftpx +1 -1
- machineconfig/scripts/linux/gh_models +1 -1
- machineconfig/scripts/linux/kill_process +1 -1
- machineconfig/scripts/linux/mcinit +1 -1
- machineconfig/scripts/linux/repos +1 -1
- machineconfig/scripts/linux/scheduler +1 -1
- machineconfig/scripts/linux/start_slidev +1 -1
- machineconfig/scripts/linux/start_terminals +1 -1
- machineconfig/scripts/linux/url2md +1 -1
- machineconfig/scripts/linux/warp-cli.sh +122 -0
- machineconfig/scripts/linux/wifi_conn +1 -1
- machineconfig/scripts/python/__pycache__/__init__.cpython-313.pyc +0 -0
- machineconfig/scripts/python/__pycache__/devops.cpython-313.pyc +0 -0
- machineconfig/scripts/python/__pycache__/devops_devapps_install.cpython-313.pyc +0 -0
- machineconfig/scripts/python/__pycache__/devops_update_repos.cpython-313.pyc +0 -0
- machineconfig/scripts/python/__pycache__/fire_agents.cpython-313.pyc +0 -0
- machineconfig/scripts/python/ai/__init__.py +0 -0
- machineconfig/scripts/python/ai/generate_files.py +83 -0
- machineconfig/scripts/python/ai/instructions/python/dev.instructions.md +2 -2
- machineconfig/scripts/python/ai/mcinit.py +14 -7
- machineconfig/scripts/python/ai/scripts/lint_and_type_check.sh +10 -5
- machineconfig/scripts/python/archive/tmate_conn.py +5 -5
- machineconfig/scripts/python/archive/tmate_start.py +7 -7
- machineconfig/scripts/python/choose_wezterm_theme.py +35 -32
- machineconfig/scripts/python/cloud_copy.py +23 -14
- machineconfig/scripts/python/cloud_mount.py +36 -24
- machineconfig/scripts/python/cloud_repo_sync.py +40 -27
- machineconfig/scripts/python/cloud_sync.py +4 -4
- machineconfig/scripts/python/croshell.py +40 -29
- machineconfig/scripts/python/devops.py +45 -27
- machineconfig/scripts/python/devops_add_identity.py +15 -25
- machineconfig/scripts/python/devops_add_ssh_key.py +8 -8
- machineconfig/scripts/python/devops_backup_retrieve.py +18 -16
- machineconfig/scripts/python/devops_devapps_install.py +25 -20
- machineconfig/scripts/python/devops_update_repos.py +232 -59
- machineconfig/scripts/python/dotfile.py +17 -15
- machineconfig/scripts/python/fire_agents.py +48 -22
- machineconfig/scripts/python/fire_jobs.py +93 -58
- machineconfig/scripts/python/ftpx.py +26 -15
- machineconfig/scripts/python/get_zellij_cmd.py +8 -7
- machineconfig/scripts/python/helpers/cloud_helpers.py +33 -28
- machineconfig/scripts/python/helpers/helpers2.py +27 -16
- machineconfig/scripts/python/helpers/helpers4.py +45 -32
- machineconfig/scripts/python/helpers/helpers5.py +1 -1
- machineconfig/scripts/python/helpers/repo_sync_helpers.py +32 -10
- machineconfig/scripts/python/mount_nfs.py +9 -16
- machineconfig/scripts/python/mount_nw_drive.py +10 -5
- machineconfig/scripts/python/mount_ssh.py +9 -7
- machineconfig/scripts/python/repos.py +216 -58
- machineconfig/scripts/python/snapshot.py +0 -1
- machineconfig/scripts/python/start_slidev.py +11 -6
- machineconfig/scripts/python/start_terminals.py +22 -16
- machineconfig/scripts/python/viewer_template.py +0 -1
- machineconfig/scripts/python/wifi_conn.py +49 -75
- machineconfig/scripts/python/wsl_windows_transfer.py +9 -7
- machineconfig/scripts/windows/checkout_version.ps1 +1 -3
- machineconfig/scripts/windows/choose_wezterm_theme.ps1 +1 -3
- machineconfig/scripts/windows/cloud_copy.ps1 +2 -6
- machineconfig/scripts/windows/cloud_manager.ps1 +1 -1
- machineconfig/scripts/windows/cloud_repo_sync.ps1 +1 -2
- machineconfig/scripts/windows/cloud_sync.ps1 +2 -2
- machineconfig/scripts/windows/croshell.ps1 +2 -2
- machineconfig/scripts/windows/devops.ps1 +1 -4
- machineconfig/scripts/windows/dotfile.ps1 +1 -3
- machineconfig/scripts/windows/fire.ps1 +1 -1
- machineconfig/scripts/windows/ftpx.ps1 +2 -2
- machineconfig/scripts/windows/gpt.ps1 +1 -1
- machineconfig/scripts/windows/kill_process.ps1 +1 -2
- machineconfig/scripts/windows/mcinit.ps1 +1 -1
- machineconfig/scripts/windows/mount_nfs.ps1 +1 -1
- machineconfig/scripts/windows/mount_ssh.ps1 +1 -1
- machineconfig/scripts/windows/pomodoro.ps1 +1 -1
- machineconfig/scripts/windows/py2exe.ps1 +1 -3
- machineconfig/scripts/windows/repos.ps1 +1 -1
- machineconfig/scripts/windows/scheduler.ps1 +1 -1
- machineconfig/scripts/windows/snapshot.ps1 +2 -2
- machineconfig/scripts/windows/start_slidev.ps1 +1 -1
- machineconfig/scripts/windows/start_terminals.ps1 +1 -1
- machineconfig/scripts/windows/wifi_conn.ps1 +1 -1
- machineconfig/scripts/windows/wsl_windows_transfer.ps1 +1 -3
- machineconfig/settings/lf/linux/lfrc +2 -1
- machineconfig/settings/linters/.ruff_cache/.gitignore +2 -0
- machineconfig/settings/linters/.ruff_cache/CACHEDIR.TAG +1 -0
- machineconfig/settings/lvim/windows/archive/config_additional.lua +1 -1
- machineconfig/settings/svim/linux/init.toml +1 -1
- machineconfig/settings/svim/windows/init.toml +1 -1
- machineconfig/setup_linux/web_shortcuts/croshell.sh +3 -52
- machineconfig/setup_linux/web_shortcuts/interactive.sh +6 -6
- machineconfig/setup_linux/web_shortcuts/ssh.sh +0 -4
- machineconfig/setup_windows/web_shortcuts/all.ps1 +2 -2
- machineconfig/setup_windows/web_shortcuts/ascii_art.ps1 +1 -1
- machineconfig/setup_windows/web_shortcuts/croshell.ps1 +1 -1
- machineconfig/setup_windows/web_shortcuts/interactive.ps1 +5 -5
- machineconfig/setup_windows/wt_and_pwsh/install_fonts.ps1 +51 -15
- machineconfig/setup_windows/wt_and_pwsh/set_pwsh_theme.py +58 -13
- machineconfig/setup_windows/wt_and_pwsh/set_wt_settings.py +45 -37
- machineconfig/utils/ai/generate_file_checklist.py +8 -10
- machineconfig/utils/ai/url2md.py +4 -2
- machineconfig/utils/cloud/onedrive/setup_oauth.py +1 -0
- machineconfig/utils/cloud/onedrive/transaction.py +63 -98
- machineconfig/utils/code.py +62 -41
- machineconfig/utils/installer.py +29 -35
- machineconfig/utils/installer_utils/installer_abc.py +11 -11
- machineconfig/utils/installer_utils/installer_class.py +155 -74
- machineconfig/utils/links.py +112 -31
- machineconfig/utils/notifications.py +211 -0
- machineconfig/utils/options.py +41 -42
- machineconfig/utils/path.py +13 -6
- machineconfig/utils/path_reduced.py +614 -311
- machineconfig/utils/procs.py +48 -42
- machineconfig/utils/scheduling.py +0 -1
- machineconfig/utils/source_of_truth.py +27 -0
- machineconfig/utils/ssh.py +146 -85
- machineconfig/utils/terminal.py +84 -37
- machineconfig/utils/upgrade_packages.py +91 -0
- machineconfig/utils/utils2.py +39 -50
- machineconfig/utils/utils5.py +195 -116
- machineconfig/utils/ve.py +13 -5
- {machineconfig-2.0.dist-info → machineconfig-2.2.dist-info}/METADATA +14 -13
- {machineconfig-2.0.dist-info → machineconfig-2.2.dist-info}/RECORD +212 -237
- machineconfig/jobs/__pycache__/__init__.cpython-311.pyc +0 -0
- machineconfig/jobs/python/__pycache__/__init__.cpython-311.pyc +0 -0
- machineconfig/jobs/python/__pycache__/python_ve_symlink.cpython-311.pyc +0 -0
- machineconfig/jobs/python/archive/python_tools.txt +0 -12
- machineconfig/jobs/python/vscode/__pycache__/select_interpreter.cpython-311.pyc +0 -0
- machineconfig/jobs/python_custom_installers/__pycache__/__init__.cpython-311.pyc +0 -0
- machineconfig/jobs/python_generic_installers/__pycache__/__init__.cpython-311.pyc +0 -0
- machineconfig/jobs/python_generic_installers/update.py +0 -3
- machineconfig/jobs/python_linux_installers/__pycache__/__init__.cpython-311.pyc +0 -0
- machineconfig/profile/__pycache__/__init__.cpython-311.pyc +0 -0
- machineconfig/profile/__pycache__/create.cpython-311.pyc +0 -0
- machineconfig/profile/__pycache__/shell.cpython-311.pyc +0 -0
- machineconfig/scripts/__pycache__/__init__.cpython-311.pyc +0 -0
- machineconfig/scripts/linux/activate_ve +0 -87
- machineconfig/scripts/python/__pycache__/__init__.cpython-311.pyc +0 -0
- machineconfig/scripts/python/__pycache__/cloud_copy.cpython-311.pyc +0 -0
- machineconfig/scripts/python/__pycache__/cloud_mount.cpython-311.pyc +0 -0
- machineconfig/scripts/python/__pycache__/cloud_sync.cpython-311.pyc +0 -0
- machineconfig/scripts/python/__pycache__/croshell.cpython-311.pyc +0 -0
- machineconfig/scripts/python/__pycache__/devops.cpython-311.pyc +0 -0
- machineconfig/scripts/python/__pycache__/devops_backup_retrieve.cpython-311.pyc +0 -0
- machineconfig/scripts/python/__pycache__/devops_devapps_install.cpython-311.pyc +0 -0
- machineconfig/scripts/python/__pycache__/devops_update_repos.cpython-311.pyc +0 -0
- machineconfig/scripts/python/__pycache__/fire_agents.cpython-311.pyc +0 -0
- machineconfig/scripts/python/__pycache__/fire_jobs.cpython-311.pyc +0 -0
- machineconfig/scripts/python/__pycache__/fire_jobs.cpython-313.pyc +0 -0
- machineconfig/scripts/python/__pycache__/get_zellij_cmd.cpython-311.pyc +0 -0
- machineconfig/scripts/python/__pycache__/repos.cpython-311.pyc +0 -0
- machineconfig/scripts/python/ai/__pycache__/init.cpython-311.pyc +0 -0
- machineconfig/scripts/python/ai/__pycache__/mcinit.cpython-311.pyc +0 -0
- machineconfig/scripts/python/helpers/__pycache__/__init__.cpython-311.pyc +0 -0
- machineconfig/scripts/python/helpers/__pycache__/__init__.cpython-313.pyc +0 -0
- machineconfig/scripts/python/helpers/__pycache__/cloud_helpers.cpython-311.pyc +0 -0
- machineconfig/scripts/python/helpers/__pycache__/helpers2.cpython-311.pyc +0 -0
- machineconfig/scripts/python/helpers/__pycache__/helpers4.cpython-311.pyc +0 -0
- machineconfig/scripts/python/helpers/__pycache__/helpers4.cpython-313.pyc +0 -0
- machineconfig/scripts/python/helpers/__pycache__/repo_sync_helpers.cpython-311.pyc +0 -0
- machineconfig/scripts/windows/activate_ve.ps1 +0 -54
- machineconfig/setup_linux/web_shortcuts/all.sh +0 -48
- machineconfig/setup_linux/web_shortcuts/update_system.sh +0 -48
- machineconfig/utils/utils.py +0 -95
- /machineconfig/setup_linux/web_shortcuts/{tmp.sh → android.sh} +0 -0
- {machineconfig-2.0.dist-info → machineconfig-2.2.dist-info}/WHEEL +0 -0
- {machineconfig-2.0.dist-info → machineconfig-2.2.dist-info}/top_level.txt +0 -0
|
@@ -4,12 +4,14 @@ This script Takes away all config files from the computer, place them in one dir
|
|
|
4
4
|
|
|
5
5
|
"""
|
|
6
6
|
|
|
7
|
-
|
|
8
7
|
import platform
|
|
9
|
-
from machineconfig.utils.path_reduced import
|
|
10
|
-
from machineconfig.utils.
|
|
8
|
+
from machineconfig.utils.path_reduced import PathExtended as PathExtended
|
|
9
|
+
from machineconfig.utils.links import symlink_copy as symlink_func
|
|
10
|
+
from machineconfig.utils.options import display_options
|
|
11
|
+
from machineconfig.utils.source_of_truth import LIBRARY_ROOT, REPO_ROOT
|
|
11
12
|
from machineconfig.utils.utils2 import read_toml
|
|
12
13
|
from machineconfig.profile.shell import create_default_shell_profile
|
|
14
|
+
|
|
13
15
|
# import os
|
|
14
16
|
import subprocess
|
|
15
17
|
from rich.console import Console
|
|
@@ -36,19 +38,24 @@ def main_symlinks(choice: Optional[str] = None):
|
|
|
36
38
|
if program_key in exclude or OTHER_SYSTEM in program_key:
|
|
37
39
|
# print(f"🚫 Skipping {program_key} for {system}")
|
|
38
40
|
continue
|
|
39
|
-
else:
|
|
41
|
+
else:
|
|
42
|
+
program_keys.append(program_key)
|
|
40
43
|
|
|
41
44
|
program_keys.sort()
|
|
42
45
|
if choice is None:
|
|
43
46
|
choice_selected = display_options(msg="Which symlink to create?", options=program_keys + ["all", "none(EXIT)"], default="none(EXIT)", fzf=True, multi=True)
|
|
44
47
|
assert isinstance(choice_selected, list)
|
|
45
|
-
if len(choice_selected) == 1 and choice_selected[0] == "none(EXIT)":
|
|
46
|
-
|
|
48
|
+
if len(choice_selected) == 1 and choice_selected[0] == "none(EXIT)":
|
|
49
|
+
return # terminate function.
|
|
50
|
+
elif len(choice_selected) == 1 and choice_selected[0] == "all":
|
|
51
|
+
choice_selected = "all" # i.e. program_keys = program_keys
|
|
47
52
|
# overwrite = display_options(msg="Overwrite existing source file?", options=["yes", "no"], default="yes") == "yes"
|
|
48
53
|
from rich.prompt import Confirm
|
|
54
|
+
|
|
49
55
|
overwrite = Confirm.ask("Overwrite existing source file?", default=True)
|
|
50
56
|
|
|
51
|
-
else:
|
|
57
|
+
else:
|
|
58
|
+
choice_selected = choice
|
|
52
59
|
|
|
53
60
|
if isinstance(choice_selected, str):
|
|
54
61
|
if choice_selected == "all":
|
|
@@ -57,14 +64,16 @@ def main_symlinks(choice: Optional[str] = None):
|
|
|
57
64
|
{program_keys}
|
|
58
65
|
""")
|
|
59
66
|
pass # i.e. program_keys = program_keys
|
|
60
|
-
else:
|
|
61
|
-
|
|
67
|
+
else:
|
|
68
|
+
program_keys = [choice_selected]
|
|
69
|
+
else:
|
|
70
|
+
program_keys = choice_selected
|
|
62
71
|
|
|
63
72
|
for program_key in program_keys:
|
|
64
73
|
print(f"\n🔄 Creating hardlinks for {program_key}...")
|
|
65
74
|
for file_key, file_map in symlink_mapper[program_key].items():
|
|
66
|
-
this = PathExtended(file_map[
|
|
67
|
-
to_this = PathExtended(file_map[
|
|
75
|
+
this = PathExtended(file_map["this"])
|
|
76
|
+
to_this = PathExtended(file_map["to_this"].replace("REPO_ROOT", REPO_ROOT.as_posix()).replace("LIBRARY_ROOT", LIBRARY_ROOT.as_posix()))
|
|
68
77
|
if "contents" in file_map:
|
|
69
78
|
try:
|
|
70
79
|
for a_target in to_this.expanduser().search("*"):
|
|
@@ -91,22 +100,22 @@ def main_symlinks(choice: Optional[str] = None):
|
|
|
91
100
|
|
|
92
101
|
if system == "Linux":
|
|
93
102
|
print("\n📜 Setting executable permissions for scripts...")
|
|
94
|
-
subprocess.run(f
|
|
103
|
+
subprocess.run(f"chmod +x {LIBRARY_ROOT.joinpath(f'scripts/{system.lower()}')} -R", shell=True, capture_output=True, text=True)
|
|
95
104
|
print("✅ Script permissions updated")
|
|
96
105
|
|
|
97
106
|
if len(ERROR_LIST) > 0:
|
|
98
107
|
print(f"""
|
|
99
|
-
{
|
|
108
|
+
{"=" * 80}
|
|
100
109
|
❗ ERRORS ENCOUNTERED DURING PROCESSING
|
|
101
|
-
{
|
|
110
|
+
{"=" * 80}
|
|
102
111
|
{ERROR_LIST}
|
|
103
|
-
{
|
|
112
|
+
{"=" * 80}
|
|
104
113
|
""")
|
|
105
114
|
else:
|
|
106
115
|
print(f"""
|
|
107
|
-
{
|
|
116
|
+
{"=" * 80}
|
|
108
117
|
✅ All hardlinks created successfully!
|
|
109
|
-
{
|
|
118
|
+
{"=" * 80}
|
|
110
119
|
""")
|
|
111
120
|
|
|
112
121
|
|
|
@@ -121,11 +130,11 @@ def main(choice: Optional[str] = None):
|
|
|
121
130
|
create_default_shell_profile()
|
|
122
131
|
|
|
123
132
|
print(f"""
|
|
124
|
-
{
|
|
133
|
+
{"=" * 80}
|
|
125
134
|
✨ Configuration setup complete! ✨
|
|
126
|
-
{
|
|
135
|
+
{"=" * 80}
|
|
127
136
|
""")
|
|
128
137
|
|
|
129
138
|
|
|
130
|
-
if __name__ ==
|
|
139
|
+
if __name__ == "__main__":
|
|
131
140
|
pass
|
machineconfig/profile/shell.py
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
"""shell
|
|
2
|
-
"""
|
|
1
|
+
"""shell"""
|
|
3
2
|
|
|
4
3
|
from machineconfig.utils.utils2 import randstr
|
|
5
|
-
from machineconfig.utils.path_reduced import
|
|
4
|
+
from machineconfig.utils.path_reduced import PathExtended as PathExtended
|
|
6
5
|
from machineconfig.utils.terminal import Terminal
|
|
7
|
-
from machineconfig.utils.
|
|
6
|
+
from machineconfig.utils.options import display_options
|
|
7
|
+
from machineconfig.utils.source_of_truth import LIBRARY_ROOT, REPO_ROOT
|
|
8
8
|
import platform
|
|
9
9
|
import os
|
|
10
10
|
from typing import Literal, Optional
|
|
@@ -27,8 +27,10 @@ BOX_WIDTH = 100 # Define BOX_WIDTH or get it from a config
|
|
|
27
27
|
def create_default_shell_profile() -> None:
|
|
28
28
|
profile_path = get_shell_profile_path()
|
|
29
29
|
profile = profile_path.read_text(encoding="utf-8")
|
|
30
|
-
if system == "Windows":
|
|
31
|
-
|
|
30
|
+
if system == "Windows":
|
|
31
|
+
source = f""". {str(PathExtended(LIBRARY_ROOT).joinpath("settings/shells/pwsh/init.ps1").collapseuser()).replace("~", "$HOME")}"""
|
|
32
|
+
else:
|
|
33
|
+
source = f"""source {str(PathExtended(LIBRARY_ROOT).joinpath("settings/shells/bash/init.sh").collapseuser()).replace("~", "$HOME")}"""
|
|
32
34
|
|
|
33
35
|
if source in profile:
|
|
34
36
|
console.print(Panel("🔄 PROFILE | Skipping init script sourcing - already present in profile", title="[bold blue]Profile[/bold blue]", border_style="blue"))
|
|
@@ -49,17 +51,20 @@ def get_shell_profile_path() -> PathExtended:
|
|
|
49
51
|
if system == "Windows":
|
|
50
52
|
obj = Terminal().run("$PROFILE", shell="pwsh")
|
|
51
53
|
res = obj.op2path()
|
|
52
|
-
if isinstance(res, PathExtended):
|
|
54
|
+
if isinstance(res, PathExtended):
|
|
55
|
+
profile_path = res
|
|
53
56
|
else:
|
|
54
57
|
obj.print(capture=False)
|
|
55
58
|
raise ValueError(f"""Could not get profile path for Windows. Got {res}""")
|
|
56
|
-
elif system == "Linux":
|
|
57
|
-
|
|
59
|
+
elif system == "Linux":
|
|
60
|
+
profile_path = PathExtended("~/.bashrc").expanduser()
|
|
61
|
+
else:
|
|
62
|
+
raise ValueError(f"""Not implemented for this system {system}""")
|
|
58
63
|
console.print(Panel(f"""🐚 SHELL PROFILE | Working with path: `{profile_path}`""", title="[bold blue]Shell Profile[/bold blue]", border_style="blue"))
|
|
59
64
|
return profile_path
|
|
60
65
|
|
|
61
66
|
|
|
62
|
-
def append_temporarily(dirs: list[str], kind: Literal[
|
|
67
|
+
def append_temporarily(dirs: list[str], kind: Literal["append", "prefix", "replace"]) -> str:
|
|
63
68
|
dirs_ = []
|
|
64
69
|
for path in dirs:
|
|
65
70
|
path_rel = PathExtended(path).collapseuser(strict=False)
|
|
@@ -68,24 +73,33 @@ def append_temporarily(dirs: list[str], kind: Literal['append', 'prefix', 'repla
|
|
|
68
73
|
else:
|
|
69
74
|
dirs_.append(path_rel.as_posix() if system == "Linux" else str(path_rel))
|
|
70
75
|
dirs = dirs_
|
|
71
|
-
if len(dirs) == 0:
|
|
76
|
+
if len(dirs) == 0:
|
|
77
|
+
return ""
|
|
72
78
|
|
|
73
79
|
if system == "Windows":
|
|
74
80
|
"""Source: https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_environment_variables?view=powershell-7.2"""
|
|
75
|
-
if kind == "append":
|
|
76
|
-
|
|
77
|
-
elif kind == "
|
|
78
|
-
|
|
81
|
+
if kind == "append":
|
|
82
|
+
command = rf'$env:Path += ";{sep.join(dirs)}"' # Append to the Path variable in the current window:
|
|
83
|
+
elif kind == "prefix":
|
|
84
|
+
command = rf'$env:Path = "{sep.join(dirs)};" + $env:Path' # Prefix the Path variable in the current window:
|
|
85
|
+
elif kind == "replace":
|
|
86
|
+
command = rf'$env:Path = "{sep.join(dirs)}"' # Replace the Path variable in the current window (use with caution!):
|
|
87
|
+
else:
|
|
88
|
+
raise KeyError
|
|
79
89
|
return command # if run is False else tm.run(command, shell="powershell")
|
|
80
|
-
elif system in ["Linux", "Darwin"]:
|
|
81
|
-
|
|
90
|
+
elif system in ["Linux", "Darwin"]:
|
|
91
|
+
result = f'export PATH="{sep.join(dirs)}:$PATH"'
|
|
92
|
+
else:
|
|
93
|
+
raise ValueError
|
|
82
94
|
return result
|
|
83
95
|
|
|
96
|
+
|
|
84
97
|
def main_env_path(choice: Optional[str], profile_path: Optional[str]) -> None:
|
|
85
98
|
from machineconfig.utils.utils2 import read_toml
|
|
99
|
+
|
|
86
100
|
env_path = read_toml(LIBRARY_ROOT.joinpath("profile/env_path.toml"))
|
|
87
101
|
# env_path = LIBRARY_ROOT.joinpath("profile/env_path.toml").readit()
|
|
88
|
-
dirs = env_path[f
|
|
102
|
+
dirs = env_path[f"path_{system.lower()}"]["extension"]
|
|
89
103
|
|
|
90
104
|
console.print(Panel("🔍 ENVIRONMENT | Current PATH variables:", title="[bold blue]Environment[/bold blue]", border_style="blue"))
|
|
91
105
|
|
|
@@ -93,17 +107,19 @@ def main_env_path(choice: Optional[str], profile_path: Optional[str]) -> None:
|
|
|
93
107
|
tmp = display_options(msg="Which directory to add?", options=dirs + ["all", "none(EXIT)"], default="none(EXIT)")
|
|
94
108
|
assert isinstance(tmp, str), f"Choice must be a string or a list of strings, not {type(choice)}"
|
|
95
109
|
choice = tmp
|
|
96
|
-
if str(choice) != "all":
|
|
97
|
-
|
|
110
|
+
if str(choice) != "all":
|
|
111
|
+
dirs = [choice]
|
|
112
|
+
if choice == "none(EXIT)":
|
|
113
|
+
return
|
|
98
114
|
|
|
99
115
|
console.print(f"\n📌 Adding directories to PATH: {dirs}")
|
|
100
116
|
addition = append_temporarily(dirs=dirs, kind="append")
|
|
101
117
|
profile_path_obj = PathExtended(profile_path) if isinstance(profile_path, str) else get_shell_profile_path()
|
|
102
118
|
profile_path_obj.copy(name=profile_path_obj.name + ".orig_" + randstr())
|
|
103
119
|
console.print(f"💾 Created backup of profile: {profile_path_obj.name}.orig_*")
|
|
104
|
-
# Inline deprecated
|
|
120
|
+
# Inline deprecated modify_text: if file missing, seed with search text before modification
|
|
105
121
|
current = profile_path_obj.read_text(encoding="utf-8") if profile_path_obj.exists() else addition
|
|
106
|
-
updated =
|
|
122
|
+
updated = current if addition in current else current + "\n" + addition
|
|
107
123
|
profile_path_obj.write_text(updated, encoding="utf-8")
|
|
108
124
|
console.print(Panel("✅ PATH variables added to profile successfully", title="[bold blue]Environment[/bold blue]", border_style="blue"))
|
|
109
125
|
|
|
@@ -111,23 +127,29 @@ def main_env_path(choice: Optional[str], profile_path: Optional[str]) -> None:
|
|
|
111
127
|
def main_add_sources_to_shell_profile(profile_path: Optional[str], choice: Optional[str]) -> None:
|
|
112
128
|
# sources: list[str] = LIBRARY_ROOT.joinpath("profile/sources.toml").readit()[system.lower()]['files']
|
|
113
129
|
from machineconfig.utils.utils2 import read_toml
|
|
114
|
-
|
|
130
|
+
|
|
131
|
+
sources: list[str] = read_toml(LIBRARY_ROOT.joinpath("profile/sources.toml"))[system.lower()]["files"]
|
|
115
132
|
|
|
116
133
|
console.print(Panel("🔄 Adding sources to shell profile", title="[bold blue]Sources[/bold blue]", border_style="blue"))
|
|
117
134
|
|
|
118
135
|
if choice is None:
|
|
119
136
|
choice_obj = display_options(msg="Which patch to add?", options=sources + ["all", "none(EXIT)"], default="none(EXIT)", multi=True)
|
|
120
137
|
if isinstance(choice_obj, str):
|
|
121
|
-
if choice_obj == "all":
|
|
122
|
-
|
|
123
|
-
|
|
138
|
+
if choice_obj == "all":
|
|
139
|
+
choice = choice_obj
|
|
140
|
+
elif choice_obj == "none(EXIT)":
|
|
141
|
+
return
|
|
142
|
+
else:
|
|
143
|
+
sources = [choice_obj]
|
|
124
144
|
else: # isinstance(choice_obj, list):
|
|
125
145
|
sources = choice_obj
|
|
126
|
-
elif choice == "none(EXIT)":
|
|
146
|
+
elif choice == "none(EXIT)":
|
|
147
|
+
return
|
|
127
148
|
|
|
128
149
|
if isinstance(profile_path, str):
|
|
129
150
|
profile_path_obj = PathExtended(profile_path)
|
|
130
|
-
else:
|
|
151
|
+
else:
|
|
152
|
+
profile_path_obj = get_shell_profile_path()
|
|
131
153
|
profile = profile_path_obj.read_text(encoding="utf-8")
|
|
132
154
|
|
|
133
155
|
for a_file in sources:
|
|
@@ -141,7 +163,8 @@ def main_add_sources_to_shell_profile(profile_path: Optional[str], choice: Optio
|
|
|
141
163
|
elif system == "Linux":
|
|
142
164
|
profile += f"\nsource {file}"
|
|
143
165
|
console.print(f"➕ Added Bash source: {file}")
|
|
144
|
-
else:
|
|
166
|
+
else:
|
|
167
|
+
raise ValueError(f"Not implemented for this system {system}")
|
|
145
168
|
else:
|
|
146
169
|
console.print(f"⏭️ Source already present: {file}")
|
|
147
170
|
|
|
@@ -150,7 +173,7 @@ def main_add_sources_to_shell_profile(profile_path: Optional[str], choice: Optio
|
|
|
150
173
|
|
|
151
174
|
|
|
152
175
|
def main_add_patches_to_shell_profile(profile_path: Optional[str], choice: Optional[str]) -> None:
|
|
153
|
-
patches: list[str] = [item.as_posix() for item in LIBRARY_ROOT.joinpath(f"profile/patches/{system.lower()}").search()]
|
|
176
|
+
patches: list[str] = [item.as_posix() for item in PathExtended(LIBRARY_ROOT).joinpath(f"profile/patches/{system.lower()}").search()]
|
|
154
177
|
|
|
155
178
|
console.print(Panel("🩹 Adding patches to shell profile", title="[bold blue]Patches[/bold blue]", border_style="blue"))
|
|
156
179
|
|
|
@@ -158,7 +181,8 @@ def main_add_patches_to_shell_profile(profile_path: Optional[str], choice: Optio
|
|
|
158
181
|
choice_chosen = display_options(msg="Which patch to add?", options=list(patches) + ["all", "none(EXIT)"], default="none(EXIT)", multi=False)
|
|
159
182
|
assert isinstance(choice_chosen, str), f"Choice must be a string or a list of strings, not {type(choice)}"
|
|
160
183
|
choice = choice_chosen
|
|
161
|
-
if choice == "none(EXIT)":
|
|
184
|
+
if choice == "none(EXIT)":
|
|
185
|
+
return None
|
|
162
186
|
elif str(choice) == "all":
|
|
163
187
|
console.print("📌 Adding all patches to profile")
|
|
164
188
|
else:
|
|
@@ -187,5 +211,5 @@ def main_add_patches_to_shell_profile(profile_path: Optional[str], choice: Optio
|
|
|
187
211
|
console.print(Panel("✅ Shell profile updated with patches", title="[bold blue]Patches[/bold blue]", border_style="blue"))
|
|
188
212
|
|
|
189
213
|
|
|
190
|
-
if __name__ ==
|
|
214
|
+
if __name__ == "__main__":
|
|
191
215
|
pass
|
|
Binary file
|
|
@@ -59,7 +59,7 @@ curl bit.ly/cfgvelinux -L | bash
|
|
|
59
59
|
|
|
60
60
|
# Activate virtual environment
|
|
61
61
|
echo "🚀 Activating Python virtual environment..."
|
|
62
|
-
. $HOME/
|
|
62
|
+
. $HOME/code/machineconfig/.venv/bin/activate
|
|
63
63
|
|
|
64
64
|
# Clone repositories
|
|
65
65
|
echo "📋 Setting up code repositories..."
|
|
@@ -94,7 +94,7 @@ echo """#=======================================================================
|
|
|
94
94
|
|
|
95
95
|
# Activate virtual environment
|
|
96
96
|
echo "🚀 Activating Python virtual environment..."
|
|
97
|
-
. $HOME/scripts/activate_ve '
|
|
97
|
+
. $HOME/scripts/activate_ve '.venv'
|
|
98
98
|
|
|
99
99
|
# Install all essential development applications
|
|
100
100
|
echo "📥 Installing essential development applications..."
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
2
|
|
|
3
|
-
# check below if VIRTUAL_ENV is set
|
|
4
|
-
# if [ -z "$VIRTUAL_ENV" ]; then
|
|
5
|
-
# source ~/scripts/activate_ve ''
|
|
6
|
-
# fi
|
|
7
|
-
# source ~/scripts/activate_ve ve # this script only works under ve default ve.
|
|
8
|
-
|
|
9
3
|
op_script=$HOME/tmp_results/shells/python_return_command.sh
|
|
10
4
|
if [ -f "$op_script" ]; then
|
|
11
5
|
rm $op_script
|
|
12
6
|
fi
|
|
13
7
|
|
|
14
|
-
|
|
8
|
+
# source ~/code/machineconfig/.venv/bin/activate
|
|
9
|
+
# python -m machineconfig.scripts.python.devops "$@"
|
|
10
|
+
# echo "🔄 Running devops script..."
|
|
11
|
+
uv run --no-dev --project $HOME/code/machineconfig python -m machineconfig.scripts.python.devops "$@"
|
|
12
|
+
# uv run --with machineconfig python -m machineconfig.scripts.python.devops "$@"
|
|
13
|
+
|
|
14
|
+
|
|
15
15
|
if [ -f "$op_script" ]; then
|
|
16
16
|
chmod +x $op_script
|
|
17
17
|
source $op_script
|
machineconfig/scripts/linux/fire
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
source ~/code/machineconfig/.venv/bin/activate
|
|
4
|
+
|
|
4
5
|
|
|
5
6
|
# Generate random string of length 5
|
|
6
7
|
random_str=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 10 | head -n 1)
|
|
@@ -17,7 +18,7 @@ if [ -f "$op_script" ]; then
|
|
|
17
18
|
echo "Running $op_script"
|
|
18
19
|
chmod +x $op_script
|
|
19
20
|
set -- # clear all positional parameters
|
|
20
|
-
source $op_script # sourcing the script means the args passed to the this script are passed to the sourced script which cofuses the sources script as it
|
|
21
|
+
source $op_script # sourcing the script means the args passed to the this script are passed to the sourced script which cofuses the sources script as it and it doesn't understand first.sh arguments.
|
|
21
22
|
fi
|
|
22
23
|
|
|
23
24
|
|
machineconfig/scripts/linux/ftpx
CHANGED