Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
``setup.py`` now uses ``CC`` from environment first to discover multiarch
and cross compile paths.
19 changes: 9 additions & 10 deletions 19 setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ def get_platform():
MACOS = (HOST_PLATFORM == 'darwin')
AIX = (HOST_PLATFORM.startswith('aix'))
VXWORKS = ('vxworks' in HOST_PLATFORM)
CC = os.environ.get("CC")
if not CC:
CC = sysconfig.get_config_var("CC")


SUMMARY = """
Expand Down Expand Up @@ -467,6 +470,9 @@ def set_compiler_executables(self):

def build_extensions(self):
self.set_srcdir()
self.set_compiler_executables()
self.configure_compiler()
self.init_inc_lib_dirs()

# Detect which modules should be compiled
self.detect_modules()
Expand All @@ -476,7 +482,6 @@ def build_extensions(self):

self.update_sources_depends()
mods_built, mods_disabled = self.remove_configured_extensions()
self.set_compiler_executables()

if LIST_MODULE_NAMES:
for ext in self.extensions:
Expand Down Expand Up @@ -662,12 +667,11 @@ def check_extension_import(self, ext):
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)
ret = run_command(
'%s -print-multiarch > %s 2> /dev/null' % (cc, tmpfile))
'%s -print-multiarch > %s 2> /dev/null' % (CC, tmpfile))
multiarch_path_component = ''
try:
if ret == 0:
Expand Down Expand Up @@ -729,11 +733,10 @@ def add_search_path(line):
d = os.path.normpath(d)
add_dir_to_list(self.compiler.library_dirs, d)

cc = sysconfig.get_config_var('CC')
tmpfile = os.path.join(self.build_temp, 'wrccpaths')
os.makedirs(self.build_temp, exist_ok=True)
try:
ret = run_command('%s --print-search-dirs >%s' % (cc, tmpfile))
ret = run_command('%s --print-search-dirs >%s' % (CC, tmpfile))
if ret:
return
with open(tmpfile) as fp:
Expand All @@ -751,11 +754,10 @@ def add_search_path(line):
pass

def add_cross_compiling_paths(self):
cc = sysconfig.get_config_var('CC')
tmpfile = os.path.join(self.build_temp, 'ccpaths')
if not os.path.exists(self.build_temp):
os.makedirs(self.build_temp)
ret = run_command('%s -E -v - </dev/null 2>%s 1>/dev/null' % (cc, tmpfile))
ret = run_command('%s -E -v - </dev/null 2>%s 1>/dev/null' % (CC, tmpfile))
is_gcc = False
is_clang = False
in_incdirs = False
Expand Down Expand Up @@ -1876,9 +1878,6 @@ def detect_uuid(self):
self.missing.append('_uuid')

def detect_modules(self):
self.configure_compiler()
self.init_inc_lib_dirs()

self.detect_simple_extensions()
if TEST_EXTENSIONS:
self.detect_test_extensions()
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.