check vid/pid: find topdir relative to this script

@dhalbert noticed that if a fork was called `micropython`, the
existing check could fail during CI because it will be cloned into a
directory also called `micropython`.

Instead of hardcoding a range of strings that are OK as top directories,
find the location of the top directory relative to the script.

This will be conflicty after #5069 is merged, but it should be easy to
fix.
This commit is contained in:
Jeff Epler 2021-07-27 08:39:21 -05:00
parent 84ddb17c78
commit 5e07b7959f
1 changed files with 1 additions and 7 deletions

View File

@ -72,13 +72,7 @@ def configboard_files():
:returns: A ``pathlib.Path.glob()`` generator object
"""
working_dir = pathlib.Path().resolve()
if not working_dir.name.startswith("circuitpython") and not working_dir.name.startswith(
"micropython"
):
raise RuntimeError(
"Please run USB VID/PID duplicate verification at the " "top-level directory."
)
working_dir = pathlib.Path(__file__).resolve().parent.parent
return working_dir.glob("ports/**/boards/**/mpconfigboard.mk")