summarylogtreecommitdiffstats
path: root/7eff90f462c740b527a1484e31383ea707351180.patch
blob: 83ac88c09b1fd9c131e5b25fd8d16cb99cd9683c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
From 7eff90f462c740b527a1484e31383ea707351180 Mon Sep 17 00:00:00 2001
From: Pino Toscano <toscano.pino@tiscali.it>
Date: Mon, 30 Dec 2019 08:24:25 +0100
Subject: [PATCH] Check for only for Python 3 for erml2pdf.py

Python 3 has been around for many years, and even not so recent distros
ship it. Considering Python 2 is EOL since 2020, switch the search for
the Python interpreter for erml2pdf.py to Python 3 only.
---
 src/reportgenerator.cpp | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/src/reportgenerator.cpp b/src/reportgenerator.cpp
index 4547319..6ca4dcc 100644
--- a/src/reportgenerator.cpp
+++ b/src/reportgenerator.cpp
@@ -484,7 +484,7 @@ QStringList ReportGenerator::findTrml2Pdf( )
             p += QLatin1String("/tools/erml2pdf.py");
             // qDebug () << "Found erml2pdf from KRAFT_HOME: " << p;
             if( QFile::exists( p ) ) {
-                retList << "python";
+                retList << "python3";
                 retList << p;
                 mHavePdfMerge = true;
             }
@@ -492,14 +492,10 @@ QStringList ReportGenerator::findTrml2Pdf( )
             const QString ermlpy = QStandardPaths::locate(QStandardPaths::GenericDataLocation, "kraft/tools/erml2pdf.py" );
             // qDebug () << "Ermlpy: " << ermlpy;
             if( ! ermlpy.isEmpty() ) {
-                // need the python interpreter
-                // First check for python2 in python3 times.
-                QString python = QStandardPaths::findExecutable(QLatin1String("python2"));
+                // need the python3 interpreter, check for it
+                QString python = QStandardPaths::findExecutable(QLatin1String("python3"));
                 if( python.isEmpty() ) {
-                    python = QStandardPaths::findExecutable(QLatin1String("python"));
-                }
-                if( python.isEmpty() ) {
-                    qCritical() << "ERR: Unable to find python, thats a problem";
+                    qCritical() << "ERR: Unable to find python3, thats a problem";
                 } else {
                     // qDebug () << "Using python: " << python;
                     retList << python;
@@ -543,7 +539,7 @@ void ReportGenerator::runTrml2Pdf( const QString& rmlFile, const QString& docID,
 {
     mErrors.clear();
     // findTrml2Pdf returns a list of command line parts for the converter, such as
-    // /usr/bin/pyhton /usr/local/share/erml2pdf.py
+    // /usr/bin/pyhton3 /usr/local/share/erml2pdf.py
     QStringList rmlbin = findTrml2Pdf();
 
     if ( ! rmlbin.size() ) {