From: Andrea Cervesato via ltp <ltp@lists.linux.it>
To: Petr Vorel <pvorel@suse.cz>, ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v2 1/2] doc/Makefile: Allow to create and use .venv
Date: Wed, 12 Feb 2025 09:27:20 +0100 [thread overview]
Message-ID: <e96883c0-42c3-48ff-884f-4971d1c2b726@suse.com> (raw)
In-Reply-To: <20250211233552.1990618-1-pvorel@suse.cz>
Hi!
This somehow resolves the problem of not explicitly using virtualenv,
but I have the impression that it has some critical issues.
virtualenv is not part of the buildsystem, but it's an external tool
that collect python packages and it's up to the developer using it or
not, and this makes it optional. By introducing it in the Makefile, we
end up mixing things a little bit.
Also, this patch complicates the Makefile, since we might need one
command before running "make" (source our_venv/bin/activate) and two
commands once in a while to create it (venv + pip).
In short, I have the impression there's no additional value to the
patch, but mostly an over-engineered Makefile :-)
Andrea
On 2/12/25 00:35, Petr Vorel wrote:
> This is an optional target (not run by default).
> If .venv exists, it's used in other targets.
>
> This helps to use virtualenv for development, but avoid using it by
> default (readthedoc uses container with virtualenv, creating it would be
> waste of time).
>
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
> v1: https://patchwork.ozlabs.org/project/ltp/patch/20250206143421.1571918-4-pvorel@suse.cz/
>
> Changes v1->v2:
> * virtualenv is optional
> * use variables
>
> doc/Makefile | 18 +++++++++++++++---
> 1 file changed, 15 insertions(+), 3 deletions(-)
>
> diff --git a/doc/Makefile b/doc/Makefile
> index a07df04d5c..909d9687b8 100644
> --- a/doc/Makefile
> +++ b/doc/Makefile
> @@ -5,14 +5,26 @@ top_srcdir ?= ..
>
> include $(top_srcdir)/include/mk/env_pre.mk
>
> +PYTHON := python3
> +VENV_DIR := .venv
> +VENV_CMD := . $(VENV_DIR)/bin/activate
> +RUN_VENV := if [ -d $(VENV_DIR) ]; then $(VENV_CMD); fi
> +
> +# install sphinx only if needed
> +INSTALL_SPHINX := $(shell $(PYTHON) -c "import sphinx" 2>/dev/null && echo ":" || echo "pip install sphinx")
> +
> +$(VENV_DIR):
> + $(PYTHON) -m virtualenv $(VENV_DIR)
> + $(VENV_CMD) && pip install -r requirements.txt && $(INSTALL_SPHINX)
> +
> ${abs_top_builddir}/metadata/ltp.json:
> $(MAKE) -C ${abs_top_builddir}/metadata
>
> all: ${abs_top_builddir}/metadata/ltp.json
> - sphinx-build -b html . html
> + $(RUN_VENV); sphinx-build -b html . html
>
> spelling:
> - sphinx-build -b spelling -d build/doctree . build/spelling
> + $(RUN_VENV); sphinx-build -b spelling -d build/doctree . build/spelling
>
> clean:
> - rm -rf html/ build/ _static/syscalls.rst _static/tests.rst syscalls.tbl
> + rm -rf html/ build/ _static/syscalls.rst _static/tests.rst syscalls.tbl $(VENV_DIR)
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2025-02-12 8:27 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-11 23:35 [LTP] [PATCH v2 1/2] doc/Makefile: Allow to create and use .venv Petr Vorel
2025-02-11 23:35 ` [LTP] [PATCH v2 2/2] Makefile: Update 'doc' target to build sphinx doc Petr Vorel
2025-02-12 8:27 ` Andrea Cervesato via ltp [this message]
2025-02-12 12:50 ` [LTP] [PATCH v2 1/2] doc/Makefile: Allow to create and use .venv Petr Vorel
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=e96883c0-42c3-48ff-884f-4971d1c2b726@suse.com \
--to=ltp@lists.linux.it \
--cc=andrea.cervesato@suse.com \
--cc=pvorel@suse.cz \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.