sysetup 1.4.1__tar.gz → 1.4.3__tar.gz

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.
Files changed (41) hide show
  1. {sysetup-1.4.1/src/sysetup.egg-info → sysetup-1.4.3}/PKG-INFO +7 -10
  2. {sysetup-1.4.1 → sysetup-1.4.3}/README.md +4 -8
  3. sysetup-1.4.3/bin/pw +10 -0
  4. {sysetup-1.4.1 → sysetup-1.4.3}/pyproject.toml +3 -2
  5. {sysetup-1.4.1 → sysetup-1.4.3}/src/sysetup/context/context.py +3 -2
  6. sysetup-1.4.3/src/sysetup/context/secrets_.py +10 -0
  7. {sysetup-1.4.1 → sysetup-1.4.3}/src/sysetup/main/files/assets.py +5 -5
  8. {sysetup-1.4.1 → sysetup-1.4.3}/src/sysetup/main/installations.py +19 -2
  9. {sysetup-1.4.1 → sysetup-1.4.3}/src/sysetup/utils/bitwarden.py +9 -2
  10. {sysetup-1.4.1 → sysetup-1.4.3}/src/sysetup/utils/download.py +13 -5
  11. {sysetup-1.4.1 → sysetup-1.4.3/src/sysetup.egg-info}/PKG-INFO +7 -10
  12. {sysetup-1.4.1 → sysetup-1.4.3}/src/sysetup.egg-info/SOURCES.txt +1 -0
  13. {sysetup-1.4.1 → sysetup-1.4.3}/src/sysetup.egg-info/requires.txt +2 -1
  14. {sysetup-1.4.1 → sysetup-1.4.3}/tests/test_background.py +2 -6
  15. sysetup-1.4.1/bin/pw +0 -4
  16. {sysetup-1.4.1 → sysetup-1.4.3}/LICENSE +0 -0
  17. {sysetup-1.4.1 → sysetup-1.4.3}/bin/pw-askpass +0 -0
  18. {sysetup-1.4.1 → sysetup-1.4.3}/setup.cfg +0 -0
  19. {sysetup-1.4.1 → sysetup-1.4.3}/src/sysetup/__init__.py +0 -0
  20. {sysetup-1.4.1 → sysetup-1.4.3}/src/sysetup/cli/__init__.py +0 -0
  21. {sysetup-1.4.1 → sysetup-1.4.3}/src/sysetup/cli/entry_point.py +0 -0
  22. {sysetup-1.4.1 → sysetup-1.4.3}/src/sysetup/context/__init__.py +0 -0
  23. {sysetup-1.4.1 → sysetup-1.4.3}/src/sysetup/context/action.py +0 -0
  24. {sysetup-1.4.1 → sysetup-1.4.3}/src/sysetup/context/installations.py +0 -0
  25. {sysetup-1.4.1 → sysetup-1.4.3}/src/sysetup/context/options.py +0 -0
  26. {sysetup-1.4.1 → sysetup-1.4.3}/src/sysetup/main/__init__.py +0 -0
  27. {sysetup-1.4.1 → sysetup-1.4.3}/src/sysetup/main/files/__init__.py +0 -0
  28. {sysetup-1.4.1 → sysetup-1.4.3}/src/sysetup/main/files/permissions.py +0 -0
  29. {sysetup-1.4.1 → sysetup-1.4.3}/src/sysetup/main/files/settings.py +0 -0
  30. {sysetup-1.4.1 → sysetup-1.4.3}/src/sysetup/main/files/setup.py +0 -0
  31. {sysetup-1.4.1 → sysetup-1.4.3}/src/sysetup/main/main.py +0 -0
  32. {sysetup-1.4.1 → sysetup-1.4.3}/src/sysetup/main/packages.py +0 -0
  33. {sysetup-1.4.1 → sysetup-1.4.3}/src/sysetup/models/__init__.py +0 -0
  34. {sysetup-1.4.1 → sysetup-1.4.3}/src/sysetup/models/path.py +0 -0
  35. {sysetup-1.4.1 → sysetup-1.4.3}/src/sysetup/py.typed +0 -0
  36. {sysetup-1.4.1 → sysetup-1.4.3}/src/sysetup/utils/__init__.py +0 -0
  37. {sysetup-1.4.1 → sysetup-1.4.3}/src/sysetup.egg-info/dependency_links.txt +0 -0
  38. {sysetup-1.4.1 → sysetup-1.4.3}/src/sysetup.egg-info/entry_points.txt +0 -0
  39. {sysetup-1.4.1 → sysetup-1.4.3}/src/sysetup.egg-info/top_level.txt +0 -0
  40. {sysetup-1.4.1 → sysetup-1.4.3}/tests/test_cli_entry_point.py +0 -0
  41. {sysetup-1.4.1 → sysetup-1.4.3}/tests/test_main.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sysetup
3
- Version: 1.4.1
3
+ Version: 1.4.3
4
4
  Summary: Personal system setup
5
5
  Author-email: Quinten Roets <qdr2104@columbia.edu>
6
6
  License-Expression: MIT
@@ -8,13 +8,14 @@ Project-URL: Source Code, https://github.com/quintenroets/sysetup
8
8
  Requires-Python: >=3.10
9
9
  Description-Content-Type: text/markdown
10
10
  License-File: LICENSE
11
- Requires-Dist: backupmaster<2,>=1.2.21
11
+ Requires-Dist: backupmaster<3,>=2.0.2
12
12
  Requires-Dist: dbus-next<1,>=0.2.3
13
13
  Requires-Dist: package-utils[context]<1,>=0.6.1
14
14
  Requires-Dist: powercli<1,>=0.3.1
15
15
  Requires-Dist: requests<3,>=2.32.3
16
16
  Requires-Dist: superpathlib<3,>=2.0.4
17
17
  Provides-Extra: dev
18
+ Requires-Dist: dirhash<1,>=0.5.0; extra == "dev"
18
19
  Requires-Dist: types-requests<3,>=2.32.0.20250306; extra == "dev"
19
20
  Requires-Dist: package-dev-tools<1,>=0.7.1; extra == "dev"
20
21
  Requires-Dist: package-dev-utils<1,>=0.1.6; extra == "dev"
@@ -40,14 +41,10 @@ Dynamic: license-file
40
41
  * Set wallpaper
41
42
  * Select We10OSX Cursors
42
43
  3) Configure autocpufreq
43
- 4) Setup Chrome
44
- * Enable GPU acceleration in chrome://flags
45
- * PDF viewer: set page zoom to page fit
46
- * Import certificate from Scripts/assets/sysetup/certificates/certificate.crt
47
- * Click experimental: enable tab groups save and sync
48
- 5) Login to
49
- * Pycharm professional
50
- 6) For new device: set touchpad scroll direction and click on touch
44
+ 4) Login to Pycharm professional
45
+ 5) For new device: configure mousepad
46
+ * natural touchpad scroll direction
47
+ * click on touch
51
48
 
52
49
  ## Installation
53
50
  ```shell
@@ -18,14 +18,10 @@
18
18
  * Set wallpaper
19
19
  * Select We10OSX Cursors
20
20
  3) Configure autocpufreq
21
- 4) Setup Chrome
22
- * Enable GPU acceleration in chrome://flags
23
- * PDF viewer: set page zoom to page fit
24
- * Import certificate from Scripts/assets/sysetup/certificates/certificate.crt
25
- * Click experimental: enable tab groups save and sync
26
- 5) Login to
27
- * Pycharm professional
28
- 6) For new device: set touchpad scroll direction and click on touch
21
+ 4) Login to Pycharm professional
22
+ 5) For new device: configure mousepad
23
+ * natural touchpad scroll direction
24
+ * click on touch
29
25
 
30
26
  ## Installation
31
27
  ```shell
sysetup-1.4.3/bin/pw ADDED
@@ -0,0 +1,10 @@
1
+ #! /bin/bash
2
+
3
+ password_name=${1:-Login}
4
+
5
+ if command -v ksshaskpass >/dev/null 2>&1; then
6
+ ksshaskpass -- "Enter passphrase for $password_name: "
7
+ else
8
+ security find-generic-password -s "$password_name" -a "autopass" -w
9
+ # to add: security add-generic-password -s "$password_name" -a "autopass" -U -w
10
+ fi
@@ -1,13 +1,13 @@
1
1
  [project]
2
2
  name = "sysetup"
3
- version = "1.4.1"
3
+ version = "1.4.3"
4
4
  description = "Personal system setup"
5
5
  authors = [{name = "Quinten Roets", email = "qdr2104@columbia.edu"}]
6
6
  license = "MIT"
7
7
  readme = "README.md"
8
8
  requires-python = ">=3.10"
9
9
  dependencies = [
10
- "backupmaster >=1.2.21, <2",
10
+ "backupmaster >=2.0.2, <3",
11
11
  "dbus-next >=0.2.3, <1",
12
12
  "package-utils[context] >=0.6.1, <1",
13
13
  "powercli >=0.3.1, <1",
@@ -17,6 +17,7 @@ dependencies = [
17
17
 
18
18
  [project.optional-dependencies]
19
19
  dev = [
20
+ "dirhash >=0.5.0, <1",
20
21
  "types-requests >=2.32.0.20250306, <3",
21
22
  "package-dev-tools >=0.7.1, <1",
22
23
  "package-dev-utils >=0.1.6, <1",
@@ -5,9 +5,10 @@ from package_utils.context import Context as Context_
5
5
 
6
6
  from .installations import is_installed
7
7
  from .options import Options
8
+ from .secrets_ import Secrets
8
9
 
9
10
 
10
- class Context(Context_[Options, None, None]):
11
+ class Context(Context_[Options, None, Secrets]):
11
12
  @cached_property
12
13
  def package_manager(self) -> str:
13
14
  options = "apt-get", "pacman"
@@ -22,4 +23,4 @@ class Context(Context_[Options, None, None]):
22
23
  return "DISPLAY" not in os.environ
23
24
 
24
25
 
25
- context = Context(Options)
26
+ context = Context(Options, Secrets=Secrets)
@@ -0,0 +1,10 @@
1
+ import os
2
+ from dataclasses import dataclass, field
3
+
4
+
5
+ @dataclass
6
+ class Secrets:
7
+ bw_clientid: str = field(default_factory=lambda: os.environ.get("BW_CLIENTID", ""))
8
+ bw_clientsecret: str = field(
9
+ default_factory=lambda: os.environ.get("BW_CLIENTSECRET", ""),
10
+ )
@@ -1,5 +1,6 @@
1
1
  import cli
2
- from backup.backups.cache import cache
2
+ from backup.syncer import Syncer
3
+ from backup.syncer.sync_configs import SyncConfigs
3
4
 
4
5
  from sysetup.models import Path
5
6
  from sysetup.utils import download_directory
@@ -33,12 +34,11 @@ def move_setup_files() -> None:
33
34
  else:
34
35
  archived_setup_files.append(path)
35
36
 
37
+ config = SyncConfigs.cache.with_paths(setup_files)
36
38
  if setup_files:
37
- cache.Backup(paths=setup_files).pull()
38
-
39
- source = cache.Backup().source
39
+ Syncer(config).capture_pull()
40
40
  for path in archived_setup_files:
41
- dest = (source / path.relative_to(setup_files_root)).parent
41
+ dest = (config.source / path.relative_to(setup_files_root)).parent
42
42
  if dest.is_root and not dest.exists():
43
43
  cli.run("mkdir -p", dest, root=True)
44
44
  else:
@@ -43,14 +43,31 @@ def install_chromium() -> None:
43
43
  def _install_chromium() -> None:
44
44
  release_name = cli.capture_output_lines("lsb_release -sc")[-1]
45
45
  repo_url = f"https://freeshell.de/phd/chromium/{release_name}"
46
+ key = "869689FE09306074"
47
+ keyring = "/usr/share/keyrings/phd-chromium.gpg"
48
+ sources_file = "/etc/apt/sources.list.d/phd-chromium.list"
46
49
  commands = (
47
- f'echo "deb {repo_url} /" | sudo tee /etc/apt/sources.list.d/phd-chromium.list',
48
- "apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 869689FE09306074",
50
+ f"gpg --keyserver keyserver.ubuntu.com --recv-keys {key}",
51
+ f"gpg --export {key} | sudo gpg --dearmor -o {keyring}",
52
+ f'echo "deb [signed-by={keyring}] {repo_url} /" | sudo tee {sources_file}',
49
53
  "apt-get update",
50
54
  "apt-get install -y chromium",
51
55
  )
52
56
  check = not context.is_running_in_test
53
57
  cli.run_commands(*commands, shell=True, root=True, check=check) # noqa: S604
58
+ install_custom_certificate()
59
+
60
+
61
+ def install_custom_certificate() -> None:
62
+ install(["libnss3-tools"])
63
+ certificate_directory = Path.HOME / ".pki" / "nssdb"
64
+ certificate_file = Path.assets / "certificates" / "certificate.crt"
65
+ command = (
66
+ f"certutil -d sql:{certificate_directory} "
67
+ f'-A -t "C,," -n "QCA" -i {certificate_file}'
68
+ )
69
+ if not context.is_running_in_test:
70
+ cli.run(command)
54
71
 
55
72
 
56
73
  def install_keyd() -> None:
@@ -29,8 +29,15 @@ class Client:
29
29
  def session_token(self) -> str:
30
30
  if not Path("bw").exists():
31
31
  self.download_cli()
32
- output = cli.capture_output(f"./bw login {self.email} {self.password}")
33
- return output.split("--session ")[-1]
32
+
33
+ logged_in = "userEmail" in cli.capture_output("./bw status")
34
+ command: tuple[str, ...] = "./bw unlock --raw", self.password
35
+ if not logged_in:
36
+ if context.secrets.bw_clientid:
37
+ cli.run("./bw login --apikey")
38
+ else:
39
+ command = "./bw login --raw", self.email, self.password
40
+ return cli.capture_output(*command)
34
41
 
35
42
  def download_cli(self) -> None:
36
43
  response = requests.get(self.download_url, timeout=10).content
@@ -1,9 +1,9 @@
1
1
  import os
2
2
 
3
3
  import cli
4
- from backup.backups import Backup
5
4
  from backup.context import context as backup_context
6
- from backup.models import Path as BackupPath
5
+ from backup.syncer import Syncer
6
+ from backup.syncer.sync_configs import select_sync_config
7
7
 
8
8
  from sysetup.models import Path
9
9
 
@@ -11,13 +11,21 @@ from .bitwarden import bitwarden
11
11
 
12
12
 
13
13
  def download_directory(path: Path) -> None:
14
- check_authenticated()
15
- Backup(sub_check_path=BackupPath(path), confirm=False).pull()
14
+ download_item(directory=path)
16
15
 
17
16
 
18
17
  def download_file(path: Path) -> None:
18
+ download_item(path)
19
+
20
+
21
+ def download_item(path: Path | None = None, directory: Path | None = None) -> None:
19
22
  check_authenticated()
20
- Backup(path=BackupPath(path), confirm=False).pull()
23
+ location = path or directory
24
+ assert location is not None
25
+ config = select_sync_config(location)
26
+ config.path = path
27
+ config.directory = directory
28
+ Syncer(config).capture_pull()
21
29
 
22
30
 
23
31
  def check_authenticated() -> None:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sysetup
3
- Version: 1.4.1
3
+ Version: 1.4.3
4
4
  Summary: Personal system setup
5
5
  Author-email: Quinten Roets <qdr2104@columbia.edu>
6
6
  License-Expression: MIT
@@ -8,13 +8,14 @@ Project-URL: Source Code, https://github.com/quintenroets/sysetup
8
8
  Requires-Python: >=3.10
9
9
  Description-Content-Type: text/markdown
10
10
  License-File: LICENSE
11
- Requires-Dist: backupmaster<2,>=1.2.21
11
+ Requires-Dist: backupmaster<3,>=2.0.2
12
12
  Requires-Dist: dbus-next<1,>=0.2.3
13
13
  Requires-Dist: package-utils[context]<1,>=0.6.1
14
14
  Requires-Dist: powercli<1,>=0.3.1
15
15
  Requires-Dist: requests<3,>=2.32.3
16
16
  Requires-Dist: superpathlib<3,>=2.0.4
17
17
  Provides-Extra: dev
18
+ Requires-Dist: dirhash<1,>=0.5.0; extra == "dev"
18
19
  Requires-Dist: types-requests<3,>=2.32.0.20250306; extra == "dev"
19
20
  Requires-Dist: package-dev-tools<1,>=0.7.1; extra == "dev"
20
21
  Requires-Dist: package-dev-utils<1,>=0.1.6; extra == "dev"
@@ -40,14 +41,10 @@ Dynamic: license-file
40
41
  * Set wallpaper
41
42
  * Select We10OSX Cursors
42
43
  3) Configure autocpufreq
43
- 4) Setup Chrome
44
- * Enable GPU acceleration in chrome://flags
45
- * PDF viewer: set page zoom to page fit
46
- * Import certificate from Scripts/assets/sysetup/certificates/certificate.crt
47
- * Click experimental: enable tab groups save and sync
48
- 5) Login to
49
- * Pycharm professional
50
- 6) For new device: set touchpad scroll direction and click on touch
44
+ 4) Login to Pycharm professional
45
+ 5) For new device: configure mousepad
46
+ * natural touchpad scroll direction
47
+ * click on touch
51
48
 
52
49
  ## Installation
53
50
  ```shell
@@ -18,6 +18,7 @@ src/sysetup/context/action.py
18
18
  src/sysetup/context/context.py
19
19
  src/sysetup/context/installations.py
20
20
  src/sysetup/context/options.py
21
+ src/sysetup/context/secrets_.py
21
22
  src/sysetup/main/__init__.py
22
23
  src/sysetup/main/installations.py
23
24
  src/sysetup/main/main.py
@@ -1,4 +1,4 @@
1
- backupmaster<2,>=1.2.21
1
+ backupmaster<3,>=2.0.2
2
2
  dbus-next<1,>=0.2.3
3
3
  package-utils[context]<1,>=0.6.1
4
4
  powercli<1,>=0.3.1
@@ -6,6 +6,7 @@ requests<3,>=2.32.3
6
6
  superpathlib<3,>=2.0.4
7
7
 
8
8
  [dev]
9
+ dirhash<1,>=0.5.0
9
10
  types-requests<3,>=2.32.0.20250306
10
11
  package-dev-tools<1,>=0.7.1
11
12
  package-dev-utils<1,>=0.1.6
@@ -1,7 +1,6 @@
1
1
  import os
2
2
  from collections.abc import Callable, Iterator
3
3
 
4
- import cli
5
4
  import pytest
6
5
  from backup.utils import setup
7
6
 
@@ -31,12 +30,9 @@ def restore_and_check(
31
30
  setup.check_setup()
32
31
 
33
32
  def _restore_and_check(restored_path: Path) -> Iterator[None]:
34
- def extract_content_hash() -> str:
35
- return cli.capture_output("rclone hashsum MD5", restored_path, check=False)
36
-
37
- content_hash = extract_content_hash()
33
+ content_hash = restored_path.content_hash
38
34
  yield from restore(restored_path)
39
- assert extract_content_hash() == content_hash
35
+ assert restored_path.content_hash == content_hash
40
36
 
41
37
  return _restore_and_check
42
38
 
sysetup-1.4.1/bin/pw DELETED
@@ -1,4 +0,0 @@
1
- #! /bin/bash
2
-
3
- password_name=${1:-Login}
4
- ksshaskpass -- "Enter passphrase for $password_name: "
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes