changeset 44630:4c6189d45d67

setup: work around old versions of distutils breaking setup.py I'm not really sure how to trigger this, but we saw it in our build environment for Windows at Google. This fixed it. Sigh.
author Augie Fackler <augie@google.com>
date Tue, 31 Mar 2020 16:14:10 -0400
parents d37975386798
children 1ed6293fc31b
files setup.py
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/setup.py	Tue Mar 31 15:11:33 2020 +0530
+++ b/setup.py	Tue Mar 31 16:14:10 2020 -0400
@@ -489,7 +489,11 @@
     negative_opt['no-rust'] = 'rust'
 
     def _set_command_options(self, command_obj, option_dict=None):
-        command_obj.boolean_options += self.boolean_options
+        # Not all distutils versions in the wild have boolean_options.
+        # This should be cleaned up when we're Python 3 only.
+        command_obj.boolean_options = (
+            getattr(command_obj, 'boolean_options', []) + self.boolean_options
+        )
         return Distribution._set_command_options(
             self, command_obj, option_dict=option_dict
         )