|
18 | 18 | import re |
19 | 19 | import sys |
20 | 20 | import subprocess |
| 21 | +import json |
21 | 22 |
|
22 | 23 | # Local imports |
23 | 24 | from winpython import utils |
@@ -827,14 +828,23 @@ def main(test=False): |
827 | 828 | default=False, |
828 | 829 | help="list packages matching the given regular expression", |
829 | 830 | ) |
| 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 | + ) |
830 | 840 | parser.add_argument( |
831 | 841 | "-v", |
832 | 842 | "--verbose", |
833 | 843 | dest="verbose", |
834 | 844 | action="store_const", |
835 | 845 | const=True, |
836 | 846 | default=False, |
837 | | - help="show packages summary", |
| 847 | + help="show more from package summary and description", |
838 | 848 | ) |
839 | 849 | parser.add_argument( |
840 | 850 | "--register", |
@@ -876,6 +886,19 @@ def main(test=False): |
876 | 886 | for p in listed: |
877 | 887 | print(*p) |
878 | 888 | 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() |
879 | 902 | if args.registerWinPython: |
880 | 903 | print(registerWinPythonHelp) |
881 | 904 | if utils.is_python_distribution(args.target): |
|
0 commit comments