summaryrefslogtreecommitdiffstats
path: root/conanfile.py
diff options
context:
space:
mode:
authorIikka Eklund <iikka.eklund@qt.io>2021-03-23 09:02:47 +0200
committerIikka Eklund <iikka.eklund@qt.io>2021-04-13 08:05:44 +0200
commit04a3129c52b64d4c53b7a13cc525a38153e3eca1 (patch)
tree01d4af66237ab900d50a198c720aa3080bccbca2 /conanfile.py
parent1dad32e9428cdf42a1d0c6b7fd0d22b641602568 (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. Pick-to: 6.1 Change-Id: If84835613855afc00c79eab4a382dc256d87cd08 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 db6009f7a..e205429ce 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 Qt3D(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