mirror of https://github.com/Desuuuu/klipper.git
klippy: Log the host software git version at startup
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
f3a49604f1
commit
451ffd567d
|
@ -250,6 +250,8 @@ def main():
|
|||
else:
|
||||
logging.basicConfig(level=debuglevel)
|
||||
logging.info("Starting Klippy...")
|
||||
if debugoutput is None:
|
||||
util.report_git_version()
|
||||
|
||||
# Start firmware
|
||||
while 1:
|
||||
|
|
|
@ -3,8 +3,7 @@
|
|||
# Copyright (C) 2016 Kevin O'Connor <kevin@koconnor.net>
|
||||
#
|
||||
# This file may be distributed under the terms of the GNU GPLv3 license.
|
||||
|
||||
import os, pty, fcntl, termios, signal
|
||||
import os, pty, fcntl, termios, signal, logging, subprocess, traceback, shlex
|
||||
|
||||
# Return the SIGINT interrupt handler back to the OS default
|
||||
def fix_sigint():
|
||||
|
@ -36,3 +35,19 @@ def create_pty(ptyname):
|
|||
old[3] = old[3] & ~termios.ECHO
|
||||
termios.tcsetattr(mfd, termios.TCSADRAIN, old)
|
||||
return mfd
|
||||
|
||||
def report_git_version():
|
||||
# Obtain version info from "git" program
|
||||
if not os.path.exists('.git'):
|
||||
logging.debug("No '.git' file/directory found")
|
||||
return
|
||||
prog = "git describe --tags --long --dirty"
|
||||
try:
|
||||
process = subprocess.Popen(shlex.split(prog), stdout=subprocess.PIPE)
|
||||
output = process.communicate()[0]
|
||||
retcode = process.poll()
|
||||
except OSError:
|
||||
logging.debug("Exception on run: %s" % (traceback.format_exc(),))
|
||||
return
|
||||
ver = output.strip()
|
||||
logging.info("Git version: %s" % (repr(ver),))
|
||||
|
|
Loading…
Reference in New Issue