* [PATCH 0/2] tools/perf: Python 3 + clang build fixes
@ 2018-10-05 20:40 Eduardo Habkost
2018-10-05 20:40 ` [PATCH 1/2] perf: Make clang_has_option() work on Python 3 Eduardo Habkost
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Eduardo Habkost @ 2018-10-05 20:40 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo; +Cc: linux-kernel
This series contains a couple fixes to make it possible to build
perf with Python 3 and clang.
Eduardo Habkost (2):
perf: Make clang_has_option() work on Python 3
perf: More portable way to make CFLAGS work with clang
tools/perf/util/setup.py | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
--
2.18.0.rc1.1.g3f1ff2140
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/2] perf: Make clang_has_option() work on Python 3
2018-10-05 20:40 [PATCH 0/2] tools/perf: Python 3 + clang build fixes Eduardo Habkost
@ 2018-10-05 20:40 ` Eduardo Habkost
2018-10-09 5:32 ` [tip:perf/core] perf python: " tip-bot for Eduardo Habkost
2018-10-05 20:40 ` [PATCH 2/2] perf: More portable way to make CFLAGS work with clang Eduardo Habkost
2018-10-05 21:23 ` [PATCH 0/2] tools/perf: Python 3 + clang build fixes Arnaldo Carvalho de Melo
2 siblings, 1 reply; 6+ messages in thread
From: Eduardo Habkost @ 2018-10-05 20:40 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo; +Cc: linux-kernel
Use a bytes literal so it works with Python 3's version of
Popen(). Note that the b"..." syntax requires Python 2.6+.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
tools/perf/util/setup.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/util/setup.py b/tools/perf/util/setup.py
index 1942f6dd24f6..261a55e7e1b2 100644
--- a/tools/perf/util/setup.py
+++ b/tools/perf/util/setup.py
@@ -5,7 +5,7 @@ from subprocess import Popen, PIPE
from re import sub
def clang_has_option(option):
- return [o for o in Popen(['clang', option], stderr=PIPE).stderr.readlines() if "unknown argument" in o] == [ ]
+ return [o for o in Popen(['clang', option], stderr=PIPE).stderr.readlines() if b"unknown argument" in o] == [ ]
cc = getenv("CC")
if cc == "clang":
--
2.18.0.rc1.1.g3f1ff2140
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/2] perf: More portable way to make CFLAGS work with clang
2018-10-05 20:40 [PATCH 0/2] tools/perf: Python 3 + clang build fixes Eduardo Habkost
2018-10-05 20:40 ` [PATCH 1/2] perf: Make clang_has_option() work on Python 3 Eduardo Habkost
@ 2018-10-05 20:40 ` Eduardo Habkost
2018-10-09 5:32 ` [tip:perf/core] perf python: " tip-bot for Eduardo Habkost
2018-10-05 21:23 ` [PATCH 0/2] tools/perf: Python 3 + clang build fixes Arnaldo Carvalho de Melo
2 siblings, 1 reply; 6+ messages in thread
From: Eduardo Habkost @ 2018-10-05 20:40 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo; +Cc: linux-kernel
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 <ehabkost@redhat.com>
---
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.18.0.rc1.1.g3f1ff2140
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 0/2] tools/perf: Python 3 + clang build fixes
2018-10-05 20:40 [PATCH 0/2] tools/perf: Python 3 + clang build fixes Eduardo Habkost
2018-10-05 20:40 ` [PATCH 1/2] perf: Make clang_has_option() work on Python 3 Eduardo Habkost
2018-10-05 20:40 ` [PATCH 2/2] perf: More portable way to make CFLAGS work with clang Eduardo Habkost
@ 2018-10-05 21:23 ` Arnaldo Carvalho de Melo
2 siblings, 0 replies; 6+ messages in thread
From: Arnaldo Carvalho de Melo @ 2018-10-05 21:23 UTC (permalink / raw)
To: Eduardo Habkost
Cc: Adrian Hunter, David Ahern, Jiri Olsa, Namhyung Kim, Wang Nan,
linux-kernel
Em Fri, Oct 05, 2018 at 05:40:56PM -0300, Eduardo Habkost escreveu:
> This series contains a couple fixes to make it possible to build
> perf with Python 3 and clang.
>
> Eduardo Habkost (2):
> perf: Make clang_has_option() work on Python 3
> perf: More portable way to make CFLAGS work with clang
Thanks! That was fast!
Applying and testing,
- Arnaldo
^ permalink raw reply [flat|nested] 6+ messages in thread
* [tip:perf/core] perf python: Make clang_has_option() work on Python 3
2018-10-05 20:40 ` [PATCH 1/2] perf: Make clang_has_option() work on Python 3 Eduardo Habkost
@ 2018-10-09 5:32 ` tip-bot for Eduardo Habkost
0 siblings, 0 replies; 6+ messages in thread
From: tip-bot for Eduardo Habkost @ 2018-10-09 5:32 UTC (permalink / raw)
To: linux-tip-commits
Cc: ehabkost, mingo, linux-kernel, wangnan0, namhyung, hpa, acme,
jolsa, tglx, dsahern, adrian.hunter
Commit-ID: e13a5d69c31d35538e80176d54d95b6addf4dcbf
Gitweb: https://git.kernel.org/tip/e13a5d69c31d35538e80176d54d95b6addf4dcbf
Author: Eduardo Habkost <ehabkost@redhat.com>
AuthorDate: Fri, 5 Oct 2018 17:40:57 -0300
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 8 Oct 2018 14:30:44 -0300
perf python: Make clang_has_option() work on Python 3
Use a bytes literal so it works with Python 3's version of Popen().
Note that the b"..." syntax requires Python 2.6+.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/20181005204058.7966-2-ehabkost@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/setup.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/util/setup.py b/tools/perf/util/setup.py
index 1942f6dd24f6..261a55e7e1b2 100644
--- a/tools/perf/util/setup.py
+++ b/tools/perf/util/setup.py
@@ -5,7 +5,7 @@ from subprocess import Popen, PIPE
from re import sub
def clang_has_option(option):
- return [o for o in Popen(['clang', option], stderr=PIPE).stderr.readlines() if "unknown argument" in o] == [ ]
+ return [o for o in Popen(['clang', option], stderr=PIPE).stderr.readlines() if b"unknown argument" in o] == [ ]
cc = getenv("CC")
if cc == "clang":
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [tip:perf/core] perf python: More portable way to make CFLAGS work with clang
2018-10-05 20:40 ` [PATCH 2/2] perf: More portable way to make CFLAGS work with clang Eduardo Habkost
@ 2018-10-09 5:32 ` tip-bot for Eduardo Habkost
0 siblings, 0 replies; 6+ messages in thread
From: tip-bot for Eduardo Habkost @ 2018-10-09 5:32 UTC (permalink / raw)
To: linux-tip-commits
Cc: tglx, linux-kernel, wangnan0, hpa, jolsa, namhyung, ehabkost,
dsahern, adrian.hunter, acme, mingo
Commit-ID: 8b2f245faa6238e28a1d801e8633515251d1acfc
Gitweb: https://git.kernel.org/tip/8b2f245faa6238e28a1d801e8633515251d1acfc
Author: Eduardo Habkost <ehabkost@redhat.com>
AuthorDate: Fri, 5 Oct 2018 17:40:58 -0300
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 8 Oct 2018 14:30:45 -0300
perf python: More portable way to make CFLAGS work with clang
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 <ehabkost@redhat.com>
Reported-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/20181005204058.7966-3-ehabkost@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
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
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2018-10-09 5:32 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-05 20:40 [PATCH 0/2] tools/perf: Python 3 + clang build fixes Eduardo Habkost
2018-10-05 20:40 ` [PATCH 1/2] perf: Make clang_has_option() work on Python 3 Eduardo Habkost
2018-10-09 5:32 ` [tip:perf/core] perf python: " tip-bot for Eduardo Habkost
2018-10-05 20:40 ` [PATCH 2/2] perf: More portable way to make CFLAGS work with clang Eduardo Habkost
2018-10-09 5:32 ` [tip:perf/core] perf python: " tip-bot for Eduardo Habkost
2018-10-05 21:23 ` [PATCH 0/2] tools/perf: Python 3 + clang build fixes Arnaldo Carvalho de Melo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox