summaryrefslogtreecommitdiff
path: root/conanfile.py
diff options
context:
space:
mode:
authorIikka Eklund <iikka.eklund@qt.io>2021-03-23 08:58:01 +0200
committerIikka Eklund <iikka.eklund@qt.io>2021-04-13 08:05:52 +0200
commit8af546ecf90d00895543882ead2d4133cab1f57f (patch)
treed773ad58a7afa3865b0cf7ae2b7e47326ec4d770 /conanfile.py
parentb01f23ed9b32a84c5ffd6f45f08c4b81705b1979 (diff)
downloadqtimageformats-8af546ecf90d00895543882ead2d4133cab1f57f.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: Ic7b74cc1f1d2f47852e6fba96dbcfe80f90e57d0 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 fd704ff..005ad7f 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 QtImageFormats(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