allow setting optional url for packages via envvar. (#5839)
* allow setting optional url for packages via envvar. * clean up left over * simplify code as suggested by Bernard (thanks) * fix typo (envvar name should be all upper case)
This commit is contained in:
parent
e15428c3a8
commit
58c4f41ac7
|
@ -30,6 +30,10 @@ import shutil
|
|||
import hashlib
|
||||
import operator
|
||||
|
||||
DEFAULT_RTT_PACKAGE_URL = 'https://github.com/RT-Thread/packages.git'
|
||||
# you can change the package url by defining RTT_PACKAGE_URL, ex:
|
||||
# export RTT_PACKAGE_URL=https://github.com/Varanda-Labs/packages.git
|
||||
|
||||
# make rtconfig.h from .config
|
||||
|
||||
def is_pkg_special_config(config_str):
|
||||
|
@ -146,6 +150,8 @@ def touch_env():
|
|||
home_dir = os.environ['HOME']
|
||||
else:
|
||||
home_dir = os.environ['USERPROFILE']
|
||||
|
||||
package_url = os.getenv('RTT_PACKAGE_URL') or DEFAULT_RTT_PACKAGE_URL
|
||||
|
||||
env_dir = os.path.join(home_dir, '.env')
|
||||
if not os.path.exists(env_dir):
|
||||
|
@ -158,7 +164,7 @@ def touch_env():
|
|||
|
||||
if not os.path.exists(os.path.join(env_dir, 'packages', 'packages')):
|
||||
try:
|
||||
ret = os.system('git clone https://github.com/RT-Thread/packages.git %s' % os.path.join(env_dir, 'packages', 'packages'))
|
||||
ret = os.system('git clone %s %s' % (package_url, os.path.join(env_dir, 'packages', 'packages')))
|
||||
if ret != 0:
|
||||
shutil.rmtree(os.path.join(env_dir, 'packages', 'packages'))
|
||||
print("********************************************************************************\n"
|
||||
|
|
Loading…
Reference in New Issue