8000 Merge pull request #1301 from stonebig/master · alapollon/winpython@61088b9 · GitHub
[go: up one dir, main page]

Skip to content

Commit 61088b9

Browse files
authored
Merge pull request winpython#1301 from stonebig/master
make wppm 'help' better
2 parents ee5315c + d9fd924 commit 61088b9

File tree

1 file changed

+34
-40
lines changed

1 file changed

+34
-40
lines changed

winpython/wppm.py

Lines changed: 34 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
1010
Created on Fri Aug 03 14:32:26 2012
1111
"""
12-
# pypy3 to patch from 'python' to 'pypy3': 379 493 497 627 692 696 743 767 785
13-
from __future__ import print_function
1412

1513
import os
1614
from pathlib import Path
@@ -730,19 +728,15 @@ def main(test=False):
730728
bold = "\033[1m"
731729
unbold = "\033[0m"
732730
registerWinPythonHelp = f"""Register distribution
733-
Associate file extensions, icons and context menu entries with this WinPython.
734-
Create a menu group {unbold}WinPython{unbold} for this WinPython launchers.
731+
Associate file extensions, icons and context menu {unbold}WinPython{unbold} with this WinPython.
735732
"""
736733

737734
unregisterWinPythonHelp = f"""Unregister distribution
738-
De-Associate file extensions, icons and context menu entries from this WinPython.
739-
Remove menu group {unbold}WinPython{unbold} .
735+
De-Associate file extensions, icons and context menu {unbold}WinPython{unbold} from this WinPython.
740736
"""
741737

742738
parser = ArgumentParser(
743-
description="WinPython Package Manager: view, install, "
744-
"uninstall or upgrade Python packages on a Windows "
745-
"Python distribution like WinPython.",
739+
description="WinPython Package Manager: handle a WinPython Distribution and its packages",
746740
formatter_class=RawTextHelpFormatter,
747741
)
748742
parser.add_argument(
@@ -751,31 +745,7 @@ def main(test=False):
751745
nargs="?",
752746
default="",
753747
type=str,
754-
help="path to a Python package, or package name",
755-
)
756-
parser.add_argument(
757-
"-t",
758-
dest="target",
759-
default=sys.prefix,
760-
help="path to target Python distribution " f'(default: "{sys.prefix}")',
761-
)
762-
parser.add_argument(
763-
"-i",
764-
"--install",
765-
dest="install",
766-
action="store_const",
767-
const=True,
768-
default=False,
769-
help="install a given package wheel (otherwise use pip)",
770-
)
771-
parser.add_argument(
772-
"-u",
773-
"--uninstall",
774-
dest="uninstall",
775-
action="store_const",
776-
const=True,
777-
default=False,
778-
help="uninstall package",
748+
help="optional package name or package wheel",
779749
)
780750
parser.add_argument(
781751
"-r",
@@ -784,7 +754,7 @@ def main(test=False):
784754
action="store_const",
785755
const=True,
786756
default=False,
787-
help="show reverse dependancies of the given package[option]. {unbold}wppm -r pytest[test]{unbold}",
757+
help=f"show reverse dependancies of the given package[option]. {unbold}wppm -r pytest[test]{unbold}",
788758
)
789759
parser.add_argument(
790760
"-p",
@@ -793,14 +763,14 @@ def main(test=False):
793763
action="store_const",
794764
const=True,
795765
default=False,
796-
help="show dependancies of the given package[option]. {unbold}wppm -p pandas[test]{unbold}",
766+
help=f"show dependancies of the given package[option]. {unbold}wppm -p pandas[test]{unbold}",
797767
)
798768
parser.add_argument(
799769
"-l",
800770
dest="levels",
801771
type=int,
802772
default=2,
803-
help="show l levels of depth of hierarchy from given package",
773+
help="show l levels of depth of hierarchy from given package default is 2 levels",
804774
)
805775
parser.add_argument(
806776
"-ls",
@@ -809,7 +779,7 @@ def main(test=False):
809779
action="store_const",
810780
const=True,
811781
default=False,
812-
help="list packages matching the given expression. {unbold}wppm -ls{unbold}",
782+
help=f"list packages matching the given package expression. {unbold}wppm -ls{unbold}",
813783
)
814784
parser.add_argument(
815785
"-lsa",
@@ -845,7 +815,30 @@ def main(test=False):
845815
default=False,
846816
help=unregisterWinPythonHelp,
847817
)
848-
818+
parser.add_argument(
819+
"-t",
820+
dest="target",
821+
default=sys.prefix,
822+
help="path to target Python distribution " f'(default: "{sys.prefix}")',
823+
)
824+
parser.add_argument(
825+
"-i",
826+
"--install",
827+
dest="install",
828+
action="store_const",
829+
const=True,
830+
default=False,
831+
help="install a given package wheel (use pip for more features)",
832+
)
833+
parser.add_argument(
834+
"-u",
835+
"--uninstall",
836+
dest="uninstall",
837+
action="store_const",
838+
const=True,
839+
default=False,
840+
help="uninstall package",
841+
)
849842
args = parser.parse_args()
850843
targetpython = None
851844
if args.target and not args.target==sys.prefix:
@@ -868,7 +861,8 @@ def main(test=False):
868861
elif args.list:
869862
pip = piptree.pipdata(Target=targetpython)
870863
todo = [l for l in pip.pip_list(full=True) if bool(re.search(args.fname, l[0])) ]
871-
listed = utils.formatted_list(todo)
864+
titles = [['Package', 'Version', 'Summary'],['_' * max(x, 6) for x in utils.columns_width(todo)]]
865+
listed = utils.formatted_list(titles + todo)
872866
for p in listed:
873867
print(*p)
874868
sys.exit()

0 commit comments

Comments
 (0)
0