[PATCH 06/13] docs: move get_abi.py to tools/doc

Jonathan Corbet posted 13 patches 1 month, 3 weeks ago
[PATCH 06/13] docs: move get_abi.py to tools/doc
Posted by Jonathan Corbet 1 month, 3 weeks ago
Move this tool out of scripts/ to join the other documentation tools; fix
up a couple of erroneous references in the process.

It's worth noting that this script will fail badly unless one has a
PYTHONPATH referencing scripts/lib/abi.

Signed-off-by: Jonathan Corbet <corbet@lwn.net>
---
 Documentation/Kconfig              | 2 +-
 Documentation/Makefile             | 2 +-
 Documentation/sphinx/kernel_abi.py | 2 +-
 MAINTAINERS                        | 1 -
 {scripts => tools/doc}/get_abi.py  | 0
 5 files changed, 3 insertions(+), 4 deletions(-)
 rename {scripts => tools/doc}/get_abi.py (100%)

diff --git a/Documentation/Kconfig b/Documentation/Kconfig
index 3a0e7ac0c4e3..70178e9e0c6c 100644
--- a/Documentation/Kconfig
+++ b/Documentation/Kconfig
@@ -19,7 +19,7 @@ config WARN_ABI_ERRORS
 	  described at Documentation/ABI/README. Yet, as they're manually
 	  written, it would be possible that some of those files would
 	  have errors that would break them for being parsed by
-	  scripts/get_abi.pl. Add a check to verify them.
+	  tools/doc/get_abi.py. Add a check to verify them.
 
 	  If unsure, select 'N'.
 
diff --git a/Documentation/Makefile b/Documentation/Makefile
index 962c4fab94b0..eef5decb79b8 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -13,7 +13,7 @@ endif
 
 # Check for broken ABI files
 ifeq ($(CONFIG_WARN_ABI_ERRORS),y)
-$(shell $(srctree)/scripts/get_abi.py --dir $(srctree)/Documentation/ABI validate)
+$(shell $(srctree)/tools/doc/get_abi.py --dir $(srctree)/Documentation/ABI validate)
 endif
 endif
 
diff --git a/Documentation/sphinx/kernel_abi.py b/Documentation/sphinx/kernel_abi.py
index 4c4375201b9e..32e39fb8bc3b 100644
--- a/Documentation/sphinx/kernel_abi.py
+++ b/Documentation/sphinx/kernel_abi.py
@@ -14,7 +14,7 @@
     :license:    GPL Version 2, June 1991 see Linux/COPYING for details.
 
     The ``kernel-abi`` (:py:class:`KernelCmd`) directive calls the
-    scripts/get_abi.py script to parse the Kernel ABI files.
+    AbiParser class to parse the Kernel ABI files.
 
     Overview of directive's argument and options.
 
diff --git a/MAINTAINERS b/MAINTAINERS
index ec9872642597..b41b78215035 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -7302,7 +7302,6 @@ P:	Documentation/doc-guide/maintainer-profile.rst
 T:	git git://git.lwn.net/linux.git docs-next
 F:	Documentation/
 F:	tools/doc/
-F:	scripts/get_abi.py
 F:	scripts/kernel-doc*
 F:	scripts/lib/abi/*
 F:	scripts/lib/kdoc/*
diff --git a/scripts/get_abi.py b/tools/doc/get_abi.py
similarity index 100%
rename from scripts/get_abi.py
rename to tools/doc/get_abi.py
-- 
2.50.1
Re: [PATCH 06/13] docs: move get_abi.py to tools/doc
Posted by Mauro Carvalho Chehab 1 month, 3 weeks ago
Em Wed, 13 Aug 2025 15:32:05 -0600
Jonathan Corbet <corbet@lwn.net> escreveu:

> Move this tool out of scripts/ to join the other documentation tools; fix
> up a couple of erroneous references in the process.
> 
> It's worth noting that this script will fail badly unless one has a
> PYTHONPATH referencing scripts/lib/abi.

Heh, on all Python scripts you're moving, you need to change the logic.

In the case of kernel-doc, you need to change from:

	LIB_DIR = "lib/kdoc"
	SRC_DIR = os.path.dirname(os.path.realpath(__file__))		# Currently scripts/
	sys.path.insert(0, os.path.join(SRC_DIR, LIB_DIR))

to:

	LIB_DIR = "../../scripts/lib/kdoc"
	SRC_DIR = os.path.dirname(os.path.realpath(__file__))		# Currently scripts/
	sys.path.insert(0, os.path.join(SRC_DIR, LIB_DIR))

Here, it is the same, except that LIB_DIR will now be:

	LIB_DIR = "../../scripts/lib/abi"
	

> 
> Signed-off-by: Jonathan Corbet <corbet@lwn.net>
> ---
>  Documentation/Kconfig              | 2 +-
>  Documentation/Makefile             | 2 +-
>  Documentation/sphinx/kernel_abi.py | 2 +-
>  MAINTAINERS                        | 1 -
>  {scripts => tools/doc}/get_abi.py  | 0
>  5 files changed, 3 insertions(+), 4 deletions(-)
>  rename {scripts => tools/doc}/get_abi.py (100%)
> 
> diff --git a/Documentation/Kconfig b/Documentation/Kconfig
> index 3a0e7ac0c4e3..70178e9e0c6c 100644
> --- a/Documentation/Kconfig
> +++ b/Documentation/Kconfig
> @@ -19,7 +19,7 @@ config WARN_ABI_ERRORS
>  	  described at Documentation/ABI/README. Yet, as they're manually
>  	  written, it would be possible that some of those files would
>  	  have errors that would break them for being parsed by
> -	  scripts/get_abi.pl. Add a check to verify them.
> +	  tools/doc/get_abi.py. Add a check to verify them.
>  
>  	  If unsure, select 'N'.
>  
> diff --git a/Documentation/Makefile b/Documentation/Makefile
> index 962c4fab94b0..eef5decb79b8 100644
> --- a/Documentation/Makefile
> +++ b/Documentation/Makefile
> @@ -13,7 +13,7 @@ endif
>  
>  # Check for broken ABI files
>  ifeq ($(CONFIG_WARN_ABI_ERRORS),y)
> -$(shell $(srctree)/scripts/get_abi.py --dir $(srctree)/Documentation/ABI validate)
> +$(shell $(srctree)/tools/doc/get_abi.py --dir $(srctree)/Documentation/ABI validate)
>  endif
>  endif
>  
> diff --git a/Documentation/sphinx/kernel_abi.py b/Documentation/sphinx/kernel_abi.py
> index 4c4375201b9e..32e39fb8bc3b 100644
> --- a/Documentation/sphinx/kernel_abi.py
> +++ b/Documentation/sphinx/kernel_abi.py
> @@ -14,7 +14,7 @@
>      :license:    GPL Version 2, June 1991 see Linux/COPYING for details.
>  
>      The ``kernel-abi`` (:py:class:`KernelCmd`) directive calls the
> -    scripts/get_abi.py script to parse the Kernel ABI files.
> +    AbiParser class to parse the Kernel ABI files.
>  
>      Overview of directive's argument and options.
>  
> diff --git a/MAINTAINERS b/MAINTAINERS
> index ec9872642597..b41b78215035 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -7302,7 +7302,6 @@ P:	Documentation/doc-guide/maintainer-profile.rst
>  T:	git git://git.lwn.net/linux.git docs-next
>  F:	Documentation/
>  F:	tools/doc/
> -F:	scripts/get_abi.py
>  F:	scripts/kernel-doc*
>  F:	scripts/lib/abi/*
>  F:	scripts/lib/kdoc/*
> diff --git a/scripts/get_abi.py b/tools/doc/get_abi.py
> similarity index 100%
> rename from scripts/get_abi.py
> rename to tools/doc/get_abi.py



Thanks,
Mauro