gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-taler-build-scripts] branch master updated: Add PythonTool(). Con


From: gnunet
Subject: [taler-taler-build-scripts] branch master updated: Add PythonTool(). Contrary the code in sh/, it is limited to python3.7 - python4.0 right now.
Date: Mon, 28 Oct 2019 14:32:45 +0100

This is an automated email from the git hooks/post-receive script.

ng0 pushed a commit to branch master
in repository taler-build-scripts.

The following commit(s) were added to refs/heads/master by this push:
     new 591ce25  Add PythonTool(). Contrary the code in sh/, it is limited to 
python3.7 - python4.0 right now.
591ce25 is described below

commit 591ce257f8c8f08d9609471e860349322d10c4a7
Author: ng0 <address@hidden>
AuthorDate: Mon Oct 28 13:32:12 2019 +0000

    Add PythonTool(). Contrary the code in sh/, it is limited to
    python3.7 - python4.0 right now.
---
 talerbuildconfig.py | 36 ++++++++++++++++++++++++++++++++++++
 testconfigure.py    |  1 +
 2 files changed, 37 insertions(+)

diff --git a/talerbuildconfig.py b/talerbuildconfig.py
index 647a0a1..f0e6d92 100644
--- a/talerbuildconfig.py
+++ b/talerbuildconfig.py
@@ -213,6 +213,42 @@ class PyBabelTool(Tool):
                     return True
 
 
+class PythonTool(Tool):
+    # This exists in addition to the files in sh, so that
+    # the Makefiles can use this value instead.
+    name = "python"
+
+    def args(self, parser):
+        parser.add_argument(
+            "--with-python", type=str, help="name of the python executable"
+        )
+
+    def check(self, buildconfig):
+        # No suffix. Would probably be cheaper to do this in
+        # the dict as well.
+        if existence("python"):
+            buildconfig._set_tool("python", "python")
+            return True
+        else:
+            # Has suffix, try suffix. We know the names in advance,
+            # so use a dictionary and iterate over it. Use enough names
+            # to safe updating this for another couple of years.
+            #
+            # Food for thought: If we only accept python 3.7 or higher,
+            # is checking pybabel + pybabel-3.[0-9]* too much and could
+            # be broken down to pybabel + pybabel-3.7 and later names?
+            version_dict = {
+                "3.7": "python3.7",
+                "3.8": "python3.8",
+                "3.9": "python3.9",
+                "4.0": "python4.0",
+            }
+            for value in version_dict.values():
+                if existence(value):
+                    buildconfig._set_tool("python", value)
+                    return True
+
+
 class BrowserTool(Tool):
     name = "browser"
 
diff --git a/testconfigure.py b/testconfigure.py
index af7e85a..29d82a1 100644
--- a/testconfigure.py
+++ b/testconfigure.py
@@ -7,6 +7,7 @@ b.add_tool(YarnTool())
 b.add_tool(BrowserTool())
 b.add_tool(PyBabelTool())
 b.add_tool(NodeJsTool())
+b.add_tool(PythonTool())
 b.add_tool(PosixTool("find"))
 b.add_tool(PosixTool("xargs"))
 b.add_tool(PosixTool("msgmerge"))

-- 
To stop receiving notification emails like this one, please contact
address@hidden.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]