feat: get version arg

This commit is contained in:
Florian Bezannier
2022-04-19 21:46:49 +02:00
parent ef72196bf3
commit 9833a0ede4
5 changed files with 25 additions and 1 deletions
+1
View File
@@ -41,4 +41,5 @@ jobs:
echo Test
source .venv/bin/activate
coverage run -m unittest || exit 1
coverage report
[ -n "$CODACY_PROJECT_TOKEN" ] && coverage combine && coverage xml -o cobertura.xml && bash <(curl -Ls https://coverage.codacy.com/get.sh) report -r cobertura.xml
Generated
+16 -1
View File
@@ -1103,6 +1103,17 @@ category = "main"
optional = false
python-versions = "*"
[[package]]
name = "single-source"
version = "0.3.0"
description = "Access to the project version in Python code for PEP 621-style projects"
category = "main"
optional = false
python-versions = ">=3.6,<4.0"
[package.dependencies]
importlib_metadata = {version = ">=3.0,<5", markers = "python_version < \"3.8\""}
[[package]]
name = "six"
version = "1.16.0"
@@ -1247,7 +1258,7 @@ testing = ["pytest (>=6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytest-
[metadata]
lock-version = "1.1"
python-versions = ">=3.7.0, <4.0.0"
content-hash = "3e21b3d9a8d196a0e896b4dec41624bf71cc8967fbd42f094afe871639d3f748"
content-hash = "237337e04594d877cea819e9ff6b56d18fa1c4583396f1ec3eca53d98378add7"
[metadata.files]
androguard = [
@@ -2196,6 +2207,10 @@ setuptools-scm = [
simplegeneric = [
{file = "simplegeneric-0.8.1.zip", hash = "sha256:dc972e06094b9af5b855b3df4a646395e43d1c9d0d39ed345b7393560d0b9173"},
]
single-source = [
{file = "single-source-0.3.0.tar.gz", hash = "sha256:b12705af958ca99d56ea9ce40bd9cc749378f4fe7ad03b1f9067e29daceef27d"},
{file = "single_source-0.3.0-py3-none-any.whl", hash = "sha256:7bc87168ced50f638b6ab0cda4cc1ce9e80ee0e1220014397050d336d021a597"},
]
six = [
{file = "six-1.16.0-py2.py3-none-any.whl", hash = "sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254"},
{file = "six-1.16.0.tar.gz", hash = "sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926"},
+4
View File
@@ -0,0 +1,4 @@
from pathlib import Path
from single_source import get_version
__version__ = get_version(__name__, Path(__file__), default_return="dev")
@@ -4,6 +4,7 @@ import logging
import threading
from os import environ, path
import psa_car_controller
from oauth2_client.credentials_manager import OAuthError
from .charge_control import ChargeControls
@@ -36,6 +37,8 @@ def parse_args():
parser.add_argument("--offline", help="offline limited mode", action='store_true')
parser.add_argument("--web-conf", help="ignore if config files not existing yet", action='store_true')
parser.add_argument("-b", "--base-path", help="base path for web app", default="/")
parser.add_argument('--version', action='version', version='PSACC {}'.format(psa_car_controller.__version__))
return parser.parse_args()
+1
View File
@@ -36,6 +36,7 @@ certifi = ">=14.05.14"
six = ">=1.10"
python-dateutil = ">=2.5.3"
urllib3 = ">=1.15.1"
single-source = "^0.3.0"
[tool.poetry.dev-dependencies]
prospector = ">=1.3.0"