From nobody Wed Oct 8 09:24:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8C3811EBA0D; Mon, 30 Jun 2025 21:52:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751320364; cv=none; b=E8eqUEibCNMmT/fIXhaXt8crm2kzz/J7uShlVOl03FfrPpfsyfzc7T0IurpO5fFhMEwXf7lpCbhziSXqz//w9ghY+A3E2ZY1LXw2n3Yn5cciRejIRKcuzq2A5Ld4eWEI17t6V0ubKI7/5GRekxFU6+Y7c2KfvVQys0Fx7QXVKcA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751320364; c=relaxed/simple; bh=ZwhknBqlHdkBeAIFTDnGtCR/SgMMaoQkTrq3Mjl5ySI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZVam6R1OZEYwSGzo4wxkkVLc7yCcqerw55J95HFnVeWBfZNvpdP24pImFgA8uHTfhUML7ApVslzLNv61v1FfHScAStF5K5GdOPnG1A1BR6/D5XwA8MOB0WgUR+joWIBJonDAnP7olj9t/zC12Iqdux31U4d12b2qWFUK/jW6aDo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=bj5xMQTd; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="bj5xMQTd" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 54373C4AF09; Mon, 30 Jun 2025 21:52:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1751320364; bh=ZwhknBqlHdkBeAIFTDnGtCR/SgMMaoQkTrq3Mjl5ySI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bj5xMQTd/AlShkhpDFPAAnYzd/ZXaXZ+ZXMCs95/aFVD3fr8bH59+3BHnw7hRXN6i exrLrrkEmyhP0UmTTPSIfVI33CHyDzDCgCLpGoLi101Kovjo8d6fV2vynOA3EROakH yZ35//HOVrlTVnvTasAs0mqw2+64JkSML9OTGHg5XywvvSweuZfFEkSh1r0PQWzO0k yIKOzs4O5DwZHv00jxzKKwWy89nc+ru3qaLjZvZf7ktxy5cHoT6/Bb3od5HKrrl2cw Du0OCvq80ovKUuJ2cy4E1yhA7iPFamp+s3WaRUvnTaCjZZKRVwCbXg/xM0jD5SeGv6 bUdc3i2J5QyvA== Received: from mchehab by mail.kernel.org with local (Exim 4.98.2) (envelope-from ) id 1uWMQc-00000003QWh-2G2Q; Mon, 30 Jun 2025 23:52:42 +0200 From: Mauro Carvalho Chehab To: Linux Doc Mailing List , Jonathan Corbet Cc: Mauro Carvalho Chehab , "Akira Yokosawa" , "Mauro Carvalho Chehab" , "Sai Vishnu M" , linux-kernel@vger.kernel.org Subject: [PATCH 07/15] scripts: sphinx-pre-install: drop support for old virtualenv Date: Mon, 30 Jun 2025 23:34:55 +0200 Message-ID: <000c49af2cedd9e25b7ceacc3d69be8d73c876c6.1751318230.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.50.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: Mauro Carvalho Chehab Content-Type: text/plain; charset="utf-8" Up to Python 3.2, the virtual environment were created via virtualenv binary. As we dropped support for such old version, clean up the code. Signed-off-by: Mauro Carvalho Chehab --- scripts/sphinx-pre-install.py | 69 +++++++++-------------------------- 1 file changed, 18 insertions(+), 51 deletions(-) diff --git a/scripts/sphinx-pre-install.py b/scripts/sphinx-pre-install.py index b639acd455cc..0a73b1b33842 100755 --- a/scripts/sphinx-pre-install.py +++ b/scripts/sphinx-pre-install.py @@ -80,7 +80,6 @@ class SphinxDependencyChecker: self.need_symlink =3D 0 self.need_sphinx =3D 0 self.need_pip =3D 0 - self.need_virtualenv =3D 0 self.rec_sphinx_upgrade =3D 0 self.verbose_warn_install =3D 1 =20 @@ -919,12 +918,14 @@ class SphinxDependencyChecker: else: print("\nSphinx needs to be installed either:\n1) via pip/pypi= with:\n") =20 - self.python_cmd =3D os.path.abspath(sys.argv[0]) - - print(f"\t{virtualenv_cmd} {self.virtenv_dir}") - print(f"\t. {self.virtenv_dir}/bin/activate") - print(f"\tpip install -r {self.requirement_file}") - self.deactivate_help() + if not virtualenv_cmd: + print(" Currently not possible.\n") + print(" Please upgrade Python to a newer version and run thi= s script again") + else: + print(f"\t{virtualenv_cmd} {self.virtenv_dir}") + print(f"\t. {self.virtenv_dir}/bin/activate") + print(f"\tpip install -r {self.requirement_file}") + self.deactivate_help() =20 print("\n2) As a package with:") =20 @@ -953,6 +954,7 @@ class SphinxDependencyChecker: =20 def check_needs(self): self.get_system_release() + self.python_cmd =3D sys.executable =20 # Check if Sphinx is already accessible from current environment self.check_sphinx() @@ -965,56 +967,21 @@ class SphinxDependencyChecker: ver =3D ver_str(self.cur_version) print(f"Sphinx version: {ver}\n") =20 - # FIXME: Check python command line, trying first python3 - self.python_cmd =3D self.which("python3") - if not self.python_cmd: - self.python_cmd =3D self.check_program("python", 0) - # Check the type of virtual env, depending on Python version - if self.python_cmd: - if self.virtualenv: - try: - result =3D self.run( - [self.python_cmd, "--version"], - capture_output=3DTrue, - text=3DTrue, - check=3DTrue, - ) + virtualenv_cmd =3D None =20 - output =3D result.stdout + result.stderr - - match =3D re.search(r"(\d+)\.(\d+)\.", output) - if match: - major =3D int(match.group(1)) - minor =3D int(match.group(2)) - - if major < 3: - sys.exit("Python 3 is required to build the ke= rnel docs") - if major =3D=3D 3 and minor < 3: - self.need_virtualenv =3D True - else: - sys.exit(f"Warning: couldn't identify {self.python= _cmd} version!") - - except subprocess.CalledProcessError as e: - sys.exit(f"Error checking Python version: {e}") - else: - self.add_package("python-sphinx", 0) + if sys.version_info < MIN_PYTHON_VERSION: + min_ver =3D ver_str(MIN_PYTHON_VERSION) + print(f"ERROR: at least python {min_ver} is required to build = the kernel docs") + self.need_sphinx =3D 1 =20 self.venv_ver =3D self.recommend_sphinx_upgrade() =20 - virtualenv_cmd =3D "" - if self.need_pip: - # Set virtualenv command line, if python < 3.3 - # FIXME: can be removed as we're now with an upper min require= ment - # but then we need to check python version - if self.need_virtualenv: - virtualenv_cmd =3D self.which("virtualenv-3") - if not virtualenv_cmd: - virtualenv_cmd =3D self.which("virtualenv-3.5") - if not virtualenv_cmd: - self.check_program("virtualenv", 0) - virtualenv_cmd =3D "virtualenv" + if sys.version_info < MIN_PYTHON_VERSION: + self.need_pip =3D False + print("Warning: python version is not supported.") + else: virtualenv_cmd =3D f"{self.python_cmd} -m venv" self.check_python_module("ensurepip", 0) --=20 2.50.0