From 2825d02cb257b81f845329469e96e9fe32cf613c Mon Sep 17 00:00:00 2001
From: Pierre-Antoine Rouby <pierre-antoine.rouby@inrae.fr>
Date: Mon, 9 Oct 2023 14:16:15 +0200
Subject: [PATCH] doc: Fix path for build version.

---
 src/View/Doc/Window.py | 12 ++++++++++--
 src/init.py            |  4 ++++
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/src/View/Doc/Window.py b/src/View/Doc/Window.py
index 3c39dca0..ce6077ea 100644
--- a/src/View/Doc/Window.py
+++ b/src/View/Doc/Window.py
@@ -16,7 +16,7 @@
 
 # -*- coding: utf-8 -*-
 
-import os
+import os, sys
 import logging
 import subprocess
 
@@ -37,10 +37,18 @@ class DocWindow(PamhyrWindow):
     _pamhyr_name = "Doc"
 
     def _path_file(self, filename):
+        if ".py" in sys.argv[0]:
+            return os.path.abspath(
+                os.path.join(
+                    os.path.dirname(__file__),
+                    "..", "..", "..", "doc", filename
+                )
+            )
+
         return os.path.abspath(
             os.path.join(
                 os.path.dirname(__file__),
-                "..", "..", "..", "doc", filename
+                "..", "..", "..", "..", "doc", filename
             )
         )
 
diff --git a/src/init.py b/src/init.py
index 0d602128..5e5e434d 100644
--- a/src/init.py
+++ b/src/init.py
@@ -83,6 +83,10 @@ def license():
     logger.info("license: This is free software, and you are welcome to redistribute it")
     logger.info("license: under certain conditions.")
 
+    py_version = sys.version.split("\n")[0]
+
+    logger.info(f"python: {py_version}")
+
 def setup_lang(app, conf:Config):
     "Return QTranslator configured for current language"
     lang_file = ""
-- 
GitLab