From da4a87387b4589313003a7bc73832ee6d19f74c4 Mon Sep 17 00:00:00 2001
From: Mike Gilbert <floppym@gentoo.org>
Date: Fri, 5 Jan 2018 13:32:45 -0500
Subject: [PATCH 04/14] setup.py: exit with non-zero status on failure

https://bugs.gentoo.org/show_bug.cgi?id=281968
https://bugs.python.org/issue6731
---
 setup.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/setup.py b/setup.py
index e5a3f1aff8..15dd1c4ad4 100644
--- a/setup.py
+++ b/setup.py
@@ -105,6 +105,7 @@ Programming Language :: Python
 Topic :: Software Development
 """
 
+exit_status = 0
 
 def run_command(cmd):
     status = os.system(cmd)
@@ -524,8 +525,10 @@ class PyBuildExt(build_ext):
             print("been built, they are *disabled* by configure:")
             print_three_column(self.disabled_configure)
             print()
+        global exit_status
 
         if self.failed:
+            exit_status = 1
             failed = self.failed[:]
             print()
             print("Failed to build these modules:")
@@ -533,6 +536,7 @@ class PyBuildExt(build_ext):
             print()
 
         if self.failed_on_import:
+            exit_status = 1
             failed = self.failed_on_import[:]
             print()
             print("Following modules built successfully"
@@ -2603,6 +2607,7 @@ def main():
           scripts = ["Tools/scripts/pydoc3", "Tools/scripts/idle3",
                      "Tools/scripts/2to3"]
         )
+    sys.exit(exit_status)
 
 # --install-platlib
 if __name__ == '__main__':
-- 
2.33.0

