Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
allow building with different compilers on debian/ubuntu
Browse files Browse the repository at this point in the history
  • Loading branch information
isuruf authored and Matthias Koeppe committed Dec 20, 2021
1 parent 7030a0f commit 5af7789
Showing 1 changed file with 48 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
From aef4a7749dec9ecf942647af39d7a1303c758131 Mon Sep 17 00:00:00 2001
From: Isuru Fernando <[email protected]>
Date: Thu, 16 Sep 2021 15:46:09 -0500
Subject: [PATCH 08/24] bpo-22699: Allow compiling on debian/ubuntu with a
different compiler

This PR fixes one issue mentioned in the bpo
https://bugs.python.org/issue22699#msg364685 with a slightly better
patch than given
---
setup.py | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/setup.py b/setup.py
index 8fb8ea5c47..783d20bdcd 100644
--- a/setup.py
+++ b/setup.py
@@ -663,9 +663,26 @@ def add_multiarch_paths(self):
# Debian/Ubuntu multiarch support.
# https://wiki.ubuntu.com/MultiarchSpec
cc = sysconfig.get_config_var('CC')
- tmpfile = os.path.join(self.build_temp, 'multiarch')
if not os.path.exists(self.build_temp):
os.makedirs(self.build_temp)
+
+ tmpfile_sysroot = os.path.join(self.build_temp, 'sysroot')
+ ret_sysroot = run_command(
+ '%s -print-sysroot > %s 2> /dev/null' % (cc, tmpfile_sysroot))
+
+ try:
+ if ret_sysroot == 0:
+ with open(tmpfile_sysroot) as fp:
+ sysroot = fp.readline().strip()
+ # if the sysroot is not /, then we are not using
+ # the compiler from debian/ubuntu
+ if sysroot not in ['', '/']:
+ return
+ finally:
+ os.unlink(tmpfile_sysroot)
+
+ tmpfile = os.path.join(self.build_temp, 'multiarch')
+
ret = run_command(
'%s -print-multiarch > %s 2> /dev/null' % (cc, tmpfile))
multiarch_path_component = ''
--
2.30.2

0 comments on commit 5af7789

Please sign in to comment.