primitive 0.1.80__py3-none-any.whl → 0.1.81__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.1.80"
4
+ __version__ = "0.1.81"
primitive/git/actions.py CHANGED
@@ -1,5 +1,5 @@
1
- import os
2
1
  from pathlib import Path
2
+ from subprocess import run, CalledProcessError, DEVNULL
3
3
 
4
4
  from gql import gql
5
5
  from loguru import logger
@@ -31,14 +31,31 @@ class Git(BaseAction):
31
31
  destination: Path = Path.cwd(),
32
32
  ) -> Path:
33
33
  logger.debug(f"Downloading source code from {git_repo_full_name} {git_ref}")
34
- # TODO: switch to subprocess.run or subprocess.Popen
35
- url = f"https://api.github.com/repos/{git_repo_full_name}/tarball/{git_ref}"
36
- untar_dir = Path(destination).joinpath(git_repo_full_name.split("/")[-1])
37
- untar_dir.mkdir(parents=True, exist_ok=True)
38
34
 
39
- result = os.system(
40
- f"curl -s -L -H 'Accept: application/vnd.github+json' -H 'Authorization: Bearer {github_access_token}' -H 'X-GitHub-Api-Version: 2022-11-28' {url} | tar zx --strip-components 1 -C {untar_dir}"
35
+ url = (
36
+ f"https://oauth2:{github_access_token}@github.com/{git_repo_full_name}.git"
41
37
  )
42
- if result != 0:
38
+ source_dir = Path(destination).joinpath(git_repo_full_name.split("/")[-1])
39
+
40
+ try:
41
+ run(
42
+ ["git", "clone", url, source_dir, "--no-checkout"],
43
+ check=True,
44
+ stdout=DEVNULL,
45
+ stderr=DEVNULL,
46
+ )
47
+ except CalledProcessError:
43
48
  raise Exception("Failed to download repository")
44
- return untar_dir
49
+
50
+ try:
51
+ run(
52
+ ["git", "checkout", git_ref],
53
+ check=True,
54
+ cwd=source_dir,
55
+ stdout=DEVNULL,
56
+ stderr=DEVNULL,
57
+ )
58
+ except CalledProcessError:
59
+ raise Exception("Failed to checkout ref")
60
+
61
+ return source_dir
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: primitive
3
- Version: 0.1.80
3
+ Version: 0.1.81
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=MuDJ1utcALDmUQcdbvjxA6n2_Yo25uRsjxiWT-AdSTo,130
1
+ primitive/__about__.py,sha256=huocY9XCDVB1AbopYm7klrVTheuItyqQL8-9KeAP9cA,130
2
2
  primitive/__init__.py,sha256=bwKdgggKNVssJFVPfKSxqFMz4IxSr54WWbmiZqTMPNI,106
3
3
  primitive/cli.py,sha256=CiI60bG3UZyNFuLTpchr0KeJRG5SALj455Ob11CegGE,2412
4
4
  primitive/client.py,sha256=PPyIQRvKKSqCF9RRF5mJJ4Vqqolpzy1YXqffNLKIvAA,2390
@@ -31,7 +31,7 @@ primitive/files/graphql/fragments.py,sha256=II6WHZjzSqX4IELwdiWokqHTKvDq6mMHF5gp
31
31
  primitive/files/graphql/mutations.py,sha256=Da_e6WSp-fsCYVE9A6SGkIQy9WDzjeQycNyHEn7vJqE,935
32
32
  primitive/files/graphql/queries.py,sha256=_ky-IRz928sKeSJuqaggTPxV4CGgmho3OyaAFu1z7nw,397
33
33
  primitive/git/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
34
- primitive/git/actions.py,sha256=0KHeHViZZqIhF6-Eqvhs0g_UmglqyWrOQKElQCm6jVw,1506
34
+ primitive/git/actions.py,sha256=x06CI0sR9sIp23CHpmyovTaoRKseTlTrlpKTvF39VTs,1747
35
35
  primitive/git/commands.py,sha256=sCeSjkRgSEjCEsB5seXgB_h6xfk0KpvMvzMKoRfUbRA,1177
36
36
  primitive/git/graphql/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
37
37
  primitive/git/graphql/queries.py,sha256=I1HGlqBb1lHIAWVSsC8tVY9JdsQ8DJVqs4nqSTcL30M,98
@@ -90,8 +90,8 @@ primitive/utils/memory_size.py,sha256=4xfha21kW82nFvOTtDFx9Jk2ZQoEhkfXii-PGNTpIU
90
90
  primitive/utils/printer.py,sha256=f1XUpqi5dkTL3GWvYRUGlSwtj2IxU1q745T4Fxo7Tn4,370
91
91
  primitive/utils/shell.py,sha256=j7E1YwgNWw57dFHVfEbqRNVcPHX0xDefX2vFSNgeI_8,1648
92
92
  primitive/utils/verible.py,sha256=Zb5NUISvcaIgEvgCDBWr-GCoceMa79Tcwvr5Wl9lfnA,2252
93
- primitive-0.1.80.dist-info/METADATA,sha256=_o8ysAq3wRYyuzFNeawg8t3UodjR21Pc9xZBksVPxWI,3642
94
- primitive-0.1.80.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
95
- primitive-0.1.80.dist-info/entry_points.txt,sha256=p1K8DMCWka5FqLlqP1sPek5Uovy9jq8u51gUsP-z334,48
96
- primitive-0.1.80.dist-info/licenses/LICENSE.txt,sha256=B8kmQMJ2sxYygjCLBk770uacaMci4mPSoJJ8WoDBY_c,1098
97
- primitive-0.1.80.dist-info/RECORD,,
93
+ primitive-0.1.81.dist-info/METADATA,sha256=NZ5uyQN0JCEnVE3egmqdlqIUM1ScD6Wk9NTLkqoEcFY,3642
94
+ primitive-0.1.81.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
95
+ primitive-0.1.81.dist-info/entry_points.txt,sha256=p1K8DMCWka5FqLlqP1sPek5Uovy9jq8u51gUsP-z334,48
96
+ primitive-0.1.81.dist-info/licenses/LICENSE.txt,sha256=B8kmQMJ2sxYygjCLBk770uacaMci4mPSoJJ8WoDBY_c,1098
97
+ primitive-0.1.81.dist-info/RECORD,,