-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
What is your question?
Having upgraded a project from Conan1 to Conan2, it appears that I can no longer use GIT within the set_version method of the conanfile.
My set_version method instantiates GIT and calls it. This pattern is copied from the Conan2 documentation for set_version.
def set_version(self):
git = Git(self, self.recipe_folder)
self.version = git.run("describe --tags")
PROBLEM: When executing 'conan create', the recipe is firstly exported to the user's cache prior to the command being actioned. This is stated in the Conan2 documentation for 'conan create' and appears to be a change from Conan1. When this occurs, the recipe folder is no longer within the folder structure of the GIT repository and the GIT command fails with:
ERROR: conanfile.py: Error in set_version() method, line 46
self.version = git.run("describe --tags")
ConanException: Command 'git describe --tags' failed with errorcode '128'
b'fatal: not a git repository (or any of the parent directories): .git\n'
Question: How do I use GIT within the conanfile.py set_version method so that it works during 'conan create' when the recipe has been exported to the local cache?
Have you read the CONTRIBUTING guide?
- I've read the CONTRIBUTING guide