From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id A4BCB45CA6; Fri, 8 Nov 2024 12:41:16 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 743FD43399; Fri, 8 Nov 2024 12:40:26 +0100 (CET) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mails.dpdk.org (Postfix) with ESMTP id BE2EF4329A for ; Fri, 8 Nov 2024 12:40:23 +0100 (CET) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 24007339; Fri, 8 Nov 2024 03:40:53 -0800 (PST) Received: from localhost.localdomain (unknown [10.57.59.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 7B1BD3F7D8; Fri, 8 Nov 2024 03:40:22 -0800 (PST) From: Luca Vizzarro To: dev@dpdk.org Cc: Paul Szczepanek , Patrick Robb , Luca Vizzarro Subject: [PATCH v6 8/9] dts: fix custom enum behaviour with docs Date: Fri, 8 Nov 2024 11:40:04 +0000 Message-ID: <20241108114006.64595-9-luca.vizzarro@arm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241108114006.64595-1-luca.vizzarro@arm.com> References: <20240822163941.1390326-1-luca.vizzarro@arm.com> <20241108114006.64595-1-luca.vizzarro@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org When building docs without any dependencies, autodoc will mock all the packages missing from the system. Because DTS makes use of a special enum library called aenum, autodoc fails to recognise enum inheriting it as such and raises exceptions as a consequence. This change extends the already in-place mechanism for type checking that pretends that aenums are builtin enums to the API doc building process. Fixes: 039256daa8bf ("dts: add topology capability") Fixes: c89d00380603 ("dts: add NIC capability support") Signed-off-by: Luca Vizzarro Reviewed-by: Paul Szczepanek --- dts/framework/remote_session/testpmd_shell.py | 3 ++- dts/framework/testbed_model/topology.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/dts/framework/remote_session/testpmd_shell.py b/dts/framework/remote_session/testpmd_shell.py index 8a45a5231b..1561862f46 100644 --- a/dts/framework/remote_session/testpmd_shell.py +++ b/dts/framework/remote_session/testpmd_shell.py @@ -20,10 +20,11 @@ from collections.abc import Callable, MutableSet from dataclasses import dataclass, field from enum import Flag, auto +from os import environ from pathlib import PurePath from typing import TYPE_CHECKING, Any, ClassVar, Concatenate, ParamSpec, TypeAlias -if TYPE_CHECKING: +if TYPE_CHECKING or environ.get("DTS_DOC_BUILD"): from enum import Enum as NoAliasEnum else: from aenum import NoAliasEnum diff --git a/dts/framework/testbed_model/topology.py b/dts/framework/testbed_model/topology.py index 17b333e76a..3824804310 100644 --- a/dts/framework/testbed_model/topology.py +++ b/dts/framework/testbed_model/topology.py @@ -8,9 +8,10 @@ """ from dataclasses import dataclass +from os import environ from typing import TYPE_CHECKING, Iterable -if TYPE_CHECKING: +if TYPE_CHECKING or environ.get("DTS_DOC_BUILD"): from enum import Enum as NoAliasEnum else: from aenum import NoAliasEnum -- 2.43.0