summaryrefslogtreecommitdiff
path: root/talerbuildconfig.py
diff options
context:
space:
mode:
authorng0 <ng0@n0.is>2019-12-16 12:51:10 +0000
committerng0 <ng0@n0.is>2019-12-16 12:51:10 +0000
commit248914b63660e506645c8059eacf27d41145c88f (patch)
tree3b42e444c56183ffc7398d16909f03b8b65fcd37 /talerbuildconfig.py
parentdf3d04affac9ec8cddea62a140cf6f3216094d6f (diff)
downloadbuild-common-248914b63660e506645c8059eacf27d41145c88f.tar.gz
build-common-248914b63660e506645c8059eacf27d41145c88f.tar.bz2
build-common-248914b63660e506645c8059eacf27d41145c88f.zip
Add yapf to detection. Next we should probably abstract the tools
more to avoid this boilerplating.
Diffstat (limited to 'talerbuildconfig.py')
-rw-r--r--talerbuildconfig.py43
1 files changed, 43 insertions, 0 deletions
diff --git a/talerbuildconfig.py b/talerbuildconfig.py
index 7e91de4..28a20f8 100644
--- a/talerbuildconfig.py
+++ b/talerbuildconfig.py
@@ -231,6 +231,49 @@ class PyToxTool(Tool):
return True
+class YapfTool(Tool):
+ name ="yapf"
+
+ def args(self, parser):
+ parser.add_argument(
+ "--with-yapf", type=str, help="name of the yapf executable"
+ )
+
+ def check(self, buildconfig):
+ # No suffix. Would probably be cheaper to do this in
+ # the dict as well. We also need to check the python
+ # version it was build against (TODO).
+ if existence("yapf"):
+ import yapf
+ myyapf_version = yapf.__version__
+ buildconfig._set_tool("yapf", "yapf", myyapf_version)
+ 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.
+ version_dict = {
+ "3.0": "yapf3.0",
+ "3.1": "yapf3.1",
+ "3.2": "yapf3.2",
+ "3.3": "yapf3.3",
+ "3.4": "yapf3.4",
+ "3.5": "yapf3.5",
+ "3.6": "yapf3.6",
+ "3.7": "yapf3.7",
+ "3.8": "yapf3.8",
+ "3.9": "yapf3.9",
+ "4.0": "yapf4.0",
+ }
+ for key, value in version_dict.items():
+ if existence(value):
+ # FIXME: This version reporting is slightly off
+ # FIXME: and only maps to the suffix.
+ mypytox_version = key
+ buildconfig._set_tool("yapf", value, mypytox_version)
+ return True
+
+
class PyBabelTool(Tool):
name = "pybabel"