machineconfig 1.8__py3-none-any.whl → 1.91__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.

Files changed (56) hide show
  1. machineconfig/__init__.py +4 -2
  2. machineconfig/jobs/python/check_installations.py +8 -6
  3. machineconfig/jobs/python/checkout_version.py +27 -32
  4. machineconfig/jobs/python/create_bootable_media.py +1 -1
  5. machineconfig/jobs/python/python_cargo_build_share.py +2 -2
  6. machineconfig/jobs/python/tasks.py +2 -2
  7. machineconfig/jobs/python_custom_installers/gh.py +53 -0
  8. machineconfig/jobs/python_custom_installers/hx.py +55 -0
  9. machineconfig/profile/create.py +26 -21
  10. machineconfig/profile/create_hardlinks.py +101 -0
  11. machineconfig/profile/shell.py +5 -5
  12. machineconfig/scripts/python/choose_wezterm_theme.py +96 -0
  13. machineconfig/scripts/python/cloud_copy.py +24 -17
  14. machineconfig/scripts/python/cloud_mount.py +20 -10
  15. machineconfig/scripts/python/cloud_repo_sync.py +109 -56
  16. machineconfig/scripts/python/cloud_sync.py +73 -68
  17. machineconfig/scripts/python/croshell.py +23 -14
  18. machineconfig/scripts/python/devops.py +19 -20
  19. machineconfig/scripts/python/devops_backup_retrieve.py +19 -10
  20. machineconfig/scripts/python/devops_devapps_install.py +81 -57
  21. machineconfig/scripts/python/devops_update_repos.py +5 -5
  22. machineconfig/scripts/python/dotfile.py +4 -4
  23. machineconfig/scripts/python/fire_jobs.py +139 -66
  24. machineconfig/scripts/python/ftpx.py +17 -7
  25. machineconfig/scripts/python/gh_models.py +53 -0
  26. machineconfig/scripts/python/mount_nfs.py +1 -1
  27. machineconfig/scripts/python/mount_nw_drive.py +3 -3
  28. machineconfig/scripts/python/mount_ssh.py +2 -3
  29. machineconfig/scripts/python/pomodoro.py +1 -1
  30. machineconfig/scripts/python/repos.py +26 -23
  31. machineconfig/scripts/python/scheduler.py +1 -1
  32. machineconfig/scripts/python/start_slidev.py +10 -4
  33. machineconfig/scripts/python/start_terminals.py +6 -5
  34. machineconfig/scripts/python/wifi_conn.py +34 -42
  35. machineconfig/scripts/python/wsl_windows_transfer.py +1 -1
  36. machineconfig/setup_windows/wt_and_pwsh/set_pwsh_theme.py +1 -1
  37. machineconfig/setup_windows/wt_and_pwsh/set_wt_settings.py +3 -2
  38. machineconfig/utils/installer.py +167 -60
  39. machineconfig/utils/procs.py +2 -2
  40. machineconfig/utils/scheduling.py +3 -3
  41. machineconfig/utils/utils.py +137 -56
  42. machineconfig/utils/ve.py +171 -100
  43. machineconfig-1.91.dist-info/LICENSE +201 -0
  44. {machineconfig-1.8.dist-info → machineconfig-1.91.dist-info}/METADATA +31 -11
  45. machineconfig-1.91.dist-info/RECORD +69 -0
  46. {machineconfig-1.8.dist-info → machineconfig-1.91.dist-info}/WHEEL +1 -1
  47. machineconfig/jobs/script_installer/azure_data_studio.py +0 -22
  48. machineconfig/jobs/script_installer/bypass_paywall.py +0 -23
  49. machineconfig/jobs/script_installer/code.py +0 -34
  50. machineconfig/jobs/script_installer/docker_desktop.py +0 -41
  51. machineconfig/jobs/script_installer/ngrok.py +0 -29
  52. machineconfig/jobs/script_installer/skim.py +0 -21
  53. machineconfig/jobs/script_installer/wezterm.py +0 -34
  54. machineconfig-1.8.dist-info/RECORD +0 -70
  55. /machineconfig/jobs/{script_installer → python_custom_installers}/__init__.py +0 -0
  56. {machineconfig-1.8.dist-info → machineconfig-1.91.dist-info}/top_level.txt +0 -0
@@ -8,7 +8,7 @@ import argparse
8
8
  # import subprocess
9
9
  # import platform
10
10
  from crocodile.file_management import P, randstr
11
- from machineconfig.utils.ve import get_ipython_profile, get_ve_profile
11
+ from machineconfig.utils.ve import get_ipython_profile, get_ve_profile, get_ve_name_and_ipython_profile
12
12
  from machineconfig.utils.utils import PROGRAM_PATH, display_options
13
13
 
14
14
 
@@ -34,8 +34,8 @@ def get_read_data_pycode(path: str):
34
34
  p = P(r\'{path}\').absolute()
35
35
  try:
36
36
  dat = p.readit()
37
- if type(dat) == Struct: dat.print(as_config=True, title=p.name)
38
- else: print(f"Succcesfully read the file {{p.name}}")
37
+ if isinstance(dat, dict): Struct(dat).print(as_config=True, title=p.name)
38
+ else: print(f"Successfully read the file {{p.name}}")
39
39
  except Exception as e:
40
40
  print(e)
41
41
 
@@ -43,7 +43,7 @@ except Exception as e:
43
43
  return pycode
44
44
 
45
45
 
46
- def get_read_pyfile_pycode(path: P, as_module: bool, cmd: str = ""):
46
+ def get_read_pyfile_pycode(path: P, as_module: bool, cmd: str=""):
47
47
  if as_module: pycode = fr"""
48
48
  import sys
49
49
  sys.path.append(r'{path.parent}')
@@ -72,8 +72,8 @@ def build_parser():
72
72
  parser.add_argument("--read", "-r", dest="read", help="read a binary file.", default="")
73
73
  parser.add_argument("--file", "-f", dest="file", help="python file path to interpret", default="")
74
74
  parser.add_argument("--cmd", "-c", dest="cmd", help="python command to interpret", default="")
75
- parser.add_argument("--terminal", "-t", dest="terminal", help=f"specify which terminal to be used. Default console host.", default="") # can choose `wt`
76
- parser.add_argument("--shell", "-S", dest="shell", help=f"specify which shell to be used. Defaults to CMD.", default="")
75
+ parser.add_argument("--terminal", "-t", dest="terminal", help="specify which terminal to be used. Default console host.", default="") # can choose `wt`
76
+ parser.add_argument("--shell", "-S", dest="shell", help="specify which shell to be used. Defaults to CMD.", default="")
77
77
 
78
78
  args = parser.parse_args()
79
79
  # print(f"Crocodile.run: args of the firing command = {args.__dict__}")
@@ -93,17 +93,23 @@ def build_parser():
93
93
  options = P.cwd().search("*.py", r=True).apply(str).list
94
94
  file = display_options(msg="Choose a python file to run", options=options, fzf=True, multi=False, )
95
95
  assert isinstance(file, str)
96
- if profile is None: profile = profile = get_ipython_profile(P(file))
96
+ if profile is None:
97
+ profile = get_ipython_profile(P(file))
97
98
  program = P(file).read_text(encoding='utf-8')
98
99
 
99
100
  elif args.file != "":
100
101
  file = P(args.file.lstrip()).expanduser().absolute()
101
- if profile is None: profile = profile = get_ipython_profile(P(file))
102
+ if profile is None:
103
+ profile = get_ipython_profile(P(file))
102
104
  program = get_read_pyfile_pycode(file, as_module=args.module, cmd=args.cmd)
103
105
 
104
106
  elif args.read != "":
105
107
  file = P(str(args.read).lstrip()).expanduser().absolute()
106
- if profile is None: profile = profile = get_ipython_profile(P(file))
108
+ ve_name_from_file, ipy_profile_from_file = get_ve_name_and_ipython_profile(init_path=P(file))
109
+ # if profile is None:
110
+ # profile = get_ipython_profile(P(file))
111
+ if profile is None: profile = ipy_profile_from_file
112
+ if args.ve is None: args.ve = ve_name_from_file
107
113
  program = get_read_data_pycode(str(file))
108
114
 
109
115
  else: # just run croshell.py interactively
@@ -129,18 +135,21 @@ print_logo(logo="crocodile")
129
135
  total_program = preprogram + add_print_header_pycode(str(pyfile), title=title) + program
130
136
 
131
137
  pyfile.write_text(total_program, encoding='utf-8')
132
- if profile is None: profile = "default"
138
+ if profile is None:
139
+ profile = get_ipython_profile(P.cwd())
140
+ # profile = "default"
133
141
 
134
142
  ve = get_ve_profile(P(file)) if args.ve is None else str(args.ve)
135
143
 
136
144
  final_program = f"""
137
- # deactivate
138
- . activate_ve {ve}
145
+ . $HOME/scripts/activate_ve '{ve}'
139
146
  {interpreter} """
140
- if interpreter == "ipython": final_program += f"{interactivity} --profile {profile} --no-banner"
147
+ if interpreter == "ipython":
148
+ final_program += f"{interactivity} --profile {profile} --no-banner"
141
149
  final_program += f" {str(pyfile)}"
142
150
  print(f"🔥 sourcing ... {pyfile}")
143
- PROGRAM_PATH.write_text(final_program)
151
+ # print(f"Running ... {final_program}")
152
+ PROGRAM_PATH.write_text(data=final_program)
144
153
 
145
154
  # if platform.system() == "Windows":
146
155
  # return subprocess.run([f"powershell", "-Command", res], shell=True, capture_output=False, text=True, check=True)
@@ -1,9 +1,8 @@
1
1
 
2
2
 
3
-
4
3
  """devops
5
4
  """
6
- from crocodile.file_management import P
5
+
7
6
  from machineconfig.utils.utils import display_options, PROGRAM_PATH, write_shell_script
8
7
  from platform import system
9
8
  from enum import Enum
@@ -49,19 +48,19 @@ def main(which: Optional[str] = None):
49
48
 
50
49
  elif choice_key == Options.ve.value:
51
50
  program = ""
52
- reply: bool = False
53
- if P.cwd().joinpath(".ve.ini").exists():
54
- reply = input("Detected .ve.ini file. Do you want to use it to build ve? (y/[n]): ") == "y"
55
- if reply:
56
- from machineconfig.utils.ve import get_ve_install_script_from_specs
57
- program_win = get_ve_install_script_from_specs(repo_root=P.cwd().str, system="Windows")
58
- program_lin = get_ve_install_script_from_specs(repo_root=P.cwd().str, system="Linux")
59
- install_reply = input("Proceed with installation? (y/[n]): ") == "y"
60
- if not install_reply: program = ""
61
- else:
62
- if system() == "Windows": program = program_win
63
- elif system() == "Linux": program = program_lin
64
- else: raise ValueError(f"Unknown system: {system()}")
51
+ reply: bool=False
52
+ # if P.cwd().joinpath(".ve.ini").exists():
53
+ # reply = input("Detected .ve.ini file. Do you want to use it to build ve? (y/[n]): ") == "y"
54
+ # if reply:
55
+ # from machineconfig.utils.ve import get_ve_install_script_from_specs
56
+ # program_win = get_ve_install_script_from_specs(repo_root=P.cwd().to_str(), system="Windows")
57
+ # program_lin = get_ve_install_script_from_specs(repo_root=P.cwd().to_str(), system="Linux")
58
+ # install_reply = input("Proceed with installation? (y/[n]): ") == "y"
59
+ # if not install_reply: program = ""
60
+ # else:
61
+ # if system() == "Windows": program = program_win
62
+ # elif system() == "Linux": program = program_lin
63
+ # else: raise ValueError(f"Unknown system: {system()}")
65
64
 
66
65
  if not reply:
67
66
  from machineconfig.utils.ve import get_ve_install_script
@@ -92,18 +91,18 @@ def main(which: Optional[str] = None):
92
91
  program = helper.main()
93
92
 
94
93
  elif choice_key == Options.ssh_setup.value:
95
- program_windows = f"""Invoke-WebRequest https://raw.githubusercontent.com/thisismygitrepo/machineconfig/main/src/machineconfig/setup_windows/openssh_all.ps1 | Invoke-Expression # https://github.com/thisismygitrepo.keys"""
96
- program_linux = f"""curl https://raw.githubusercontent.com/thisismygitrepo/machineconfig/main/src/machineconfig/setup_linux/openssh_all.sh | sudo bash # https://github.com/thisismygitrepo.keys"""
94
+ program_windows = """Invoke-WebRequest https://raw.githubusercontent.com/thisismygitrepo/machineconfig/main/src/machineconfig/setup_windows/openssh_all.ps1 | Invoke-Expression # https://github.com/thisismygitrepo.keys"""
95
+ program_linux = """curl https://raw.githubusercontent.com/thisismygitrepo/machineconfig/main/src/machineconfig/setup_linux/openssh_all.sh | sudo bash # https://github.com/thisismygitrepo.keys"""
97
96
  program = program_linux if system() == "Linux" else program_windows
98
97
 
99
98
  elif choice_key == Options.ssh_setup_wsl.value:
100
- program = f"""curl https://raw.githubusercontent.com/thisismygitrepo/machineconfig/main/src/machineconfig/setup_linux/openssh_wsl.sh | sudo bash"""
99
+ program = """curl https://raw.githubusercontent.com/thisismygitrepo/machineconfig/main/src/machineconfig/setup_linux/openssh_wsl.sh | sudo bash"""
101
100
 
102
101
  elif choice_key == Options.backup.value:
103
- from machineconfig.scripts.python.devops_backup_retrieve import main as helper
102
+ from machineconfig.scripts.python.devops_backup_retrieve import main_backup_retrieve as helper
104
103
  program = helper(direction="BACKUP")
105
104
  elif choice_key == Options.retreive.value:
106
- from machineconfig.scripts.python.devops_backup_retrieve import main as helper
105
+ from machineconfig.scripts.python.devops_backup_retrieve import main_backup_retrieve as helper
107
106
  program = helper(direction="RETRIEVE")
108
107
 
109
108
  elif choice_key == Options.scheduler.value:
@@ -4,7 +4,7 @@
4
4
 
5
5
  # import subprocess
6
6
  from crocodile.file_management import Read, P
7
- from machineconfig.utils.utils import LIBRARY_ROOT, DEFAULTS_PATH, print_code, choose_cloud_interactively, display_options
7
+ from machineconfig.utils.utils import LIBRARY_ROOT, DEFAULTS_PATH, print_code, choose_cloud_interactively, choose_multiple_options
8
8
  from machineconfig.scripts.python.cloud_sync import ES
9
9
  from platform import system
10
10
  from typing import Any, Literal, Optional
@@ -13,23 +13,25 @@ from typing import Any, Literal, Optional
13
13
  OPTIONS = Literal["BACKUP", "RETRIEVE"]
14
14
 
15
15
 
16
- def main(direction: OPTIONS, which: Optional[str] = None):
16
+ def main_backup_retrieve(direction: OPTIONS, which: Optional[str] = None):
17
17
  try:
18
18
  cloud: str = Read.ini(DEFAULTS_PATH)['general']['rclone_config_name']
19
19
  print(f"\n{'--' * 50}\n ⚠️ Using default cloud: `{cloud}` ⚠️\n{'--' * 50}\n")
20
20
  except (FileNotFoundError, KeyError, IndexError): cloud = choose_cloud_interactively()
21
21
 
22
- bu_file: dict[str, Any] = LIBRARY_ROOT.joinpath("profile/backup.toml").readit()
22
+ bu_file: dict[str, Any] = Read.toml(LIBRARY_ROOT.joinpath("profile/backup.toml"))
23
23
  if system() == "Linux": bu_file = {key: val for key, val in bu_file.items() if "windows" not in key}
24
24
  elif system() == "Windows": bu_file = {key: val for key, val in bu_file.items() if "linux" not in key}
25
25
 
26
26
  if which is None:
27
- choice_key = display_options(msg=f"WHICH FILE of the following do you want to {direction}?", options=['all'] + list(bu_file.keys()))
28
- assert isinstance(choice_key, str)
29
- else: choice_key = which
27
+ choices = choose_multiple_options(msg=f"WHICH FILE of the following do you want to {direction}?", options=['all'] + list(bu_file.keys()))
28
+ else:
29
+ choices = which.split(",") if isinstance(which, str) else which
30
30
 
31
- if choice_key == "all": items = bu_file
32
- else: items = {choice_key: bu_file[choice_key]}
31
+ if "all" in choices: items = bu_file
32
+ else:
33
+ # items = {choices: bu_file[choices]}
34
+ items = {key: val for key, val in bu_file.items() if key in choices}
33
35
 
34
36
  program = f"""$cloud = "{cloud}:{ES}" \n """ if system() == "Windows" else f"""cloud="{cloud}:{ES}" \n """
35
37
  for item_name, item in items.items():
@@ -42,11 +44,18 @@ def main(direction: OPTIONS, which: Optional[str] = None):
42
44
  if flags: flags = "-" + flags
43
45
  if direction == "BACKUP": program += f"""\ncloud_copy "{P(item['path']).as_posix()}" $cloud {flags}\n"""
44
46
  elif direction == "RETRIEVE": program += f"""\ncloud_copy $cloud "{P(item['path']).as_posix()}" {flags}\n"""
45
- else: raise RuntimeError(f"Unknown direction: {direction}")
46
- if item_name == "dotfiles" and system() == "Linux": program += f"""\nchmod 700 ~/.ssh/*\n"""
47
+ else:
48
+ raise RuntimeError(f"Unknown direction: {direction}")
49
+ if item_name == "dotfiles" and system() == "Linux": program += """\nchmod 700 ~/.ssh/*\n"""
47
50
  print_code(program, lexer="shell", desc=f"{direction} script")
48
51
  return program
49
52
 
50
53
 
54
+ def main(direction: OPTIONS, which: Optional[str] = None):
55
+ code = main_backup_retrieve(direction=direction, which=which)
56
+ from machineconfig.utils.utils import write_shell_script
57
+ write_shell_script(program=code, desc="backup_retrieve.sh")
58
+
59
+
51
60
  if __name__ == "__main__":
52
61
  pass
@@ -3,76 +3,100 @@
3
3
  """
4
4
 
5
5
  # import subprocess
6
+ from tqdm import tqdm
6
7
  from crocodile.core import List as L
7
8
  from machineconfig.utils.utils import LIBRARY_ROOT, choose_multiple_options
8
- from machineconfig.utils.installer import get_installers, Installer, install_all
9
+ from machineconfig.utils.installer import get_installers, install_all, Installer, get_all_dicts
9
10
  from platform import system
10
- from typing import Any, Optional, Literal, TypeAlias
11
+ from typing import Any, Optional, Literal, TypeAlias, get_args
11
12
 
12
13
 
13
- WHICH: TypeAlias = Literal["AllEssentials", "EssentialsAndOthers", "SystemInstallers", "OtherDevApps", "PrecheckedCloudInstaller"]
14
+ WHICH_CAT: TypeAlias = Literal["AllEssentials", "EssentialsAndOthers", "SystemInstallers", "PrecheckedCloudInstaller"]
14
15
 
15
16
 
16
- def main(which: Optional[str] = None):
17
- sys = system()
18
- installers = get_installers(dev=False, system=sys) + get_installers(dev=True, system=sys)
19
- default = "AllEssentials"
20
- options = ["SystemInstallers", "OtherDevApps", "EssentialsAndOthers", "PrecheckedCloudInstaller"]
21
- options = [default] + options
22
- options = [x.get_description() for x in installers] + options
17
+ def main(which: Optional[WHICH_CAT | str] = None):
23
18
 
24
- if which is not None:
25
- return get_program(program_name=which, options=options, installers=list(installers))
19
+ if which is not None and which in get_args(WHICH_CAT): # install by category
20
+ return get_programs_by_category(program_name=which) # type: ignore
21
+
22
+ if which is not None: # install by name
23
+ program_total = ""
24
+ for a_which in (which.split(",") if type(which) == str else which):
25
+ kv = {}
26
+ for _category, v in get_all_dicts(system=system()).items():
27
+ kv.update(v)
28
+ if a_which not in kv:
29
+ raise ValueError(f"{a_which=} not found in {kv.keys()}")
30
+ print(f"Installing {a_which}", kv[a_which])
31
+ installer = Installer.from_dict(name=a_which, d=kv[a_which])
32
+ print(installer)
33
+ program = installer.install_robust(version=None) # finish the task
34
+ program = "echo 'Finished Installation'" # write an empty program
35
+ program_total += "\n" + program
36
+ return program_total
37
+
38
+ # interactive installation
39
+ installers = [Installer.from_dict(d=vd, name=name) for __kat, vds in get_all_dicts(system=system()).items() for name, vd in vds.items()]
40
+ options = [x.get_description() for x in tqdm(installers, desc="Checking installed programs")] + list(get_args(WHICH_CAT))
41
+ program_names = choose_multiple_options(msg="", options=options, header="CHOOSE DEV APP", default="AllEssentials")
26
42
 
27
- program_names = choose_multiple_options(msg="", options=options, header="CHOOSE DEV APP", default=str(default))
28
43
  total_program = ""
29
- for which in program_names:
30
- assert isinstance(which, str), f"program_name is not a string: {which}"
31
- total_program += "\n" + get_program(program_name=which, options=options, installers=list(installers))
44
+ for _an_idx, a_program_name in enumerate(program_names):
45
+ print(a_program_name)
46
+ if a_program_name in get_args(WHICH_CAT):
47
+ total_program += "\n" + get_programs_by_category(program_name=a_program_name) # type: ignore
48
+ else:
49
+ an_installer = installers[options.index(a_program_name)]
50
+ total_program += "\n" + an_installer.install_robust(version=None) # finish the task
32
51
  return total_program
33
52
 
34
53
 
35
- def get_program(program_name: str, options: list[str], installers: list[Installer]):
36
- if program_name == "AllEssentials" or program_name == "EssentialsAndOthers":
37
- installers_ = get_installers(dev=False, system=system())
38
- if program_name == "EssentialsAndOthers":
39
- installers_ += get_installers(dev=True, system=system())
40
- install_all(installers=L(installers))
41
- program = ""
42
- elif program_name == "SystemInstallers":
43
- if system() == "Windows": options_system = parse_apps_installer_windows(LIBRARY_ROOT.joinpath("setup_windows/apps.ps1").read_text())
44
- elif system() == "Linux": options_system = parse_apps_installer_linux(LIBRARY_ROOT.joinpath("setup_linux/apps.sh").read_text())
45
- else: raise NotImplementedError(f"System {system()} not supported")
46
- program_names = choose_multiple_options(msg="", options=sorted(list(options_system.keys())), header="CHOOSE DEV APP")
47
- program = ""
48
- for name in program_names:
49
- sub_program = options_system[name]
50
- if sub_program.startswith("#winget"): sub_program = sub_program[1:]
51
- program += "\n" + sub_program
52
- elif program_name == "OtherDevApps":
53
- installers = get_installers(dev=True, system=system())
54
- options__: list[str] = [x.get_description() for x in installers]
55
- program_names = choose_multiple_options(msg="", options=sorted(options__) + ["all"], header="CHOOSE DEV APP")
56
- if "all" in program_names: program_names = options__
57
- program = ""
58
- for name in program_names:
59
- try:
60
- idx = options__.index(name)
61
- except ValueError as ve:
62
- print(f"{name=}")
63
- print(f"{options__=}")
64
- raise ve
65
- sub_program = installers[idx].install_robust(version=None) # finish the task
66
- elif program_name == "PrecheckedCloudInstaller":
67
- from machineconfig.jobs.python.check_installations import PrecheckedCloudInstaller
68
- ci = PrecheckedCloudInstaller()
69
- ci.download_safe_apps(name="AllEssentials")
70
- program = ""
71
- else:
72
- idx = options.index(program_name)
73
- print(installers[idx])
74
- program = installers[idx].install_robust(version=None) # finish the task
75
- program = "echo 'Finished Installation'" # write an empty program
54
+ def get_programs_by_category(program_name: WHICH_CAT):
55
+ match program_name:
56
+ case "AllEssentials" | "EssentialsAndOthers":
57
+ installers_ = get_installers(dev=False, system=system())
58
+ if program_name == "EssentialsAndOthers":
59
+ installers_ += get_installers(dev=True, system=system())
60
+ install_all(installers=L(installers_))
61
+ program = ""
62
+
63
+ case "SystemInstallers":
64
+ if system() == "Windows": options_system = parse_apps_installer_windows(LIBRARY_ROOT.joinpath("setup_windows/apps.ps1").read_text())
65
+ elif system() == "Linux":
66
+ options_system_1 = parse_apps_installer_linux(LIBRARY_ROOT.joinpath("setup_linux/apps_dev.sh").read_text())
67
+ options_system_2 = parse_apps_installer_linux(LIBRARY_ROOT.joinpath("setup_linux/apps.sh").read_text())
68
+ options_system = {**options_system_1, **options_system_2}
69
+ else: raise NotImplementedError(f"System {system()} not supported")
70
+ program_names = choose_multiple_options(msg="", options=sorted(list(options_system.keys())), header="CHOOSE DEV APP")
71
+ program = ""
72
+ for name in program_names:
73
+ sub_program = options_system[name]
74
+ if sub_program.startswith("#winget"): sub_program = sub_program[1:]
75
+ program += "\n" + sub_program
76
+
77
+ # case "OtherDevApps":
78
+ # installers = get_installers(dev=True, system=system())
79
+ # options__: list[str] = [x.get_description() for x in tqdm(installers, desc="Checking installed programs")]
80
+ # program_names = choose_multiple_options(msg="", options=sorted(options__) + ["all"], header="CHOOSE DEV APP")
81
+ # if "all" in program_names: program_names = options__
82
+ # program = ""
83
+ # print("Installing:")
84
+ # L(program_names).print()
85
+ # for name in program_names:
86
+ # try:
87
+ # idx = options__.index(name)
88
+ # except ValueError as ve:
89
+ # print(f"{name=}")
90
+ # print(f"{options__=}")
91
+ # raise ve
92
+ # print(f"Installing {name}")
93
+ # sub_program = installers[idx].install_robust(version=None) # finish the task
94
+
95
+ case "PrecheckedCloudInstaller":
96
+ from machineconfig.jobs.python.check_installations import PrecheckedCloudInstaller
97
+ ci = PrecheckedCloudInstaller()
98
+ ci.download_safe_apps(name="AllEssentials")
99
+ program = ""
76
100
  return program
77
101
 
78
102
 
@@ -3,7 +3,6 @@
3
3
  """
4
4
 
5
5
  from crocodile.file_management import P, Read
6
- from crocodile.core import install_n_import
7
6
  from machineconfig.utils.utils import DEFAULTS_PATH
8
7
  from platform import system
9
8
 
@@ -11,7 +10,7 @@ from platform import system
11
10
  sep = "\n"
12
11
 
13
12
 
14
- def main(verbose: bool = True) -> str:
13
+ def main(verbose: bool=True) -> str:
15
14
  _ = verbose
16
15
  repos: list[str] = ["~/code/crocodile", "~/code/machineconfig", ]
17
16
  try:
@@ -20,10 +19,10 @@ def main(verbose: bool = True) -> str:
20
19
  repos += tmp
21
20
  except (FileNotFoundError, KeyError, IndexError):
22
21
  print(f"Missing {DEFAULTS_PATH} or section [general] or key repos. Using default repos.")
23
- print(f"""It should look like this:
22
+ print("""It should look like this:
24
23
  [general]
25
24
  repos = ~/code/repo1,~/code/repo2
26
- rclone_config_name = onedriveWork
25
+ rclone_config_name = onedrivePersonal
27
26
  email_config_name = Yahoo3
28
27
  to_email = myemail@email.com
29
28
  """)
@@ -31,7 +30,8 @@ to_email = myemail@email.com
31
30
  repos_objs = []
32
31
  for a_package_path in repos:
33
32
  try:
34
- repo = install_n_import("git", "gitpython").Repo(str(P(a_package_path).expanduser()), search_parent_directories=True)
33
+ import git
34
+ repo = git.Repo(str(P(a_package_path).expanduser()), search_parent_directories=True)
35
35
  repos_objs.append(repo)
36
36
  except Exception as ex:
37
37
  print(ex)
@@ -4,7 +4,7 @@
4
4
 
5
5
 
6
6
  from crocodile.file_management import P
7
- from machineconfig.profile.create import symlink
7
+ from machineconfig.profile.create import symlink_func
8
8
  from machineconfig.utils.utils import LIBRARY_ROOT, REPO_ROOT
9
9
  import argparse
10
10
 
@@ -16,7 +16,7 @@ def main():
16
16
  # FLAGS
17
17
  parser.add_argument("--overwrite", "-o", help="Overwrite.", action="store_true") # default is False
18
18
  # optional
19
- parser.add_argument("-d", "--dest", help=f"destination folder", default="")
19
+ parser.add_argument("-d", "--dest", help="destination folder", default="")
20
20
 
21
21
  args = parser.parse_args()
22
22
  orig_path = P(args.file).expanduser().absolute()
@@ -28,9 +28,9 @@ def main():
28
28
  new_path = REPO_ROOT.joinpath(junction)
29
29
  else: new_path = P(args.dest).expanduser().absolute().create().joinpath(orig_path.name)
30
30
 
31
- symlink(this=orig_path, to_this=new_path, prioritize_to_this=args.overwrite)
31
+ symlink_func(this=orig_path, to_this=new_path, prioritize_to_this=args.overwrite)
32
32
 
33
- print(f"Map completed. To enshrine this mapping, add the following line to the mapper.toml file:")
33
+ print("Map completed. To enshrine this mapping, add the following line to the mapper.toml file:")
34
34
  print(f"nano {LIBRARY_ROOT}/symlinks/mapper.toml")
35
35
  print(f"""
36
36
  [{new_path.parent.name}]