Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp4234864imm; Mon, 8 Oct 2018 17:57:28 -0700 (PDT) X-Google-Smtp-Source: ACcGV62+7sjJhBtsMCi4YHD/CwI3kcAEo+hRc4/wuNzkFosIflT8UuiwJBFq8DSdVadNV244jh9M X-Received: by 2002:a62:1b45:: with SMTP id b66-v6mr27575347pfb.94.1539046648136; Mon, 08 Oct 2018 17:57:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539046648; cv=none; d=google.com; s=arc-20160816; b=uvOOpApMX4ci2eioX3Hs2OLdt/TABp59GQFeHeEgee0PeCEmZVDsTSwLW2WEkjV6lq Kuzh4aRGHXmfWRsuI3BwUpHUFJaO3+87LvDV/1WMnXnyt5UJxpA5cOIMAKRNe0pOkrg0 UYuB3gvR0LA9RjY4JVn6AvPNZ1LQ4G+KRG/9XDAykbqbUihRSX5ihqgsWLN5hbeybnkc a9zBlUMDqo9cESn4LDYoL06BU07o2WfV5czZ9ML0yrI0IaxNsC7IM744ShPpTjNBomnI Lu+shmQp7bLPdPsAQ1SsK9m8jCQSGSNDqxBya/UTHj+x0zNhm5NAC7p8vR1tIJ3q6gws bvhQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=t7goRgvBU9ge8zyuX51RGVpbBkkVmfSzfLZhtg6asoA=; b=HZlVJlhVoklyX/eUlHg8OYWmX7jAsZ+1WVTdUOYClcCDLOv2g0AaMryrUc6GGcvqE5 jon6XuXUru/rQ3TXr8WGNZnkrDKyJT7cklG/Ty761+hM4uU/OH2xV2h1LOaW3n1gRjcD gl18Z8xiKveI1mFTz8yLvRq+UMUJp4n/LPQmuoKFxYhFczzQFl4RgjPPZRehKfQFbGCM M52jh39q8ocBuCATfvCLZq4uzT/C1CGzLQboTERmGpqQV/Qa73bTIaS1KOm+2JGUg4XV YrCBbtCS+z5BfWv7dpZxs5tOA233KiETE++MdhZf2DqIvPwuG1jm2Uu15JF7dV5SZyVJ vAQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=R4hR7e4D; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r62-v6si19694229pfd.37.2018.10.08.17.57.13; Mon, 08 Oct 2018 17:57:28 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=R4hR7e4D; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727085AbeJIIJo (ORCPT + 99 others); Tue, 9 Oct 2018 04:09:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:42370 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727056AbeJIIJo (ORCPT ); Tue, 9 Oct 2018 04:09:44 -0400 Received: from jouet.infradead.org (unknown [179.97.41.186]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0CC5421476; Tue, 9 Oct 2018 00:55:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1539046523; bh=mkYykeBR8KGsh2gdZVWW9Djc7sUxlMy7Zqm17pynDPc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R4hR7e4D7ckhhuBYgFzI03/77u46rfIGsXqGu8pfQcazqlGjdv4VWSj3FEVbpYcB5 c/tyveBgFZJ9kCotbYBmQqYovqu0S6nFLjo5r75aOFKpzGwOlnFw4BKyL80OJSm0iT LKtJOMEy5FCdYgsUZ/gxjr06dJjgZVn3XLd3gwq4= From: Arnaldo Carvalho de Melo To: Ingo Molnar Cc: Clark Williams , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Eduardo Habkost , Adrian Hunter , David Ahern , Jiri Olsa , Namhyung Kim , Wang Nan , Arnaldo Carvalho de Melo Subject: [PATCH 10/12] perf python: More portable way to make CFLAGS work with clang Date: Mon, 8 Oct 2018 21:54:25 -0300 Message-Id: <20181009005427.6607-11-acme@kernel.org> X-Mailer: git-send-email 2.14.4 In-Reply-To: <20181009005427.6607-1-acme@kernel.org> References: <20181009005427.6607-1-acme@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Eduardo Habkost The existing code that tries to make CFLAGS compatible with clang doesn't work with Python 3. Instead of trying to touch _sysconfigdata.build_time_vars directly, change the dictionary returned by disutils.sysconfig.get_config_vars(). This works on both Python 2 and Python 3. Signed-off-by: Eduardo Habkost Reported-by: Arnaldo Carvalho de Melo Tested-by: Arnaldo Carvalho de Melo Cc: Adrian Hunter Cc: David Ahern Cc: Jiri Olsa Cc: Namhyung Kim Cc: Wang Nan Link: http://lkml.kernel.org/r/20181005204058.7966-3-ehabkost@redhat.com Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/setup.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/tools/perf/util/setup.py b/tools/perf/util/setup.py index 261a55e7e1b2..63f758c655d5 100644 --- a/tools/perf/util/setup.py +++ b/tools/perf/util/setup.py @@ -9,12 +9,14 @@ def clang_has_option(option): cc = getenv("CC") if cc == "clang": - from _sysconfigdata import build_time_vars - build_time_vars["CFLAGS"] = sub("-specs=[^ ]+", "", build_time_vars["CFLAGS"]) - if not clang_has_option("-mcet"): - build_time_vars["CFLAGS"] = sub("-mcet", "", build_time_vars["CFLAGS"]) - if not clang_has_option("-fcf-protection"): - build_time_vars["CFLAGS"] = sub("-fcf-protection", "", build_time_vars["CFLAGS"]) + from distutils.sysconfig import get_config_vars + vars = get_config_vars() + for var in ('CFLAGS', 'OPT'): + vars[var] = sub("-specs=[^ ]+", "", vars[var]) + if not clang_has_option("-mcet"): + vars[var] = sub("-mcet", "", vars[var]) + if not clang_has_option("-fcf-protection"): + vars[var] = sub("-fcf-protection", "", vars[var]) from distutils.core import setup, Extension -- 2.14.4