diff configmix/variables.py @ 243:57ff12610dc5

Implemented OS:node to return the host's computername
author Franz Glasner <fzglas.hg@dom66.de>
date Thu, 21 May 2020 08:32:37 +0200
parents bfa4d125fd14
children ff964825a75a
line wrap: on
line diff
--- a/configmix/variables.py	Thu May 21 08:19:03 2020 +0200
+++ b/configmix/variables.py	Thu May 21 08:32:37 2020 +0200
@@ -10,6 +10,7 @@
 from __future__ import division, absolute_import, print_function
 
 import os
+import platform
 from functools import wraps
 
 from .compat import PY2, native_os_str_to_text, u
@@ -36,6 +37,8 @@
     """Lookup some process and/or OS state """
     if name == "cwd":
         return native_os_str_to_text(os.getcwd())
+    elif name == "node":
+        return native_os_str_to_text(platform.node())
     else:
         if default is _MARKER:
             raise KeyError("key %r not found in the namespace" % name)
@@ -45,7 +48,6 @@
 
 def _pylookup(name, default=_MARKER):
     """Lookup Python specific information"""
-    import platform
     if name == "version":
         return u(platform.python_version())
     elif name == "implementation":