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