9
9
10
10
Created on Fri Aug 03 14:32:26 2012
11
11
"""
12
- # pypy3 to patch from 'python' to 'pypy3': 379 493 497 627 692 696 743 767 785
13
- from __future__ import print_function
14
12
15
13
import os
16
14
from pathlib import Path
@@ -730,19 +728,15 @@ def main(test=False):
730
728
bold = "\033 [1m"
731
729
unbold = "\033 [0m"
732
730
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.
735
732
"""
736
733
737
734
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.
740
736
"""
741
737
742
738
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" ,
746
740
formatter_class = RawTextHelpFormatter ,
747
741
)
748
742
parser .add_argument (
@@ -751,31 +745,7 @@ def main(test=False):
751
745
nargs = "?" ,
752
746
default = "" ,
753
747
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" ,
779
749
)
780
750
parser .add_argument (
781
751
"-r" ,
@@ -784,7 +754,7 @@ def main(test=False):
784
754
action = "store_const" ,
785
755
const = True ,
786
756
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 } " ,
788
758
)
789
759
parser .add_argument (
790
760
"-p" ,
@@ -793,14 +763,14 @@ def main(test=False):
793
763
action = "store_const" ,
794
764
const = True ,
795
765
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 } " ,
797
767
)
798
768
parser .add_argument (
799
769
"-l" ,
800
770
dest = "levels" ,
801
771
type = int ,
802
772
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 " ,
804
774
)
805
775
parser .add_argument (
806
776
"-ls" ,
@@ -809,7 +779,7 @@ def main(test=False):
809
779
action = "store_const" ,
810
780
const = True ,
811
781
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 } " ,
813
783
)
814
784
parser .add_argument (
815
785
"-lsa" ,
@@ -845,7 +815,30 @@ def main(test=False):
845
815
default = False ,
846
816
help = unregisterWinPythonHelp ,
847
817
)
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
+ )
849
842
args = parser .parse_args ()
850
843
targetpython = None
851
844
if args .target and not args .target == sys .prefix :
@@ -868,7 +861,8 @@ def main(test=False):
868
861
elif args .list :
869
862
pip = piptree .pipdata (Target = targetpython )
870
863
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 )
872
866
for p in listed :
873
867
print (* p )
874
868
sys .exit ()
0 commit comments