summaryrefslogtreecommitdiffstats
path: root/conanfile.py
diff options
context:
space:
mode:
authorIikka Eklund <iikka.eklund@qt.io>2021-03-23 09:14:10 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-04-12 18:47:56 +0000
commit7444ad97e385b54f70069b1ec303621948d9eace (patch)
tree743ba600c2d3ff1f01fb1e5e89dde2e8123ebf23 /conanfile.py
parent02dd0d9ac4f687883c1aab4259e36f52d080da93 (diff)
Conan: Use "scm" revision mode when exporting from .git repository
We have two use cases where the conan export is being executed: - Conan export from src tar ball - .git directory is not present - Coin/CI: conan export from git repository The "scm" feature will not work if the ".git" repository does not exist. If this is the case then use the default "hash" mode for the recipe revision. Change-Id: I601c3731aaed9a64087a3efad57a2eea97cfb641 Reviewed-by: Toni Saario <toni.saario@qt.io> (cherry picked from commit 33c325e573cb29aaa67399be761a3e1847c5cc53) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'conanfile.py')
-rw-r--r--conanfile.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/conanfile.py b/conanfile.py
index e7090aa..79329ba 100644
--- a/conanfile.py
+++ b/conanfile.py
@@ -28,6 +28,7 @@
from conans import ConanFile, tools, CMake
import os
+from pathlib import Path
class QtConanError(Exception):
@@ -48,7 +49,8 @@ class QtScxml(ConanFile):
default_options = {"shared": "default", # default: Use the value of the Qt build
"qt6": None}
exports_sources = "*", "!conan*.*"
- revision_mode = "scm" # use commit ID as the RREV (recipe revision)
+ # use commit ID as the RREV (recipe revision) if this is exported from .git repository
+ revision_mode = "scm" if Path(Path(__file__).parent.resolve() / ".git").exists() else "hash"
def source(self):
# sources are installed next to recipe, no need to clone etc. sources here