Skip to content

Commit

Permalink
Use new wheezy.template feature to reduce shell-manipulation of JSON,
Browse files Browse the repository at this point in the history
and exclude wheel from pipcheckold listings
  • Loading branch information
AndydeCleyre committed Nov 11, 2024
1 parent 7ab5390 commit 9f878e0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
3 changes: 3 additions & 0 deletions NEWS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ Changed
- Add diffr as optional diff-highlighter
- Show pypc's pyproject.toml diff BEFORE asking to replace it
- Remove useless double-zsh-invocation during fzf/skim preview
- Exclude wheel from pipcheckold listings
- Use new wheezy.template feature (`__args__`) to reduce shell-manipulation of JSON
- If using the wheezy.template JSON-reading backend, upgrade it (`pipz upgrade wheezy.template`)!

0.3.10
======
Expand Down
19 changes: 9 additions & 10 deletions zpy.plugin.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -1236,13 +1236,13 @@ ZPY_PROCS=${${$(nproc 2>/dev/null):-$(sysctl -n hw.logicalcpu 2>/dev/null)}:-4}
if (( $+commands[jq] )) {
cells=($(
.zpy_ui_vrun $vrun_args $list_outdated 2>/dev/null \
| jq -r '.[] | select(.name|test("^(setuptools|six|pip|pip-tools)$")|not) | .name,.version,.latest_version'
| jq -r '.[] | select(.name|test("^(setuptools|six|pip|pip-tools|wheel)$")|not) | .name,.version,.latest_version'
))
} elif (( $+commands[wheezy.template] )) {
local template=(
'@require(_)'
'@for pkg in _:'
'@if pkg["name"] not in ("setuptools", "six", "pip", "pip-tools"):'
'@require(__args__)'
'@for pkg in __args__[0]:'
'@if pkg["name"] not in ("setuptools", "six", "pip", "pip-tools", "wheel"):'
'@pkg["name"]'
'@pkg["version"]'
'@pkg["latest_version"]'
Expand All @@ -1251,7 +1251,7 @@ ZPY_PROCS=${${$(nproc 2>/dev/null):-$(sysctl -n hw.logicalcpu 2>/dev/null)}:-4}
)
cells=($(
wheezy.template =(<<<${(F)template}) \
=(<<<"{\"_\": $(.zpy_ui_vrun $vrun_args $list_outdated 2>/dev/null)}")
=(.zpy_ui_vrun $vrun_args $list_outdated 2>/dev/null)
))
} else {

Expand All @@ -1261,7 +1261,7 @@ import sys
from json import load
pkgs = load(sys.stdin)
for pkg in pkgs:
if pkg["name"] not in ("setuptools", "six", "pip", "pip-tools"):
if pkg["name"] not in ("setuptools", "six", "pip", "pip-tools", "wheel"):
print(pkg["name"], pkg["version"], pkg["latest_version"], sep="\n")
'
))
Expand Down Expand Up @@ -1708,17 +1708,16 @@ jsonfile.write_text(dumps(data, indent=4))
))
} elif (( $+commands[wheezy.template] )) {
local template=(
'@require(_)'
'@for pkg in _:'
'@require(__args__)'
'@for pkg in __args__[0]:'
'@if pkg["name"].lower().replace("_", "-").replace(".", "-") == "'${pdir:t}'":'
'@pkg["name"]'
'@pkg["version"]'
'@end'
'@end'
)
piplistline=($(
wheezy.template =(<<<${(F)template}) \
=(<<<"{\"_\": $($piplist 2>/dev/null)}")
wheezy.template =(<<<${(F)template}) =($piplist 2>/dev/null)
))
} else {

Expand Down

0 comments on commit 9f878e0

Please sign in to comment.