primitive 0.2.16__py3-none-any.whl → 0.2.17__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 CHANGED
@@ -1,4 +1,4 @@
1
1
  # SPDX-FileCopyrightText: 2024-present Dylan Stein <dylan@primitive.tech>
2
2
  #
3
3
  # SPDX-License-Identifier: MIT
4
- __version__ = "0.2.16"
4
+ __version__ = "0.2.17"
@@ -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,23 +18,15 @@ 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
25
  "tech.primitive.agent",
33
- executable=str(found_primitive_binary_path),
34
26
  command="--debug agent",
35
27
  ),
36
28
  "monitor": LaunchAgent(
37
29
  "tech.primitive.monitor",
38
- executable=str(found_primitive_binary_path),
39
30
  command="--debug monitor",
40
31
  ),
41
32
  }
@@ -43,11 +34,11 @@ class Daemons:
43
34
  self.daemons: Dict[str, Daemon] = {
44
35
  "agent": LaunchService(
45
36
  "tech.primitive.agent",
46
- command=f'/bin/sh -lc "{found_primitive_binary_path} --debug agent"',
37
+ command="--debug agent",
47
38
  ),
48
39
  "monitor": LaunchService(
49
40
  "tech.primitive.monitor",
50
- command=f'/bin/sh -lc "{found_primitive_binary_path} --debug 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, executable: str, command: 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">
@@ -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}",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: primitive
3
- Version: 0.2.16
3
+ Version: 0.2.17
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=HrQQaOWuqVOmGCuXjJQ4OHW4-hRY9aXKjk3BQ63-Bw4,130
1
+ primitive/__about__.py,sha256=7h3S_fyrblrEjxFc0qcWxiNiEvkzKDNdS-Xn5G9baOg,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=a5DP60day_l19bIx-ThRsN4V7zHPFwqcMYnhnVrplCU,2975
16
+ primitive/daemons/actions.py,sha256=NWBPOn2l5pTYlocFYhYHxmsIiwF-ItroJygaD3UqJkI,2466
17
17
  primitive/daemons/commands.py,sha256=Xt4qFymNrDLdHJhRnEH_4Re-2xX6w1OT-chV9k7dFCs,2670
18
- primitive/daemons/launch_agents.py,sha256=VQ-c9PVTOr3JVt2jfLxIPDS1glKyBM2oDAzSUsFP9_A,7455
19
- primitive/daemons/launch_service.py,sha256=JA2kj1obCzu9sGmLFUMdEVKI-aj018b_tZBor0wVJSQ,7531
18
+ primitive/daemons/launch_agents.py,sha256=3IzfUXmdcGoNVzOhKhbDjZmZq8XT6UM38-438BcTKVg,7740
19
+ primitive/daemons/launch_service.py,sha256=vQlmh8kR1GZdKyTkMAhiIFaWjNDizoTiXcMHTtqTyPg,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.16.dist-info/METADATA,sha256=YIJsHdl6uWQvkyzjA3T02ECntyeUxPHjdeichj6JvGk,3733
100
- primitive-0.2.16.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
101
- primitive-0.2.16.dist-info/entry_points.txt,sha256=p1K8DMCWka5FqLlqP1sPek5Uovy9jq8u51gUsP-z334,48
102
- primitive-0.2.16.dist-info/licenses/LICENSE.txt,sha256=B8kmQMJ2sxYygjCLBk770uacaMci4mPSoJJ8WoDBY_c,1098
103
- primitive-0.2.16.dist-info/RECORD,,
99
+ primitive-0.2.17.dist-info/METADATA,sha256=-PHPccgNwo1ypTIksFavN__Ktd7AaIaPtMDY2V6kOTc,3733
100
+ primitive-0.2.17.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
101
+ primitive-0.2.17.dist-info/entry_points.txt,sha256=p1K8DMCWka5FqLlqP1sPek5Uovy9jq8u51gUsP-z334,48
102
+ primitive-0.2.17.dist-info/licenses/LICENSE.txt,sha256=B8kmQMJ2sxYygjCLBk770uacaMci4mPSoJJ8WoDBY_c,1098
103
+ primitive-0.2.17.dist-info/RECORD,,