make-deprecation-warning-switchable.patch 827 B

1234567891011121314151617181920212223242526272829
  1. Subject: Make the deprecation warning switchable
  2. Author: Christoph Biedl <debian.axhn@manchmal.in-ulm.de>
  3. Date: 2018-01-08
  4. Forwarded: soon
  5. --- a/magic/__init__.py
  6. +++ b/magic/__init__.py
  7. @@ -19,6 +19,7 @@
  8. import sys
  9. import glob
  10. +import os
  11. import os.path
  12. import ctypes
  13. import ctypes.util
  14. @@ -325,9 +326,10 @@
  15. def deprecation_wrapper(compat, fn, alternate):
  16. def _(*args, **kwargs):
  17. - warnings.warn(
  18. - "Using compatability mode with libmagic's python binding",
  19. - DeprecationWarning)
  20. + if "PYTHONMAGIC_WARN_DEPRECATED" in os.environ:
  21. + warnings.warn(
  22. + "Using compatibility mode with libmagic's python binding",
  23. + DeprecationWarning)
  24. return compat[fn](*args, **kwargs)
  25. return _