@@ -50,11 +50,15 @@ def show_usage():
50
50
51
51
52
52
def show_basic_usage ():
53
+ import time
53
54
from seleniumbase .console_scripts import logo_helper
54
55
seleniumbase_logo = logo_helper .get_seleniumbase_logo ()
55
56
print (seleniumbase_logo )
56
- print ("%s" % get_version ()[0 :1 ])
57
- print ("" )
57
+ time .sleep (0.25 ) # Enough time to see the logo
58
+ print ()
59
+ show_package_location ()
60
+ show_version_info ()
61
+ print ()
58
62
sc = ("" )
59
63
sc += (' * USAGE: "seleniumbase [COMMAND] [PARAMETERS]"\n ' )
60
64
sc += (' * OR: "sbase [COMMAND] [PARAMETERS]"\n ' )
@@ -431,19 +435,39 @@ def show_grid_node_usage():
431
435
print ("" )
432
436
433
437
434
- def get_version ():
435
- import pkg_resources
438
+ def get_version_info ():
439
+ # from pkg_resources import get_distribution
440
+ # version = get_distribution("seleniumbase").version
441
+ from seleniumbase import __version__
436
442
version_info = None
437
- try :
438
- version_info = pkg_resources .require ("seleniumbase" )[0 :1 ]
439
- except Exception :
440
- version_info = ["ERROR: Cannot detect version! Please reinstall!" ]
443
+ c1 = colorama .Fore .BLUE + colorama .Back .LIGHTCYAN_EX
444
+ c2 = colorama .Fore .BLUE + colorama .Back .LIGHTGREEN_EX
445
+ c3 = colorama .Fore .BLUE + colorama .Back .LIGHTYELLOW_EX
446
+ cr = colorama .Style .RESET_ALL
447
+ sb_text = c1 + "selenium" + c2 + "base" + cr
448
+ version_info = "%s %s%s%s" % (sb_text , c3 , __version__ , cr )
441
449
return version_info
442
450
443
451
444
452
def show_version_info ():
445
- version = get_version ()
446
- print ('\n %s\n ' % version )
453
+ version_info = get_version_info ()
454
+ print ('%s' % version_info )
455
+
456
+
457
+ def get_package_location ():
458
+ # from pkg_resources import get_distribution
459
+ # location = get_distribution("seleniumbase").location
460
+ import os
461
+ import seleniumbase
462
+ location = os .path .dirname (os .path .realpath (seleniumbase .__file__ ))
463
+ if location .endswith ("seleniumbase" ):
464
+ location = location [0 :- len ("seleniumbase" )]
465
+ return location
466
+
467
+
468
+ def show_package_location ():
469
+ location = get_package_location ()
470
+ print ("%s" % location )
447
471
448
472
449
473
def show_options ():
@@ -666,7 +690,13 @@ def main():
666
690
show_grid_node_usage ()
667
691
elif command == "version" or command == "--version" :
668
692
if len (command_args ) == 0 :
693
+ from seleniumbase .console_scripts import logo_helper
694
+ seleniumbase_logo = logo_helper .get_seleniumbase_logo ()
695
+ print (seleniumbase_logo )
696
+ print ()
697
+ show_package_location ()
669
698
show_version_info ()
699
+ print ()
670
700
else :
671
701
show_basic_usage ()
672
702
elif command == "options" or command == "--options" :
0 commit comments