import sys
from pathlib import Path

# Insert project root at position 0 so our local `platform/` package
# shadows the Python stdlib `platform` module.
root = str(Path(__file__).parent)
sys.path.insert(0, root)

# If stdlib platform was already cached, remove it so Python re-resolves
# to our local package.
stdlib_platform = sys.modules.get("platform")
if stdlib_platform is not None and not hasattr(stdlib_platform, "mock"):
    del sys.modules["platform"]
