summaryrefslogtreecommitdiff
path: root/conanfile.py
diff options
context:
space:
mode:
authorIikka Eklund <iikka.eklund@qt.io>2021-03-23 09:06:55 +0200
committerIikka Eklund <iikka.eklund@qt.io>2021-04-13 08:05:38 +0200
commit0d12b5359800727dde28ddcd92892fdc5c2a736a (patch)
tree84a44791d18cc06326c4bf4560017f5e4ce246aa /conanfile.py
parent4d528a06c21811b9ac6dbb8ecde23c2537c4c567 (diff)
downloadqtactiveqt-0d12b5359800727dde28ddcd92892fdc5c2a736a.tar.gz
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. Pick-to: 6.1 Change-Id: I61bd68b60e616ba5107643996b345cdf37b63522 Reviewed-by: Toni Saario <toni.saario@qt.io>
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 b7a47e9..5aacf4f 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 QtActiveQtFormats(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