5454from string import Template
5555from cmd_menuconfig import find_macro_in_config
5656
57-
58- class Logger :
59- def __init__ (self , log_name , clevel = logging .DEBUG ):
60- self .logger = logging .getLogger (log_name )
61- self .logger .setLevel (logging .DEBUG )
62- fmt = logging .Formatter (
63- '[%(levelname)s] %(message)s' )
64-
65- # set cmd log
66- sh = logging .StreamHandler ()
67- sh .setFormatter (fmt )
68- sh .setLevel (clevel )
69- self .logger .addHandler (sh )
70-
71- def debug (self , message ):
72- self .logger .debug (message )
73-
74- def info (self , message ):
75- self .logger .info (message )
76-
77- def war (self , message ):
78- self .logger .warn (message )
79-
80- def error (self , message ):
81- self .logger .error (message )
82-
83- def cri (self , message ):
84- self .logger .critical (message )
85-
86-
8757"""package command"""
8858
8959def execute_command (cmdstring , cwd = None , shell = True ):
@@ -251,8 +221,8 @@ def install_pkg(env_root, bsp_root, pkg):
251221 local_pkgs_path = os .path .join (env_root , 'local_pkgs' )
252222 bsp_pkgs_path = os .path .join (bsp_root , 'packages' )
253223
254- env_kconfig_path = os .path .join (env_root , 'tools\scripts\cmds' )
255224 # get the .config file from env
225+ env_kconfig_path = os .path .join (env_root , 'tools\scripts\cmds' )
256226 env_config_file = os .path .join (env_kconfig_path , '.config' )
257227
258228 package = Package ()
@@ -264,17 +234,16 @@ def install_pkg(env_root, bsp_root, pkg):
264234
265235 url_from_json = package .get_url (pkg ['ver' ])
266236 package_url = package .get_url (pkg ['ver' ])
267- #package_name = pkg['name']
268237 pkgs_name_in_json = package .get_name ()
269238
270239 if package_url [- 4 :] == '.git' :
271240 ver_sha = package .get_versha (pkg ['ver' ])
272241
273242 # print("==================================================>")
274- # print "packages name:", pkgs_name_in_json.encode("utf-8")
275- # print "ver:", pkg['ver']
276- # print "url:", package_url.encode("utf-8")
277- # print "url_from_json: ", url_from_json.encode("utf-8")
243+ # print( "packages name :"% pkgs_name_in_json.encode("utf-8") )
244+ # print( "ver :"% pkg['ver'])
245+ # print( "url :"% package_url.encode("utf-8"))
246+ # print( "url_from_json : "% url_from_json.encode("utf-8") )
278247 # print("==================================================>")
279248
280249 get_package_url = None
@@ -743,7 +712,6 @@ def package_update(isDeleteOld=False):
743712 remind the user saved the modified file.
744713 """
745714
746- pkgs_update_log = Logger ('pkgs_update' , logging .WARNING )
747715 bsp_root = Import ('bsp_root' )
748716 env_root = Import ('env_root' )
749717 flag = True
@@ -761,15 +729,6 @@ def package_update(isDeleteOld=False):
761729 bsp_packages_path = sys_value [5 ]
762730 dbsqlite_pathname = sys_value [6 ]
763731
764- pkgs_update_log .info (
765- '[Line: %d][Message : Begin to remove packages]' % sys ._getframe ().f_lineno )
766- pkgs_update_log .info (
767- '[Line: %d][Message : oldpkgs: %s ]' % (sys ._getframe ().f_lineno , oldpkgs ))
768- pkgs_update_log .info (
769- '[Line: %d][Message : newpkgs: %s ]' % (sys ._getframe ().f_lineno , newpkgs ))
770- pkgs_update_log .info (
771- '[Line: %d][Message : pkgs_delete_error_list: %s ]' % (sys ._getframe ().f_lineno , pkgs_delete_error_list ))
772-
773732 if len (pkgs_delete_error_list ):
774733 for error_package in pkgs_delete_error_list :
775734 removepath_ver = get_package_remove_path (
@@ -847,9 +806,6 @@ def package_update(isDeleteOld=False):
847806 # If the package download fails, record it, and then download again when
848807 # the update command is executed.
849808
850- pkgs_update_log .info (
851- '[Line: %d][Message : Begin to download packages]' % sys ._getframe ().f_lineno )
852-
853809 casedownload = sub_list (newpkgs , oldpkgs )
854810 # print 'in new not in old:', casedownload
855811 pkgs_download_fail_list = []
@@ -865,16 +821,10 @@ def package_update(isDeleteOld=False):
865821 print pkg , 'download failed.'
866822 flag = False
867823
868- pkgs_update_log .info (
869- '[Line: %d][Message : Get the list of packages that have been updated]' % sys ._getframe ().f_lineno )
870-
871824 # Get the currently updated configuration.
872825 newpkgs = sub_list (newpkgs , pkgs_download_fail_list )
873826
874- pkgs_update_log .info (
875- '[Line: %d][Message : Print the list of software packages that failed to download]' % sys ._getframe ().f_lineno )
876827 # Give hints based on the success of the download.
877-
878828 if len (pkgs_download_fail_list ):
879829 print ("Package download failed pkgs_download_fail_list: %s \n " %
880830 pkgs_download_fail_list )
@@ -890,9 +840,6 @@ def package_update(isDeleteOld=False):
890840 if get_flag != None :
891841 flag = get_flag
892842
893- pkgs_update_log .info (
894- '[Line: %d][Message : Begin to update latest version packages]' % sys ._getframe ().f_lineno )
895-
896843 # Update the software packages, which the version is 'latest'
897844 try :
898845 update_latest_packages (pkgs_fn , bsp_packages_path )
0 commit comments