mirror of
https://github.com/uhi22/pyPLC.git
synced 2024-11-10 01:05:42 +00:00
added software version from git in log
This commit is contained in:
parent
f885f3c4ce
commit
11357e94dc
1 changed files with 11 additions and 1 deletions
|
@ -1,6 +1,8 @@
|
||||||
# Worker for the pyPLC
|
# Worker for the pyPLC
|
||||||
#
|
#
|
||||||
# Tested on Windows10 with python 3.9
|
# Tested on
|
||||||
|
# - Windows10 with python 3.9 and
|
||||||
|
# - Raspbian with python 3.9
|
||||||
#
|
#
|
||||||
|
|
||||||
#------------------------------------------------------------
|
#------------------------------------------------------------
|
||||||
|
@ -10,6 +12,7 @@ import fsmPev
|
||||||
from pyPlcModes import *
|
from pyPlcModes import *
|
||||||
import addressManager
|
import addressManager
|
||||||
import time
|
import time
|
||||||
|
import subprocess
|
||||||
|
|
||||||
|
|
||||||
class pyPlcWorker():
|
class pyPlcWorker():
|
||||||
|
@ -26,6 +29,13 @@ class pyPlcWorker():
|
||||||
self.isSimulationMode = isSimulationMode
|
self.isSimulationMode = isSimulationMode
|
||||||
self.hp = pyPlcHomeplug.pyPlcHomeplug(self.workerAddToTrace, self.callbackShowStatus, self.mode, self.addressManager, self.callbackReadyForTcp, self.isSimulationMode)
|
self.hp = pyPlcHomeplug.pyPlcHomeplug(self.workerAddToTrace, self.callbackShowStatus, self.mode, self.addressManager, self.callbackReadyForTcp, self.isSimulationMode)
|
||||||
self.hp.printToUdp("pyPlcWorker init")
|
self.hp.printToUdp("pyPlcWorker init")
|
||||||
|
# Find out the version number, using git.
|
||||||
|
# see https://stackoverflow.com/questions/14989858/get-the-current-git-hash-in-a-python-script
|
||||||
|
try:
|
||||||
|
strLabel = str(subprocess.check_output(["git", "describe", "--tags"], text=True).strip())
|
||||||
|
except:
|
||||||
|
strLabel = "(unknown version. 'git describe --tags' failed.)"
|
||||||
|
self.workerAddToTrace("[pyPlcWorker] Software version " + strLabel)
|
||||||
if (self.mode == C_EVSE_MODE):
|
if (self.mode == C_EVSE_MODE):
|
||||||
self.evse = fsmEvse.fsmEvse(self.workerAddToTrace)
|
self.evse = fsmEvse.fsmEvse(self.workerAddToTrace)
|
||||||
if (self.mode == C_PEV_MODE):
|
if (self.mode == C_PEV_MODE):
|
||||||
|
|
Loading…
Reference in a new issue