artemis_framework 0.2.0__tar.gz → 0.2.2__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 (18) hide show
  1. {artemis_framework-0.2.0 → artemis_framework-0.2.2}/PKG-INFO +1 -1
  2. artemis_framework-0.2.2/artemis_framework/asphodel/core/_gpg_binary.py +33 -0
  3. artemis_framework-0.2.2/artemis_framework/asphodel/core/macos_shim.py +83 -0
  4. {artemis_framework-0.2.0 → artemis_framework-0.2.2}/pyproject.toml +1 -1
  5. {artemis_framework-0.2.0 → artemis_framework-0.2.2}/LICENSE +0 -0
  6. {artemis_framework-0.2.0 → artemis_framework-0.2.2}/README.md +0 -0
  7. {artemis_framework-0.2.0 → artemis_framework-0.2.2}/artemis_framework/__init__.py +0 -0
  8. {artemis_framework-0.2.0 → artemis_framework-0.2.2}/artemis_framework/__main__.py +0 -0
  9. {artemis_framework-0.2.0 → artemis_framework-0.2.2}/artemis_framework/asphodel/__init__.py +0 -0
  10. {artemis_framework-0.2.0 → artemis_framework-0.2.2}/artemis_framework/asphodel/core/__init__.py +0 -0
  11. {artemis_framework-0.2.0 → artemis_framework-0.2.2}/artemis_framework/asphodel/core/armor_binary.py +0 -0
  12. {artemis_framework-0.2.0 → artemis_framework-0.2.2}/artemis_framework/asphodel/core/encrypt_decrypt.py +0 -0
  13. {artemis_framework-0.2.0 → artemis_framework-0.2.2}/artemis_framework/asphodel/core/gpg_context.py +0 -0
  14. {artemis_framework-0.2.0 → artemis_framework-0.2.2}/artemis_framework/asphodel/core/key_management.py +0 -0
  15. {artemis_framework-0.2.0 → artemis_framework-0.2.2}/artemis_framework/asphodel/core/sign_verify.py +0 -0
  16. {artemis_framework-0.2.0 → artemis_framework-0.2.2}/artemis_framework/elysium/__ini +0 -0
  17. {artemis_framework-0.2.0 → artemis_framework-0.2.2}/artemis_framework/elysium/__init__.py +0 -0
  18. {artemis_framework-0.2.0 → artemis_framework-0.2.2}/artemis_framework/tartarus/__init__.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: artemis_framework
3
- Version: 0.2.0
3
+ Version: 0.2.2
4
4
  Summary: A package for doing great things!
5
5
  License: MIT
6
6
  License-File: LICENSE
@@ -0,0 +1,33 @@
1
+ import os
2
+ import sys
3
+ import platform
4
+ from pathlib import Path
5
+
6
+
7
+ def get_base_path():
8
+ if getattr(sys, "frozen", False):
9
+ return Path(sys._MEIPASS)
10
+
11
+ return Path(__file__).resolve().parent
12
+
13
+
14
+ def get_gpg_binary():
15
+ system = platform.system()
16
+
17
+ if system == "Darwin":
18
+ from artemis_framework.asphodel.core.macos_shim import activate, bundled_gpg_binary
19
+ activate()
20
+ bundled = bundled_gpg_binary()
21
+ if bundled and bundled.exists():
22
+ return bundled
23
+ return Path("gpg")
24
+
25
+ base = get_base_path()
26
+
27
+ if system == "Windows":
28
+ return base / "bundled" / "windows" / "gnupg" / "bin" / "gpg.exe"
29
+
30
+ if system == "Linux":
31
+ return base / "bundled" / "linux" / "gpg"
32
+
33
+ raise RuntimeError(f"Unsupported OS: {system}")
@@ -0,0 +1,83 @@
1
+ from __future__ import annotations
2
+
3
+ import os
4
+ import sys
5
+ import atexit
6
+ from pathlib import Path
7
+
8
+
9
+ _PLACEHOLDER = Path("tmp/gnupg_shim")
10
+ _shim_active = False
11
+
12
+
13
+ def _bundle_macos_dir() -> Path | None:
14
+ import platform
15
+ if platform.system() != "Darwin":
16
+ return None
17
+
18
+ if getattr(sys, "frozen", False):
19
+ base = Path(sys._MEIPASS)
20
+ else:
21
+ base = Path(__file__).resolve().parent
22
+
23
+ candidate = base / "bundled" / "macos"
24
+ return candidate if candidate.exists() else None
25
+
26
+
27
+ def activate() -> bool:
28
+ global _shim_active
29
+
30
+ if _shim_active:
31
+ return True
32
+
33
+ bundle_dir = _bundle_macos_dir()
34
+ if bundle_dir is None:
35
+ return True
36
+
37
+ try:
38
+ if _PLACEHOLDER.is_symlink():
39
+ current_target = Path(os.readlink(_PLACEHOLDER))
40
+ if current_target == bundle_dir:
41
+ _shim_active = True
42
+ return True
43
+
44
+ _PLACEHOLDER.unlink()
45
+
46
+ elif _PLACEHOLDER.exists():
47
+ print(
48
+ f"[WARN] macos_shim: {_PLACEHOLDER} exists and is not a symlink. "
49
+ "Falling back to system GPG.",
50
+ file=sys.stderr
51
+ )
52
+ return False
53
+
54
+ _PLACEHOLDER.symlink_to(bundle_dir)
55
+ _shim_active = True
56
+
57
+ atexit.register(_deactivate)
58
+ return True
59
+
60
+ except OSError as exc:
61
+ print(f"[WARN] macos_shim: could not create shim: {exc}", file=sys.stderr)
62
+ return False
63
+
64
+
65
+ def _deactivate() -> None:
66
+ global _shim_active
67
+ try:
68
+ if _PLACEHOLDER.is_symlink():
69
+ target = Path(os.readlink(_PLACEHOLDER))
70
+ bundle_dir = _bundle_macos_dir()
71
+ if bundle_dir and target == bundle_dir:
72
+ _PLACEHOLDER.unlink()
73
+
74
+ except OSError:
75
+ pass
76
+ _shim_active = False
77
+
78
+
79
+ def bundled_gpg_binary() -> Path | None:
80
+ if not _shim_active:
81
+ activate()
82
+ candidate = _PLACEHOLDER / "bin" / "gpg"
83
+ return candidate if candidate.exists() else None
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "artemis_framework"
3
- version = "0.2.0"
3
+ version = "0.2.2"
4
4
  description = "A package for doing great things!"
5
5
  authors = ["Dylan Garrett"]
6
6
  license = "MIT"