mirror of
https://github.com/daylinmorgan/viv.git
synced 2024-12-22 18:50:43 -06:00
fix: use updated pep723 syntax
This commit is contained in:
parent
3bfdf5c095
commit
0085940f58
2 changed files with 6 additions and 30 deletions
|
@ -1,6 +1,5 @@
|
||||||
#!/usr/bin/env -S viv run -s
|
#!/usr/bin/env -S viv run -s
|
||||||
# /// pyproject
|
# /// script
|
||||||
# [run]
|
|
||||||
# requires-python = ">=3.11"
|
# requires-python = ">=3.11"
|
||||||
# dependencies = [
|
# dependencies = [
|
||||||
# "requests<3",
|
# "requests<3",
|
||||||
|
|
|
@ -2012,8 +2012,8 @@ METADATA_BLOCK = (
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def read_metadata_block(script: str) -> dict:
|
def _read_metadata_block(script: str) -> dict:
|
||||||
name = "pyproject"
|
name = "script"
|
||||||
matches = list(
|
matches = list(
|
||||||
filter(lambda m: m.group("type") == name, re.finditer(METADATA_BLOCK, script))
|
filter(lambda m: m.group("type") == name, re.finditer(METADATA_BLOCK, script))
|
||||||
)
|
)
|
||||||
|
@ -2027,29 +2027,6 @@ def read_metadata_block(script: str) -> dict:
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
|
|
||||||
# DEPENDENCY_BLOCK_MARKER = r"(?i)^#\s+script\s+dependencies:\s*$"
|
|
||||||
#
|
|
||||||
# def read_dependency_block(txt: str) -> Generator[str, None, None]:
|
|
||||||
# lines = iter(txt.splitlines())
|
|
||||||
# for line in lines:
|
|
||||||
# if re.match(DEPENDENCY_BLOCK_MARKER, line):
|
|
||||||
# for line in lines:
|
|
||||||
# if not line.startswith("#"):
|
|
||||||
# break
|
|
||||||
# # Remove comments. An inline comment is introduced by
|
|
||||||
# # a hash, which must be preceded and followed by a
|
|
||||||
# # space. The initial hash will be skipped as it has
|
|
||||||
# # no space before it.
|
|
||||||
# line = line.split(" # ", maxsplit=1)[0]
|
|
||||||
# line = line[1:].strip()
|
|
||||||
# if not line:
|
|
||||||
# continue
|
|
||||||
# # let pip handle the requirement errors
|
|
||||||
# yield line
|
|
||||||
# break
|
|
||||||
#
|
|
||||||
|
|
||||||
|
|
||||||
def _parse_date(txt: str) -> datetime:
|
def _parse_date(txt: str) -> datetime:
|
||||||
"""attempt to parse datetime string
|
"""attempt to parse datetime string
|
||||||
|
|
||||||
|
@ -2555,9 +2532,9 @@ class Viv:
|
||||||
script_text = fetch_script(script)
|
script_text = fetch_script(script)
|
||||||
|
|
||||||
viv_used = uses_viv(script_text)
|
viv_used = uses_viv(script_text)
|
||||||
deps = (
|
deps = _read_metadata_block(script_text).get("dependencies", [])
|
||||||
read_metadata_block(script_text).get("run", {}).get("dependencies", [])
|
|
||||||
)
|
# TODO: incorporate python version checking...
|
||||||
|
|
||||||
if viv_used and deps:
|
if viv_used and deps:
|
||||||
error(
|
error(
|
||||||
|
|
Loading…
Reference in a new issue