2023-08-23 18:48:19 +08:00
|
|
|
#!/usr/bin/env python
|
|
|
|
"""
|
|
|
|
Main entry point for running mx.
|
|
|
|
"""
|
|
|
|
|
2023-10-20 21:18:03 +08:00
|
|
|
# Looking for something?
|
|
|
|
# The mx implementation code has moved to src/mx/_impl
|
|
|
|
# See `docs/package-structure.md` for more details
|
|
|
|
|
2023-08-23 18:48:19 +08:00
|
|
|
import sys
|
|
|
|
import runpy
|
|
|
|
from pathlib import Path
|
|
|
|
|
|
|
|
|
|
|
|
def patch_path():
|
|
|
|
"""
|
2023-09-25 23:27:03 +08:00
|
|
|
Prepends the location of the main mx package and the legacy files to
|
|
|
|
`sys.path`.
|
2023-08-23 18:48:19 +08:00
|
|
|
|
2023-09-25 23:27:03 +08:00
|
|
|
We prepend, because otherwise this file is recognized as the `mx` module
|
|
|
|
and not `src/mx`.
|
2023-08-23 18:48:19 +08:00
|
|
|
"""
|
|
|
|
base_dir = Path(__file__).parent.absolute()
|
2023-09-25 23:27:03 +08:00
|
|
|
# Include the sibling directory 'src' of this script in the python search
|
|
|
|
# path, this allows loading of the mx module
|
2023-11-01 18:31:50 +08:00
|
|
|
sys.path.insert(0, str(base_dir / "src"))
|
2023-08-23 18:48:19 +08:00
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
patch_path()
|
|
|
|
runpy.run_module("mx")
|