Skip to content

Commit

Permalink
Merge pull request #5 from scipopt/restore-conanfile-version-git
Browse files Browse the repository at this point in the history
Restore that the version is extracted from Git
  • Loading branch information
hedtke authored Aug 9, 2023
2 parents 485a17f + 95743dc commit 01f0fed
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions conanfile.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from conan import ConanFile
from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout
from conan.tools.scm import Git


class ScipPlusPlus(ConanFile):
Expand All @@ -13,10 +14,15 @@ class ScipPlusPlus(ConanFile):
default_options = {
"with_tests": False,
}
_full_version: str = "1.0.0"
_full_version: str = None

def set_version(self):
self.version = self._full_version
git = Git(self, folder=self.recipe_folder)
try:
self._full_version = git.run("describe --tags --dirty=-d").strip()
self.version = self._full_version.split('-')[0]
except:
self.version = "1.0.0"

def layout(self):
cmake_layout(self)
Expand Down

0 comments on commit 01f0fed

Please sign in to comment.