Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bin: remove unused imports from readprops.py #3907

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 20 additions & 15 deletions bin/readprops.py
Original file line number Diff line number Diff line change
@@ -1,37 +1,42 @@


import subprocess
import configparser
import traceback
import sys
import subprocess


def readProps(prefsLoc):
"""Read the version of our project as a string"""

config = configparser.RawConfigParser()
config.read(prefsLoc)
version = dict(config.items('VERSION'))
verObj = dict(short = "{}.{}.{}".format(version["major"], version["minor"], version["build"]),
long = "unset")
version = dict(config.items("VERSION"))
verObj = dict(
short="{}.{}.{}".format(version["major"], version["minor"], version["build"]),
long="unset",
)

# Try to find current build SHA if if the workspace is clean. This could fail if git is not installed
try:
sha = subprocess.check_output(
['git', 'rev-parse', '--short', 'HEAD']).decode("utf-8").strip()
isDirty = subprocess.check_output(
['git', 'diff', 'HEAD']).decode("utf-8").strip()
sha = (
subprocess.check_output(["git", "rev-parse", "--short", "HEAD"])
.decode("utf-8")
.strip()
)
isDirty = (
subprocess.check_output(["git", "diff", "HEAD"]).decode("utf-8").strip()
)
suffix = sha
# if isDirty:
# # short for 'dirty', we want to keep our verstrings source for protobuf reasons
# suffix = sha + "-d"
verObj['long'] = "{}.{}.{}.{}".format(
version["major"], version["minor"], version["build"], suffix)
verObj["long"] = "{}.{}.{}.{}".format(
version["major"], version["minor"], version["build"], suffix
)
except:
# print("Unexpected error:", sys.exc_info()[0])
# traceback.print_exc()
verObj['long'] = verObj['short']
verObj["long"] = verObj["short"]

# print("firmware version " + verStr)
return verObj


# print("path is" + ','.join(sys.path))
Loading