docs/shared_bindings_matrix.py: use '__file__' to ascertain root dir
This commit is contained in:
parent
d911dc98d9
commit
c84c30846c
|
@ -34,22 +34,10 @@ SUPPORTED_PORTS = ['atmel-samd', 'esp32s2', 'litex', 'mimxrt10xx', 'nrf', 'stm']
|
||||||
def get_circuitpython_root_dir():
|
def get_circuitpython_root_dir():
|
||||||
""" The path to the root './circuitpython' directory
|
""" The path to the root './circuitpython' directory
|
||||||
"""
|
"""
|
||||||
cwd = pathlib.Path('.').resolve()
|
file_path = pathlib.Path(__file__).resolve()
|
||||||
cwd_parts = cwd.parts
|
root_dir = file_path.parent.parent
|
||||||
|
|
||||||
root_idx = len(cwd_parts)
|
return root_dir
|
||||||
|
|
||||||
# Search the path from tail to head, so that we capture the
|
|
||||||
# deepest folder. This avoids overshooting in instances like:
|
|
||||||
# '/home/user/circuitpython_v5/circuitpython'
|
|
||||||
for idx, val in enumerate(cwd_parts[::-1]):
|
|
||||||
if val.startswith("circuitpython"):
|
|
||||||
root_idx = root_idx - idx
|
|
||||||
break
|
|
||||||
|
|
||||||
root_dir = '/'.join(cwd_parts[:root_idx])
|
|
||||||
|
|
||||||
return pathlib.Path(root_dir).resolve()
|
|
||||||
|
|
||||||
def get_shared_bindings():
|
def get_shared_bindings():
|
||||||
""" Get a list of modules in shared-bindings based on folder names
|
""" Get a list of modules in shared-bindings based on folder names
|
||||||
|
|
Loading…
Reference in New Issue