diff mbox series

[1/5] doc: move the Git repo check to the conf.py file

Message ID 20260317-docs-releases-json-v1-1-492d0b256349@bootlin.com
State Accepted, archived
Commit 240ae9a7ddd530d0ecf7ec93fe85293c8a1986aa
Headers show
Series Docs build cleanup and automations | expand

Commit Message

Antonin Godard March 17, 2026, 10:08 a.m. UTC
This check can be done earlier when building the documentation, and does
not need any version information. Move it to the beginning of conf.py.

Signed-off-by: Antonin Godard <antonin.godard@bootlin.com>
---
 doc/conf.py        | 10 ++++++++++
 doc/setversions.py |  9 ---------
 2 files changed, 10 insertions(+), 9 deletions(-)
diff mbox series

Patch

diff --git a/doc/conf.py b/doc/conf.py
index 9318358731c..40a022eaa00 100644
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -8,10 +8,20 @@ 
 
 import datetime
 import os
+import subprocess
 import sys
 
 from pathlib import Path
 
+# Test that we are building from a Git repository
+try:
+    subprocess.run(["git", "rev-parse", "--is-inside-work-tree"],
+                   stdout=subprocess.PIPE, stderr=subprocess.PIPE, check=True)
+except subprocess.CalledProcessError:
+    sys.exit("Building bitbake's documentation must be done from its Git repository.\n"
+             "Clone the repository with the following command:\n"
+             "git clone https://git.openembedded.org/bitbake ")
+
 sys.path.insert(0, os.path.abspath('.'))
 import setversions
 
diff --git a/doc/setversions.py b/doc/setversions.py
index 9e4138025ac..2ec68ac9945 100755
--- a/doc/setversions.py
+++ b/doc/setversions.py
@@ -43,15 +43,6 @@  BB_RELEASE_TAG_RE = re.compile(r"^[0-9]+\.[0-9]+\.[0-9]+$")
 def get_current_version():
     ourversion = None
 
-    # Test that we are building from a Git repository
-    try:
-        subprocess.run(["git", "rev-parse", "--is-inside-work-tree"],
-                       stdout=subprocess.PIPE, stderr=subprocess.PIPE, check=True)
-    except subprocess.CalledProcessError:
-        sys.exit("Building bitbake's documentation must be done from its Git repository.\n"
-                 "Clone the repository with the following command:\n"
-                 "git clone https://git.openembedded.org/bitbake ")
-
     # Test tags exist and inform the user to fetch if not
     try:
         subprocess.run(["git", "show", f"{LTSSERIES[0]}.0"],