Skip to content

Commit

Permalink
feat(deps): deno add atproto api
Browse files Browse the repository at this point in the history
Asciinema: https://asciinema.org/a/692702
Signed-off-by: John Andersen <[email protected]>
  • Loading branch information
johnandersen777 committed Nov 29, 2024
1 parent 6011ab6 commit 4c6c0ab
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 4 deletions.
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[project]
name = "gitatp"
version = "0.1.4"
version = "0.1.5"
description = "Git over ATProto"
long_description = "# Git over ATProto"
long_description = "[![asciicast](https://asciinema.org/a/692702.svg)](https://asciinema.org/a/692702)"
long_description_content_type = "text/markdown"
readme = {file = "README.md", content-type = "text/markdown"}
authors = [
Expand Down
4 changes: 4 additions & 0 deletions src/gitatp/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from .cli import main

if __name__ == "__main__":
main()
27 changes: 25 additions & 2 deletions src/gitatp/git_http_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
# os.environ["HOME"] = str(Path(__file__).parent.resolve())

parser = argparse.ArgumentParser(prog='atproto-git', usage='%(prog)s [options]')
parser.add_argument('--repos-directory', dest="repos_directory", help='directory for local copies of git repos')
parser.add_argument('--repos-directory', required=True, dest="repos_directory", help='directory for local copies of git repos')
args = parser.parse_args()

config = configparser.ConfigParser()
Expand Down Expand Up @@ -116,6 +116,29 @@ def update_profile(client, pinned_post):
"ATPROTO_PINNED_POST_CID": pinned_post.cid,
},
}
update_profile_deno_cache_path = Path(
"~", ".cache", "update_profile_deno_cache_path",
).expanduser()
update_profile_deno_cache_path.mkdir(parents=True, exist_ok=True)

update_profile_deno_cache_path.joinpath(
ATPROTO_UPDATE_PROFILE_JS_PATH.name,
).write_bytes(
ATPROTO_UPDATE_PROFILE_JS_PATH.read_bytes(),
)

if not update_profile_deno_cache_path.joinpath("deno.lock").exists():
cmd = [
"deno",
"add",
"npm:@atproto/api",
]
proc_result = subprocess.run(
cmd,
cwd=str(update_profile_deno_cache_path.resolve()),
)
proc_result.check_returncode()

cmd = [
"deno",
"--allow-env",
Expand All @@ -124,7 +147,7 @@ def update_profile(client, pinned_post):
]
proc_result = subprocess.run(
cmd,
cwd=str(ATPROTO_UPDATE_PROFILE_JS_PATH.parent.resolve()),
cwd=str(update_profile_deno_cache_path.resolve()),
env=env,
)
proc_result.check_returncode()
Expand Down

0 comments on commit 4c6c0ab

Please sign in to comment.