setup.py 989 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #!/usr/bin/env python3
  2. """
  3. QEMU tooling installer script
  4. Copyright (c) 2020-2021 John Snow for Red Hat, Inc.
  5. """
  6. import setuptools
  7. from setuptools.command import bdist_egg
  8. import sys
  9. import pkg_resources
  10. class bdist_egg_guard(bdist_egg.bdist_egg):
  11. """
  12. Protect against bdist_egg from being executed
  13. This prevents calling 'setup.py install' directly, as the 'install'
  14. CLI option will invoke the deprecated bdist_egg hook. "pip install"
  15. calls the more modern bdist_wheel hook, which is what we want.
  16. """
  17. def run(self):
  18. sys.exit(
  19. 'Installation directly via setup.py is not supported.\n'
  20. 'Please use `pip install .` instead.'
  21. )
  22. def main():
  23. """
  24. QEMU tooling installer
  25. """
  26. # https://medium.com/@daveshawley/safely-using-setup-cfg-for-metadata-1babbe54c108
  27. pkg_resources.require('setuptools>=39.2')
  28. setuptools.setup(cmdclass={'bdist_egg': bdist_egg_guard})
  29. if __name__ == '__main__':
  30. main()