8000 add wppm -lsa -v · alapollon/winpython@78c9fd4 · GitHub
[go: up one dir, main page]

Skip to content

Commit 78c9fd4

Browse files
committed
add wppm -lsa -v
trying to be more practical than METADATA or pip inspect
1 parent 67ab187 commit 78c9fd4

File tree

3 files changed

+28
-2
lines changed

3 files changed

+28
-2
lines changed

winpython/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@
2828
OTHER DEALINGS IN THE SOFTWARE.
2929
"""
3030

31-
__version__ = '7.2.20240218'
31+
__version__ = '7.2.20240219'
3232
__license__ = __doc__
3333
__project_url__ = 'http://winpython.github.io/'

winpython/piptree.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ def __init__(self, Target=None):
3232
# req_version = version needed
3333
# req_marker = marker of the requirement (if any)
3434
self.distro = {}
35+
self.raw = {}
3536
replacements = str.maketrans({" ": "", "[": "", "]": "", "'": "", '"': ""})
3637
self.environment = {
3738
"implementation_name": sys.implementation.name,
@@ -54,6 +55,7 @@ def __init__(self, Target=None):
5455
name = meta["name"]
5556
key = normalize(name)
5657
requires = []
58+
self.raw[key] = meta
5759
if "requires_dist" in meta:
5860
for i in meta["requires_dist"]:
5961
det = (i + ";").split(";")
@@ -207,3 +209,4 @@ def pip_list(self, full=False):
207209
return [(p, self.distro[p]["version"], self.distro[p]["summary"]) for p in sorted(self.distro)]
208210
else:
209211
return [(p, self.distro[p]["version"]) for p in sorted(self.distro)]
212+

winpython/wppm.py

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import re
1919
import sys
2020
import subprocess
21+
import json
2122

2223
# Local imports
2324
from winpython import utils
@@ -827,14 +828,23 @@ def main(test=False):
827828
default=False,
828829
help="list packages matching the given regular expression",
829830
)
831+
parser.add_argument(
832+
"-lsa",
833+
"--list_all",
834+
dest="all",
835+
action="store_const",
836+
const=True,
837+
default=False,
838+
help="list all detail of packages matching the given regular expression (pip inspect)",
839+
)
830840
parser.add_argument(
831841
"-v",
832842
"--verbose",
833843
dest="verbose",
834844
action="store_const",
835845
const=True,
836846
default=False,
837-
help="show packages summary",
847+
help="show more from package summary and description",
838848
)
839849
parser.add_argument(
840850
"--register",
@@ -876,6 +886,19 @@ def main(test=False):
876886
for p in listed:
877887
print(*p)
878888
sys.exit()
889+
elif args.all:
890+
pip = piptree.pipdata()
891+
todo = [l for l in pip.pip_list(full=True) if bool(re.search(args.fname, l[0])) ]
892+
for l in todo:
893+
# print(pip.distro[l[0]])
894+
title = f"** Package: {l[0]} **"
895+
print("\n"+"*"*len(title), f"\n{title}", "\n"+"*"*len(title) )
896+
for key, value in pip.raw[l[0]].items():
897+
rawtext=json.dumps(value, indent=2)
898+
lines = [l for l in rawtext.split(r"\n") if len(l.strip()) > 2]
899+
if key.lower() != 'description' or args.verbose==True:
900+
print(f"{key}: ","\n".join(lines).replace('"', ""))
901+
sys.exit()
879902
if args.registerWinPython:
880903
print(registerWinPythonHelp)
881904
if utils.is_python_distribution(args.target):

0 commit comments

Comments
 (0)
0