__main__.py 592 B

12345678910111213141516171819202122232425262728
  1. """
  2. Module to support call with :file:`__main__.py`. Used to support the following
  3. call::
  4. $ python3 -m semver ...
  5. This makes it also possible to "run" a wheel like in this command::
  6. $ python3 semver-3*-py3-none-any.whl/semver -h
  7. """
  8. import os.path
  9. import sys
  10. from typing import List, Optional
  11. from semver import cli
  12. def main(cliargs: Optional[List[str]] = None) -> int:
  13. if __package__ == "":
  14. path = os.path.dirname(os.path.dirname(__file__))
  15. sys.path[0:0] = [path]
  16. return cli.main(cliargs)
  17. if __name__ == "__main__":
  18. sys.exit(main(sys.argv[1:]))