From 585eb609ee7a3843d48bcf1f773a2fb5756a0c40 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Wed, 26 Feb 2020 11:52:49 +0100 Subject: [PATCH] fixed: only try around the ccache code build failed without ccache available --- python/setup.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/python/setup.py b/python/setup.py index 8da7c3c72..d88acc284 100644 --- a/python/setup.py +++ b/python/setup.py @@ -19,22 +19,21 @@ setupdir = os.path.dirname(__file__) if setupdir != '': os.chdir( setupdir ) +cc = os.environ.get("CC", "c++") try: subprocess.call(['ccache', '--version']) - cc = os.environ.get("CC", "c++") os.environ['CC'] = 'ccache {}'.format(cc) print("Using 'ccache {}' as compiler".format(cc)) - - # This is very hacky but so is the entire setup.py buildsystem. - output=subprocess.check_output([cc, "--version"]) - libs=['opmcommon', 'boost_system'] - output=str(output) - if output.find('Free Software Foundation'): - libs.append('stdc++fs') - except OSError as e: print('\nNOTE: please install ccache for faster compilation of python bindings.\n') +# This is very hacky but so is the entire setup.py buildsystem. +output=subprocess.check_output([cc, "--version"]) +libs=['opmcommon', 'boost_system'] +output=str(output) +if output.find('Free Software Foundation'): + libs.append('stdc++fs') + if 'build' in sys.argv: if not 'build_ext' in sys.argv: raise TypeError("Missing option 'build_ext'.")