mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Namhyung Kim <namhyung@kernel.org>
To: acme@kernel.org, Ian Rogers <irogers@google.com>
Cc: adrian.hunter@intel.com, james.clark@linaro.org,
	jolsa@kernel.org,  leo.yan@arm.com, linux-kernel@vger.kernel.org,
	 linux-perf-users@vger.kernel.org, mingo@redhat.com,
	peterz@infradead.org
Subject: Re: [PATCH v3] perf python: Clean up and restructure setup.py
Date: Sat, 25 Jul 2026 22:23:56 -0700	[thread overview]
Message-ID: <178504343636.1075259.2178744894379944705.b4-ty@kernel.org> (raw)
In-Reply-To: <20260723172709.1271166-1-irogers@google.com>

On Thu, 23 Jul 2026 10:27:09 -0700, Ian Rogers wrote:
> Clean up and restructure the python setup script to resolve pylint
> warnings, improve code quality, and increase robustness and
> readability, targeting Python 3.9+ (the Linux kernel build minimum
> Python version).
> 
> Changes:
> - Restructure the script to use a `main()` function as the entry point,
>   leaving only imports, classes, and pure functions at module level.
> - Eliminate all global/module-level variables, making them local to
>   `main()` or the respective classes/functions.
> - Make `clang_has_option` a pure function by passing all necessary
>   parameters explicitly.
> - Extract clang compiler flag filtering into a new
>   `filter_clang_options` helper function. This function uses a loop
>   over a tuple of options, replacing ~30 lines of repetitive blocks
>   and reducing branch/statement complexity in the main flow.
> - Cleanly define attributes in `__init__` for `BuildExt` and
>   `InstallLib` and read environment variables dynamically within the
>   methods (including `srctree` in `InstallLib.run`), removing their
>   dependency on global variables.
> - Replace legacy Popen with subprocess.run for safer process handling.
> - Use quote-aware flag filtering (`shlex.split`, filter, `shlex.join`)
>   on sysconfig CFLAGS and OPT instead of regex `re.sub` substitutions.
>   This avoids boundary bugs and safely handles quoted arguments and
>   options with values.
> - Rely on setuptools to handle user CFLAGS from the environment
>   directly rather than manually prepending them to extra_compile_args.
> - Safely parse `CC` env var using `shlex.split` to handle quotes and
>   pass compiler arguments as `list[str]` lists to helper functions,
>   avoiding redundant string formatting and parsing.
> - Remove unused `import re`.
> - Rename setuptools command subclasses to PascalCase (BuildExt,
>   InstallLib).
> - Add type annotations to functions and methods.
> - Add missing docstrings for module, functions, and classes.
> - Split long lines to adhere to standard limits.
> 
> [...]
Applied to perf-tools-next, thanks!

Best regards,
Namhyung



      reply	other threads:[~2026-07-26  5:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-21 17:55 [PATCH v1] " Ian Rogers
2026-07-22 16:51 ` Ian Rogers
2026-07-23  5:32   ` Namhyung Kim
2026-07-23 16:44     ` [PATCH v2] " Ian Rogers
2026-07-23 17:27       ` [PATCH v3] " Ian Rogers
2026-07-26  5:23         ` Namhyung Kim [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=178504343636.1075259.2178744894379944705.b4-ty@kernel.org \
    --to=namhyung@kernel.org \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=irogers@google.com \
    --cc=james.clark@linaro.org \
    --cc=jolsa@kernel.org \
    --cc=leo.yan@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®