fix: add some debugging logs and remove old function

This commit is contained in:
Daylin Morgan 2023-08-09 11:26:57 -05:00
parent 560871e6c3
commit 6094c8c7b7
Signed by: daylin
GPG key ID: C1E52E7DD81DF79F

View file

@ -42,7 +42,6 @@ from types import TracebackType
from typing import ( from typing import (
Any, Any,
Dict, Dict,
Generator,
List, List,
NoReturn, NoReturn,
Optional, Optional,
@ -56,7 +55,7 @@ from typing import (
from urllib.error import HTTPError from urllib.error import HTTPError
from urllib.request import urlopen from urllib.request import urlopen
__version__ = "23.8a3-6-g5b397c0-dev" __version__ = "23.8a3-7-g560871e-dev"
class Spinner: class Spinner:
@ -1102,6 +1101,7 @@ def resolve_deps(reqs: List[str], requirements: Path) -> List[str]:
def fetch_script(url: str) -> str: def fetch_script(url: str) -> str:
try: try:
log.debug(f"fetching from remote url: {url}")
r = urlopen(url) r = urlopen(url)
except (HTTPError, ValueError) as e: except (HTTPError, ValueError) as e:
err_quit( err_quit(
@ -1126,6 +1126,7 @@ def fetch_source(reference: str) -> str:
cached_src_file = Cfg().cache_src / f"{sha256}.py" cached_src_file = Cfg().cache_src / f"{sha256}.py"
if not cached_src_file.is_file(): if not cached_src_file.is_file():
log.debug("updating source script")
cached_src_file.write_text(src) cached_src_file.write_text(src)
return sha256 return sha256
@ -1155,26 +1156,6 @@ def uses_viv(txt: str) -> bool:
) )
def _read_metadata_block(txt: str) -> Generator[Tuple[str, str, List[str]], None, None]:
"""check for pep722 style metadata block and parse"""
lines = iter(txt.splitlines())
for line in lines:
if line.startswith("##"):
block_type, sep, extra = line[2:].strip().partition(":")
if not sep:
continue
block_data = []
for line in lines:
if not line.startswith("##"):
break
line = line[2:].strip()
if not line:
continue
block_data.append(line)
yield block_type, extra, block_data
DEPENDENCY_BLOCK_MARKER = r"(?i)^#\s+script\s+dependencies:\s*$" DEPENDENCY_BLOCK_MARKER = r"(?i)^#\s+script\s+dependencies:\s*$"