diff options
| author | sommersoft <sommersoft@gmail.com> | 2020-06-29 09:02:04 -0500 |
|---|---|---|
| committer | sommersoft <sommersoft@gmail.com> | 2020-06-29 09:02:04 -0500 |
| commit | c84c30846cded89bfef889ae3bd92f9102fab816 (patch) | |
| tree | 50eb0b3c120b9897d6eb46956c44299d2f40f726 | |
| parent | d911dc98d9a9acd76a337232933ee0776370a66c (diff) | |
docs/shared_bindings_matrix.py: use '__file__' to ascertain root dir
| -rw-r--r-- | docs/shared_bindings_matrix.py | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/docs/shared_bindings_matrix.py b/docs/shared_bindings_matrix.py index 12a7b7eb8..4abf5b885 100644 --- a/docs/shared_bindings_matrix.py +++ b/docs/shared_bindings_matrix.py @@ -34,22 +34,10 @@ SUPPORTED_PORTS = ['atmel-samd', 'esp32s2', 'litex', 'mimxrt10xx', 'nrf', 'stm'] def get_circuitpython_root_dir(): """ The path to the root './circuitpython' directory """ - cwd = pathlib.Path('.').resolve() - cwd_parts = cwd.parts + file_path = pathlib.Path(__file__).resolve() + root_dir = file_path.parent.parent - root_idx = len(cwd_parts) - - # 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() + return root_dir def get_shared_bindings(): """ Get a list of modules in shared-bindings based on folder names |
