summary refs log tree commit diff stats
path: root/python/setup.py
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2022-02-24 12:48:14 +0000
committerPeter Maydell <peter.maydell@linaro.org>2022-02-24 12:48:14 +0000
commitfa435db8ce1dff3b15e3f59a12f55f7b3a347b08 (patch)
tree0637100e8a0eb8e9f6c03ec95688adccd018be3a /python/setup.py
parent4aa2e497a98bafe962e72997f67a369e4b52d9c1 (diff)
parent89d38c74f4b69a93696392b55a9fee573055d78b (diff)
downloadfocaccia-qemu-fa435db8ce1dff3b15e3f59a12f55f7b3a347b08.tar.gz
focaccia-qemu-fa435db8ce1dff3b15e3f59a12f55f7b3a347b08.zip
Merge remote-tracking branch 'remotes/jsnow-gitlab/tags/python-pull-request' into staging
Python patches

New functionality in qmp-shell from Dan, and some packaging fixes.

# gpg: Signature made Wed 23 Feb 2022 22:08:35 GMT
# gpg:                using RSA key F9B7ABDBBCACDF95BE76CBD07DEF8106AAFC390E
# gpg: Good signature from "John Snow (John Huston) <jsnow@redhat.com>" [full]
# Primary key fingerprint: FAEB 9711 A12C F475 812F  18F2 88A9 064D 1835 61EB
#      Subkey fingerprint: F9B7 ABDB BCAC DF95 BE76  CBD0 7DEF 8106 AAFC 390E

* remotes/jsnow-gitlab/tags/python-pull-request:
  MAINTAINERS: python - remove ehabkost and add bleal
  Revert "python: pin setuptools below v60.0.0"
  Python: add setuptools v60.0 workaround
  Python: discourage direct setup.py install
  python: support recording QMP session to a file
  python: introduce qmp-shell-wrap convenience tool

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'python/setup.py')
-rwxr-xr-xpython/setup.py19
1 files changed, 18 insertions, 1 deletions
diff --git a/python/setup.py b/python/setup.py
index 2014f81b75..c5bc45919a 100755
--- a/python/setup.py
+++ b/python/setup.py
@@ -5,9 +5,26 @@ Copyright (c) 2020-2021 John Snow for Red Hat, Inc.
 """
 
 import setuptools
+from setuptools.command import bdist_egg
+import sys
 import pkg_resources
 
 
+class bdist_egg_guard(bdist_egg.bdist_egg):
+    """
+    Protect against bdist_egg from being executed
+
+    This prevents calling 'setup.py install' directly, as the 'install'
+    CLI option will invoke the deprecated bdist_egg hook. "pip install"
+    calls the more modern bdist_wheel hook, which is what we want.
+    """
+    def run(self):
+        sys.exit(
+            'Installation directly via setup.py is not supported.\n'
+            'Please use `pip install .` instead.'
+        )
+
+
 def main():
     """
     QEMU tooling installer
@@ -16,7 +33,7 @@ def main():
     # https://medium.com/@daveshawley/safely-using-setup-cfg-for-metadata-1babbe54c108
     pkg_resources.require('setuptools>=39.2')
 
-    setuptools.setup()
+    setuptools.setup(cmdclass={'bdist_egg': bdist_egg_guard})
 
 
 if __name__ == '__main__':