Skip to content

Commit 0a4e0f9

Browse files
committed
adds the ability to clone a git repository to use as a USER_C_MODULE
The syntax for use is as follows. ``` USER_C_MODULE=https://github.com/v923z/micropython-ulab:code/micropython.cmake ``` The portion after the second color `:` MUST be there. That is what points to the cmake file for the user_c_module. The path is relative to the cloned repository. DO NOT use an absolute path to point to the cmake file as it will not work. Optionally you can specific a tag, branch or a commit to checkout by using this syntax branch ``` USER_C_MODULE=https://github.com/v923z/micropython-ulab@testing:code/micropython.cmake ``` tag ``` USER_C_MODULE=https://github.com/v923z/micropython-ulab@6.7.3:code/micropython.cmake ``` commit ``` USER_C_MODULE=https://github.com/v923z/micropython-ulab@be15d626324350fcb4efe3da15ebf717cda5b0a8:code/micropython.cmake ```
1 parent 9979ac2 commit 0a4e0f9

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

builder/esp32.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,35 @@ def common_args(extra_args):
441441
components = esp_args.components
442442
user_c_modules = esp_args.user_c_modules
443443

444+
for i, c_module in enumerate(user_c_modules):
445+
if c_module.startswith('http'):
446+
git_address, c_module = c_module.rsplit(':', 1)
447+
if '@' in git_address:
448+
git_address, checkout = git_address.split('@', 1)
449+
else:
450+
checkout = None
451+
452+
c_module_name = os.path.split(git_address)[-1]
453+
454+
c_module = os.path.join(SCRIPT_DIR, 'ext_mod', c_module_name, c_module)
455+
user_c_modules[i] = c_module
456+
457+
cmds = [
458+
['cd', f'ext_mod']
459+
['git', 'clone', git_address],
460+
['cd', c_module_name]
461+
]
462+
463+
if checkout is not None:
464+
cmds.append(['git', 'checkout', checkout])
465+
466+
cmds.append(['git', 'submodule', 'init'])
467+
468+
exit_code, data = spawn(cmds, out_to_screen=False, spinner=True)
469+
if exit_code:
470+
print(data)
471+
sys.exit(exit_code)
472+
444473
if custom_board_path is None:
445474
skip_partition_resize = esp_args.skip_partition_resize
446475
partition_size = esp_args.partition_size

0 commit comments

Comments
 (0)