Changed way to deal with extensions arguments (-e) so that path and filename are stored independently and accessible for extensions themselves.
authorEdouard Tisserant
Wed, 24 Jan 2018 14:48:49 +0100
changeset 1905 87c908079bc6
parent 1903 084256be3658
child 1906 60edd0c901f1
Changed way to deal with extensions arguments (-e) so that path and filename are stored independently and accessible for extensions themselves.
Beremiz_service.py
--- a/Beremiz_service.py	Fri Jan 19 15:12:23 2018 +0100
+++ b/Beremiz_service.py	Wed Jan 24 14:48:49 2018 +0100
@@ -110,7 +110,9 @@
     elif o == "-s":
         wampsecret = None if a == "off" else a
     elif o == "-e":
-        extensions.append(a)
+        l = os.path.split(os.path.realpath(a))
+        l.reverse()
+        extensions.append(l)
     else:
         usage()
         sys.exit()
@@ -588,10 +590,9 @@
             wampconf = None
 
 # Load extensions
-for extfilename in extensions:
-    extension_folder = os.path.split(os.path.realpath(extfilename))[0]
+for extention_file, extension_folder in extensions:
     sys.path.append(extension_folder)
-    execfile(extfilename, locals())
+    execfile(os.path.join(extension_folder, extention_file), locals())
 
 if havetwisted:
     if webport is not None: