primitive 0.2.16__py3-none-any.whl → 0.2.18__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.
- primitive/__about__.py +1 -1
- primitive/daemons/actions.py +6 -15
- primitive/daemons/launch_agents.py +10 -3
- primitive/daemons/launch_service.py +10 -2
- {primitive-0.2.16.dist-info → primitive-0.2.18.dist-info}/METADATA +1 -1
- {primitive-0.2.16.dist-info → primitive-0.2.18.dist-info}/RECORD +9 -9
- {primitive-0.2.16.dist-info → primitive-0.2.18.dist-info}/WHEEL +0 -0
- {primitive-0.2.16.dist-info → primitive-0.2.18.dist-info}/entry_points.txt +0 -0
- {primitive-0.2.16.dist-info → primitive-0.2.18.dist-info}/licenses/LICENSE.txt +0 -0
primitive/__about__.py
CHANGED
primitive/daemons/actions.py
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
import platform
|
2
|
-
import subprocess
|
3
2
|
import typing
|
4
3
|
from pathlib import Path
|
5
4
|
from typing import Dict, List, Optional
|
@@ -19,35 +18,27 @@ class Daemons:
|
|
19
18
|
self.primitive: Primitive = primitive
|
20
19
|
self.os_family = platform.system()
|
21
20
|
|
22
|
-
result = subprocess.run(["which", "primitive"], capture_output=True)
|
23
|
-
if result.returncode == 0:
|
24
|
-
found_primitive_binary_path = result.stdout.decode().rstrip("\n")
|
25
|
-
else:
|
26
|
-
raise Exception("primitive binary not found")
|
27
|
-
|
28
21
|
match self.os_family:
|
29
22
|
case "Darwin":
|
30
23
|
self.daemons: Dict[str, Daemon] = {
|
31
24
|
"agent": LaunchAgent(
|
32
|
-
"tech.primitive.agent",
|
33
|
-
executable=str(found_primitive_binary_path),
|
25
|
+
label="tech.primitive.agent",
|
34
26
|
command="--debug agent",
|
35
27
|
),
|
36
28
|
"monitor": LaunchAgent(
|
37
|
-
"tech.primitive.monitor",
|
38
|
-
executable=str(found_primitive_binary_path),
|
29
|
+
label="tech.primitive.monitor",
|
39
30
|
command="--debug monitor",
|
40
31
|
),
|
41
32
|
}
|
42
33
|
case "Linux":
|
43
34
|
self.daemons: Dict[str, Daemon] = {
|
44
35
|
"agent": LaunchService(
|
45
|
-
"tech.primitive.agent",
|
46
|
-
command=
|
36
|
+
label="tech.primitive.agent",
|
37
|
+
command="--debug agent",
|
47
38
|
),
|
48
39
|
"monitor": LaunchService(
|
49
|
-
"tech.primitive.monitor",
|
50
|
-
command=
|
40
|
+
label="tech.primitive.monitor",
|
41
|
+
command="--debug monitor",
|
51
42
|
),
|
52
43
|
}
|
53
44
|
case _:
|
@@ -11,10 +11,9 @@ CURRENT_USER = str(HOME_DIRECTORY.expanduser()).lstrip("/Users/")
|
|
11
11
|
|
12
12
|
|
13
13
|
class LaunchAgent(Daemon):
|
14
|
-
def __init__(self, label: str,
|
14
|
+
def __init__(self, label: str, command: str):
|
15
15
|
self.label = label
|
16
16
|
self.name = label.split(".")[-1]
|
17
|
-
self.executable = executable
|
18
17
|
self.command = command
|
19
18
|
|
20
19
|
@property
|
@@ -106,6 +105,14 @@ class LaunchAgent(Daemon):
|
|
106
105
|
self.file_path.parent.mkdir(parents=True, exist_ok=True)
|
107
106
|
self.file_path.touch()
|
108
107
|
|
108
|
+
# this is here so that it won't break on primitive's init
|
109
|
+
# do not move
|
110
|
+
result = subprocess.run(["which", "primitive"], capture_output=True)
|
111
|
+
if result.returncode == 0:
|
112
|
+
self.executable = result.stdout.decode().rstrip("\n")
|
113
|
+
else:
|
114
|
+
raise Exception("primitive binary not found")
|
115
|
+
|
109
116
|
self.file_path.write_text(
|
110
117
|
f"""<?xml version="1.0" encoding="UTF-8"?>
|
111
118
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
@@ -181,8 +188,8 @@ class LaunchAgent(Daemon):
|
|
181
188
|
[
|
182
189
|
self.stop(),
|
183
190
|
self.unload(),
|
184
|
-
self.populate(),
|
185
191
|
self.create_stdout_file(),
|
192
|
+
self.populate(),
|
186
193
|
self.load(),
|
187
194
|
self.start(load=False),
|
188
195
|
]
|
@@ -121,8 +121,16 @@ class LaunchService(Daemon):
|
|
121
121
|
"After": "network.target",
|
122
122
|
}
|
123
123
|
|
124
|
+
# this is here so that it won't break on primitive's init
|
125
|
+
# do not move
|
126
|
+
result = subprocess.run(["which", "primitive"], capture_output=True)
|
127
|
+
if result.returncode == 0:
|
128
|
+
self.executable = result.stdout.decode().rstrip("\n")
|
129
|
+
else:
|
130
|
+
raise Exception("primitive binary not found")
|
131
|
+
|
124
132
|
config["Service"] = {
|
125
|
-
"ExecStart": self.command,
|
133
|
+
"ExecStart": f'/bin/sh -lc "{self.executable} {self.command}"',
|
126
134
|
"Restart": "always",
|
127
135
|
"StandardError": f"append:{self.logs}",
|
128
136
|
"StandardOutput": f"append:{self.logs}",
|
@@ -186,8 +194,8 @@ class LaunchService(Daemon):
|
|
186
194
|
[
|
187
195
|
self.stop(),
|
188
196
|
self.disable(),
|
189
|
-
self.populate(),
|
190
197
|
self.create_stdout_file(),
|
198
|
+
self.populate(),
|
191
199
|
self.enable(),
|
192
200
|
self.start(),
|
193
201
|
]
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: primitive
|
3
|
-
Version: 0.2.
|
3
|
+
Version: 0.2.18
|
4
4
|
Project-URL: Documentation, https://github.com//primitivecorp/primitive-cli#readme
|
5
5
|
Project-URL: Issues, https://github.com//primitivecorp/primitive-cli/issues
|
6
6
|
Project-URL: Source, https://github.com//primitivecorp/primitive-cli
|
@@ -1,4 +1,4 @@
|
|
1
|
-
primitive/__about__.py,sha256=
|
1
|
+
primitive/__about__.py,sha256=RIxrlKbwmawRHlio3BHfw8GueREygRiKu6jye9nolFM,130
|
2
2
|
primitive/__init__.py,sha256=bwKdgggKNVssJFVPfKSxqFMz4IxSr54WWbmiZqTMPNI,106
|
3
3
|
primitive/cli.py,sha256=g7EtHI9MATAB0qQu5w-WzbXtxz_8zu8z5E7sETmMkKU,2509
|
4
4
|
primitive/client.py,sha256=h8WZVnQylVe0vbpuyC8YZHl2JyITSPC-1HbUcmrE5pc,3623
|
@@ -13,10 +13,10 @@ primitive/auth/commands.py,sha256=2z5u5xX64n0yILucx9emtWh3uQXLvs2QQQQIldZGr94,23
|
|
13
13
|
primitive/auth/graphql/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
14
14
|
primitive/auth/graphql/queries.py,sha256=jhrr_VFzHIn8vcVprMIzUx7V4kkWYdR6CKMKPoVFv60,180
|
15
15
|
primitive/daemons/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
16
|
-
primitive/daemons/actions.py,sha256=
|
16
|
+
primitive/daemons/actions.py,sha256=vIkXV8azocHoSMGMJvEvXZztf7x7AU9ePe16cvLgC4s,2490
|
17
17
|
primitive/daemons/commands.py,sha256=Xt4qFymNrDLdHJhRnEH_4Re-2xX6w1OT-chV9k7dFCs,2670
|
18
|
-
primitive/daemons/launch_agents.py,sha256=
|
19
|
-
primitive/daemons/launch_service.py,sha256=
|
18
|
+
primitive/daemons/launch_agents.py,sha256=5MFDacs_IZd6PCm4VRNq9dPEYIDivkydBzqex1ggkFY,7740
|
19
|
+
primitive/daemons/launch_service.py,sha256=iuklHeuEqadlf8U1n9xFg4ZG1EKdK2jyaPI-VTlpJ4I,7907
|
20
20
|
primitive/daemons/ui.py,sha256=Af3OJWJ0jdGlb1nfA5yaGYdhBEqqpM8zP2U2vUQdCbw,1236
|
21
21
|
primitive/db/base.py,sha256=mH7f2d_jiyxJSSx9Gk53QBXRa3LiKBsBjkFgvmtH1WA,83
|
22
22
|
primitive/db/models.py,sha256=GfnJdAq4Tb68CI4BKAuJDZVqioGavveaAHbCPeLNngw,2840
|
@@ -96,8 +96,8 @@ primitive/utils/memory_size.py,sha256=4xfha21kW82nFvOTtDFx9Jk2ZQoEhkfXii-PGNTpIU
|
|
96
96
|
primitive/utils/printer.py,sha256=f1XUpqi5dkTL3GWvYRUGlSwtj2IxU1q745T4Fxo7Tn4,370
|
97
97
|
primitive/utils/shell.py,sha256=jWzb7ky7p987dJas6ZvarK3IJNZ5cwBXcryRWb9Uh6U,2072
|
98
98
|
primitive/utils/text.py,sha256=XiESMnlhjQ534xE2hMNf08WehE1SKaYFRNih0MmnK0k,829
|
99
|
-
primitive-0.2.
|
100
|
-
primitive-0.2.
|
101
|
-
primitive-0.2.
|
102
|
-
primitive-0.2.
|
103
|
-
primitive-0.2.
|
99
|
+
primitive-0.2.18.dist-info/METADATA,sha256=79Ptsf54EjO4GapJQH4XywOWzrWtcfAgpAHkYXGh39s,3733
|
100
|
+
primitive-0.2.18.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
101
|
+
primitive-0.2.18.dist-info/entry_points.txt,sha256=p1K8DMCWka5FqLlqP1sPek5Uovy9jq8u51gUsP-z334,48
|
102
|
+
primitive-0.2.18.dist-info/licenses/LICENSE.txt,sha256=B8kmQMJ2sxYygjCLBk770uacaMci4mPSoJJ8WoDBY_c,1098
|
103
|
+
primitive-0.2.18.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|