@@ -218,7 +218,7 @@ def determine_url_valid(url_from_srv):
218218 print ('Network connection error or the url : %s is invalid.\n ' % url_from_srv .encode ("utf-8" ))
219219
220220
221- def install_pkg (env_root , bsp_root , pkg ):
221+ def install_pkg (env_root , pkgs_root , bsp_root , pkg ):
222222 """Install the required packages."""
223223
224224 # default true
@@ -234,7 +234,7 @@ def install_pkg(env_root, bsp_root, pkg):
234234 pkg_path = pkg ['path' ]
235235 if pkg_path [0 ] == '/' or pkg_path [0 ] == '\\ ' :
236236 pkg_path = pkg_path [1 :]
237- pkg_path = os .path .join (env_root , 'packages' , pkg_path , 'package.json' )
237+ pkg_path = os .path .join (pkgs_root , pkg_path , 'package.json' )
238238 package .parse (pkg_path )
239239
240240 url_from_json = package .get_url (pkg ['ver' ])
@@ -354,6 +354,7 @@ def package_list():
354354
355355 fn = '.config'
356356 env_root = Import ('env_root' )
357+ pkgs_root = Import ('pkgs_root' )
357358
358359 if not os .path .isfile (fn ):
359360 if platform .system () == "Windows" :
@@ -378,7 +379,7 @@ def package_list():
378379 if pkg_path [0 ] == '/' or pkg_path [0 ] == '\\ ' :
379380 pkg_path = pkg_path [1 :]
380381
381- pkg_path = os .path .join (env_root , 'packages' , pkg_path , 'package.json' )
382+ pkg_path = os .path .join (pkgs_root , pkg_path , 'package.json' )
382383 package .parse (pkg_path )
383384
384385 pkgs_name_in_json = package .get_name ()
@@ -451,6 +452,7 @@ def update_latest_packages(pkgs_fn, bsp_packages_path):
451452 """
452453
453454 env_root = Import ('env_root' )
455+ pkgs_root = Import ('pkgs_root' )
454456
455457 env_kconfig_path = os .path .join (env_root , 'tools\scripts\cmds' )
456458 env_config_file = os .path .join (env_kconfig_path , '.config' )
@@ -464,7 +466,7 @@ def update_latest_packages(pkgs_fn, bsp_packages_path):
464466 if pkg_path [0 ] == '/' or pkg_path [0 ] == '\\ ' :
465467 pkg_path = pkg_path [1 :]
466468
467- pkg_path = os .path .join (env_root , 'packages' , pkg_path , 'package.json' )
469+ pkg_path = os .path .join (pkgs_root , pkg_path , 'package.json' )
468470 package .parse (pkg_path )
469471 pkgs_name_in_json = package .get_name ()
470472
@@ -606,6 +608,7 @@ def pre_package_update():
606608def error_packages_handle (error_packages_list , read_back_pkgs_json , pkgs_fn ):
607609 bsp_root = Import ('bsp_root' )
608610 env_root = Import ('env_root' )
611+ pkgs_root = Import ('pkgs_root' )
609612
610613 flag = None
611614
@@ -619,7 +622,7 @@ def error_packages_handle(error_packages_list, read_back_pkgs_json, pkgs_fn):
619622 print ("Warning: Packages should be deleted in <menuconfig> command.\n " )
620623
621624 for pkg in error_packages_list : # Redownloaded the packages in error_packages_list
622- if install_pkg (env_root , bsp_root , pkg ):
625+ if install_pkg (env_root , pkgs_root , bsp_root , pkg ):
623626 print ("==============================> %s %s is redownloaded successfully. \n " % (
624627 pkg ['name' ].encode ("utf-8" ), pkg ['ver' ].encode ("utf-8" )))
625628 else :
@@ -739,6 +742,7 @@ def package_update(isDeleteOld=False):
739742
740743 bsp_root = Import ('bsp_root' )
741744 env_root = Import ('env_root' )
745+ pkgs_root = Import ('pkgs_root' )
742746 flag = True
743747
744748 # According to the env version, whether Chinese output is supported or not
@@ -829,7 +833,7 @@ def package_update(isDeleteOld=False):
829833 pkgs_download_fail_list = []
830834
831835 for pkg in casedownload :
832- if install_pkg (env_root , bsp_root , pkg ):
836+ if install_pkg (env_root , pkgs_root , bsp_root , pkg ):
833837 print ("==============================> %s %s is downloaded successfully. \n " % (
834838 pkg ['name' ], pkg ['ver' ]))
835839 else :
@@ -980,6 +984,7 @@ def upgrade_packages_index():
980984 """Update the package repository index."""
981985
982986 env_root = Import ('env_root' )
987+ pkgs_root = Import ('pkgs_root' )
983988 env_kconfig_path = os .path .join (env_root , 'tools\scripts\cmds' )
984989 env_config_file = os .path .join (env_kconfig_path , '.config' )
985990 if (not os .path .isfile (env_config_file )) or (os .path .isfile (env_config_file ) and find_macro_in_config (env_config_file , 'SYS_PKGS_DOWNLOAD_ACCELERATE' )):
@@ -992,7 +997,7 @@ def upgrade_packages_index():
992997 else :
993998 git_repo = 'https://github.com/RT-Thread/packages.git'
994999
995- packages_root = os . path . join ( env_root , 'packages' )
1000+ packages_root = pkgs_root
9961001 pkgs_path = os .path .join (packages_root , 'packages' )
9971002
9981003 if not os .path .isdir (pkgs_path ):
0 commit comments