2
1

0001-setup.py-make-pip-optional.patch 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. From 978643b7222db66837d39037f884be01fb9af234 Mon Sep 17 00:00:00 2001
  2. From: Peter Korsgaard <peter@korsgaard.com>
  3. Date: Fri, 9 Mar 2018 18:40:16 +0100
  4. Subject: [PATCH] setup.py: make pip optional
  5. pip may not be available on the build host, and it is only used to check if
  6. docker-py is already installed, so skip the check if pip isn't available.
  7. [Upstream-status: submitted (https://github.com/docker/docker-py/pull/1948)]
  8. Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
  9. ---
  10. setup.py | 20 ++++++++++++--------
  11. 1 file changed, 12 insertions(+), 8 deletions(-)
  12. diff --git a/setup.py b/setup.py
  13. index 271d94f..c9b91a3 100644
  14. --- a/setup.py
  15. +++ b/setup.py
  16. @@ -5,16 +5,20 @@ import codecs
  17. import os
  18. import sys
  19. -import pip
  20. -
  21. from setuptools import setup, find_packages
  22. -if 'docker-py' in [x.project_name for x in pip.get_installed_distributions()]:
  23. - print(
  24. - 'ERROR: "docker-py" needs to be uninstalled before installing this'
  25. - ' package:\npip uninstall docker-py', file=sys.stderr
  26. - )
  27. - sys.exit(1)
  28. +try:
  29. + import pip
  30. +
  31. + if 'docker-py' in \
  32. + [x.project_name for x in pip.get_installed_distributions()]:
  33. + print(
  34. + 'ERROR: "docker-py" needs to be uninstalled before installing this'
  35. + ' package:\npip uninstall docker-py', file=sys.stderr
  36. + )
  37. + sys.exit(1)
  38. +except ImportError:
  39. + pass
  40. ROOT_DIR = os.path.dirname(__file__)
  41. SOURCE_DIR = os.path.join(ROOT_DIR)
  42. --
  43. 2.11.0