Skip to content

Commit

Permalink
some fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
MP91 committed Feb 26, 2024
1 parent 49af54e commit 1563451
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ jobs:
- name: Check if conan package is installed
run: |
RECIPE_EXISTS=$(conan search vehicle-app-sdk | grep "Existing package recipes:")
RECIPE_EXISTS=$(conan list vehicle-app-sdk | grep "ERROR")
if [ "$RECIPE_EXISTS" == "" ]; then
if [ "$RECIPE_EXISTS" != "" ]; then
exit -1
fi
Expand Down
13 changes: 6 additions & 7 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# SPDX-License-Identifier: Apache-2.0

from conan import ConanFile
from conan.tools.scm import Git
from conan.tools.cmake import cmake_layout
from conan.tools.files import copy
import subprocess
Expand Down Expand Up @@ -58,20 +57,20 @@ class VehicleAppCppSdkConan(ConanFile):

def set_version(self):
try:
git = Git(self)
tag = git.run("tag --points-at HEAD")
tag = subprocess.run(["git", "tag", "--points-at", "HEAD"],capture_output=True).stdout.strip().decode("utf-8")
version=""
if tag is not "":
if tag:
version_tag_pattern = re.compile(r"^v[0-9]+(\.[0-9]+){0,2}")
if version_tag_pattern.match(tag):
tag = tag[1:] # cut off initial v if a semver tag
version = tag

# if no tag, use branch name or commit hash
if version is "":
version = git.run("symbolic-ref -q --short HEAD || git rev-parse --short HEAD")
if not version:
version = subprocess.run(["git", "symbolic-ref", "-q", "--short", "HEAD"],capture_output=True).stdout.strip().decode("utf-8")
if not version:
subprocess.run(["git", "rev-parse", "--short", "HEAD"],capture_output=True).stdout.strip().decode("utf-8")

print("Version: " + version)
version = version.replace("/", ".")
open("./version.txt", mode="w", encoding="utf-8").write(version)
self.version = version
Expand Down

0 comments on commit 1563451

Please sign in to comment.