primitive 0.1.4__py3-none-any.whl → 0.1.5__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@steins.studio>
2
2
  #
3
3
  # SPDX-License-Identifier: MIT
4
- __version__ = "0.1.4"
4
+ __version__ = "0.1.5"
primitive/utils/shell.py CHANGED
@@ -3,61 +3,31 @@ import subprocess
3
3
 
4
4
 
5
5
  def add_path_to_shell(path: Path):
6
+ if not path.exists():
7
+ raise Exception(f"{path} does not exist.")
8
+
6
9
  try:
7
10
  subprocess.run(["fish_add_path", path], capture_output=True)
8
11
  return True
9
12
  except FileNotFoundError:
10
13
  pass
11
14
 
12
- if Path.home() / ".bash_profile":
13
- subprocess.run(
14
- [
15
- "echo",
16
- f"'export PATH={path}:$PATH'",
17
- ">>",
18
- "~/.bash_profile",
19
- ],
20
- capture_output=True,
21
- )
22
- elif Path.home() / ".bashrc":
23
- subprocess.run(
24
- [
25
- "echo",
26
- f"'export PATH={path}:$PATH'",
27
- ">>",
28
- "~/.bashrc",
29
- ],
30
- capture_output=True,
31
- )
32
- elif Path.home() / ".zshrc":
33
- subprocess.run(
34
- [
35
- "echo",
36
- f"'export PATH={path}:$PATH'",
37
- ">>",
38
- "~/.zshrc",
39
- ],
40
- capture_output=True,
41
- )
42
- elif Path.home() / ".profile":
43
- subprocess.run(
44
- [
45
- "echo",
46
- f"'export PATH={path}:$PATH'",
47
- ">>",
48
- "~/.profile",
49
- ],
50
- capture_output=True,
51
- )
52
- elif Path.home() / ".bash_login":
53
- subprocess.run(
54
- [
55
- "echo",
56
- f"'export PATH={path}:$PATH'",
57
- ">>",
58
- "~/.bash_login",
59
- ],
60
- capture_output=True,
61
- )
15
+ profile_path = None
16
+
17
+ if Path.home().joinpath(".bash_profile").exists():
18
+ profile_path = Path.home().joinpath(".bash_profile")
19
+ elif Path.home().joinpath(".bashrc").exists():
20
+ profile_path = Path.home().joinpath(".bashrc")
21
+ elif Path.home().joinpath(".zshrc").exists():
22
+ profile_path = Path.home().joinpath(".zshrc")
23
+ elif Path.home().joinpath(".profile").exists():
24
+ profile_path = Path.home().joinpath(".profile")
25
+ elif Path.home().joinpath(".bash_login").exists():
26
+ profile_path = Path.home().joinpath(".bash_login")
62
27
  else:
63
28
  raise Exception(f"Failed to add {path} to PATH")
29
+
30
+ with open(profile_path, "a") as file:
31
+ file.write(f"export PATH={path}:$PATH\n")
32
+
33
+ return True
@@ -18,9 +18,9 @@ def install_verible(system_info: dict) -> bool:
18
18
  url = VERIBLE_MAC_OS_LINK
19
19
  elif system_info.get("os_family") == "Windows":
20
20
  url = VERIBLE_WINDOWS_64_OS_LINK
21
- elif system_info.processor == "x86_64":
21
+ elif system_info.get("processor") == "x86_64":
22
22
  url = VERIBLE_LINUX_X86_64_OS_LINK
23
- elif system_info.processor == "arm":
23
+ elif system_info.get("processor") == "arm":
24
24
  url = VERIBLE_LINUX_X86_64_OS_LINK
25
25
 
26
26
  verible_dir_name = url.split("/")[-1].split(".tar.gz")[0]
@@ -43,7 +43,11 @@ def install_verible(system_info: dict) -> bool:
43
43
  logger.debug("Deleting tar.gz artifact")
44
44
  file_download_path.unlink()
45
45
 
46
- verible_bin = Path.home() / verible_dir_name / "bin"
46
+ unpacked_verible_dir_name = verible_dir_name
47
+ if "linux" in unpacked_verible_dir_name:
48
+ unpacked_verible_dir_name = unpacked_verible_dir_name.split("-linux")[0]
49
+
50
+ verible_bin = Path.home().joinpath(unpacked_verible_dir_name).joinpath("bin")
47
51
 
48
52
  logger.debug("Adding verible to PATH")
49
53
  add_path_to_shell(verible_bin)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: primitive
3
- Version: 0.1.4
3
+ Version: 0.1.5
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
@@ -36,6 +36,7 @@ Description-Content-Type: text/markdown
36
36
  **Table of Contents**
37
37
 
38
38
  - [Installation](#installation)
39
+ - [Configuration](#configuration)
39
40
  - [License](#license)
40
41
 
41
42
  ## Installation
@@ -44,6 +45,20 @@ Description-Content-Type: text/markdown
44
45
  pip install primitive
45
46
  ```
46
47
 
48
+ ## Configuration
49
+
50
+ ### Authenticate
51
+
52
+ ```console
53
+ primitive config
54
+ ```
55
+
56
+ ### Register your Hardware
57
+
58
+ ```console
59
+ primitive hardware register
60
+ ```
61
+
47
62
  ## License
48
63
 
49
64
  `primitive` is distributed under the terms of the [MIT](https://spdx.org/licenses/MIT.html) license.
@@ -1,4 +1,4 @@
1
- primitive/__about__.py,sha256=E2SXPkbuFZByKB4zIeOf_Me_bVBs-mUA8TpF7fO1FrM,128
1
+ primitive/__about__.py,sha256=eiRjGM6WtdYyj1eyR-jQ63lTpMSkzch2LxAzdXLwqzU,128
2
2
  primitive/__init__.py,sha256=bwKdgggKNVssJFVPfKSxqFMz4IxSr54WWbmiZqTMPNI,106
3
3
  primitive/cli.py,sha256=QC4jbu8s0uhNxFmaTO2B-X1o1gpyFX3xJVHU-j5CvQE,1705
4
4
  primitive/client.py,sha256=cZiJjzZ4HkCtYViDNOIoNuf7mcp772eSCSztsqh381E,2010
@@ -23,10 +23,10 @@ primitive/utils/files.py,sha256=Ug5UqrS9eZoTd08EFtgyyp8flsJTfsG9CwXBWmI-yFA,606
23
23
  primitive/utils/git.py,sha256=1qNOu8X-33CavmrD580BmrFhD_WVO9PGWHUUboXJR_g,663
24
24
  primitive/utils/memory_size.py,sha256=4xfha21kW82nFvOTtDFx9Jk2ZQoEhkfXii-PGNTpIUk,3058
25
25
  primitive/utils/printer.py,sha256=f1XUpqi5dkTL3GWvYRUGlSwtj2IxU1q745T4Fxo7Tn4,370
26
- primitive/utils/shell.py,sha256=xGsz3-3mmUP5xRrFotNj0UpbHmRSsiliQnyPzB48xLI,1567
27
- primitive/utils/verible.py,sha256=o2NBbqteePgFY-28S7AaEivSEszZcePFkMRXpg_XhHg,1990
28
- primitive-0.1.4.dist-info/METADATA,sha256=bW4QfYYNW6TWBazUnmjK3s7see0nYczt4UHcyupynYw,1642
29
- primitive-0.1.4.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
30
- primitive-0.1.4.dist-info/entry_points.txt,sha256=p1K8DMCWka5FqLlqP1sPek5Uovy9jq8u51gUsP-z334,48
31
- primitive-0.1.4.dist-info/licenses/LICENSE.txt,sha256=B8kmQMJ2sxYygjCLBk770uacaMci4mPSoJJ8WoDBY_c,1098
32
- primitive-0.1.4.dist-info/RECORD,,
26
+ primitive/utils/shell.py,sha256=-7UjQaBqSGHzEEyX8pNjeYFFP0P3lVnDV0OkgPz1qHU,1050
27
+ primitive/utils/verible.py,sha256=QYczN1IvxODfj4jeq0nqjFuF0Oi0Zdx-Q32ySOJgcw8,2205
28
+ primitive-0.1.5.dist-info/METADATA,sha256=30UnO3-byVnVwOjKRro-Agt53Q8Nae137DUfcZF5A1Y,1817
29
+ primitive-0.1.5.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
30
+ primitive-0.1.5.dist-info/entry_points.txt,sha256=p1K8DMCWka5FqLlqP1sPek5Uovy9jq8u51gUsP-z334,48
31
+ primitive-0.1.5.dist-info/licenses/LICENSE.txt,sha256=B8kmQMJ2sxYygjCLBk770uacaMci4mPSoJJ8WoDBY_c,1098
32
+ primitive-0.1.5.dist-info/RECORD,,