Skip to content

Commit

Permalink
Merge pull request #13 from scipopt/simplify-version-in-conanfile
Browse files Browse the repository at this point in the history
Simplify set_version in conanfile
  • Loading branch information
hedtke authored Oct 13, 2023
2 parents 0b57e89 + a7ad548 commit 08ea089
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .idea/.name

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 3 additions & 7 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ class ScipPlusPlus(ConanFile):
"shared": False,
"fPIC": True
}
_full_version: str = None

@property
def _min_cppstd(self):
Expand Down Expand Up @@ -64,12 +63,9 @@ def set_version(self):
if self.version is None:
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]
self.version = git.run("describe --tags --dirty=-d").strip()
except:
self.version = "1.0.2"
else:
self._full_version = self.version
self.version = "1.x.y"

def layout(self):
cmake_layout(self)
Expand All @@ -81,7 +77,7 @@ def requirements(self):

def generate(self):
tc = CMakeToolchain(self)
tc.variables[self.name + "_version"] = self._full_version
tc.variables[self.name + "_version"] = self.version
tc.variables["BUILD_TESTS"] = self.options.with_tests
tc.generate()

Expand Down

0 comments on commit 08ea089

Please sign in to comment.