summaryrefslogtreecommitdiff
path: root/conan/build.py
diff options
context:
space:
mode:
authorUilian Ries <uilianries@gmail.com>2018-11-12 14:49:42 -0200
committerWouter van Oortmerssen <aardappel@gmail.com>2018-11-12 08:49:42 -0800
commitdd8922878df9351544eda4e50b359c201f475482 (patch)
tree656814e028d84a5410ef524f5a3976b1f368fa8f /conan/build.py
parentab54e61805321eaea8f0e886531c4f5aa79773c7 (diff)
downloadflatbuffers-dd8922878df9351544eda4e50b359c201f475482.tar.gz
flatbuffers-dd8922878df9351544eda4e50b359c201f475482.tar.bz2
flatbuffers-dd8922878df9351544eda4e50b359c201f475482.zip
Update Conan version Automatically (#5027)
* #5026 Add FindFlatBuffers.cmake to Conan Package Signed-off-by: Uilian Ries <uilianries@gmail.com> * #5026 Build Flatbuffers on OSX 10 Signed-off-by: Uilian Ries <uilianries@gmail.com> * #5026 Auto update Conan package version Signed-off-by: Uilian Ries <uilianries@gmail.com> * #5026 Update Conan docker images Signed-off-by: Uilian Ries <uilianries@gmail.com> * #5026 Update tag var on Appveyor Signed-off-by: Uilian Ries <uilianries@gmail.com> * #5026 Filter appveyor brach name Signed-off-by: Uilian Ries <uilianries@gmail.com>
Diffstat (limited to 'conan/build.py')
-rw-r--r--conan/build.py41
1 files changed, 39 insertions, 2 deletions
diff --git a/conan/build.py b/conan/build.py
index 6c63de8b..55456311 100644
--- a/conan/build.py
+++ b/conan/build.py
@@ -1,7 +1,10 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
-from cpt.packager import ConanMultiPackager
import os
+import re
+import subprocess
+from cpt.packager import ConanMultiPackager
+
def set_appveyor_environment():
if os.getenv("APPVEYOR") is not None:
@@ -13,6 +16,39 @@ def set_appveyor_environment():
os.environ["CONAN_ARCHS"] = ci_platform
os.environ["CONAN_BUILD_TYPES"] = os.getenv("Configuration").replace('"', '')
+
+def get_branch():
+ try:
+ for line in subprocess.check_output("git branch", shell=True).decode().splitlines():
+ line = line.strip()
+ if line.startswith("*") and " (HEAD detached" not in line:
+ return line.replace("*", "", 1).strip()
+ return ""
+ except Exception:
+ pass
+ return ""
+
+
+def get_version():
+ version = get_branch()
+ if os.getenv("TRAVIS", False):
+ version = os.getenv("TRAVIS_BRANCH")
+
+ if os.getenv("APPVEYOR", False):
+ version = os.getenv("APPVEYOR_REPO_BRANCH")
+ if os.getenv("APPVEYOR_REPO_TAG") == "true":
+ version = os.getenv("APPVEYOR_REPO_TAG_NAME")
+
+ match = re.search(r"v(\d+\.\d+\.\d+.*)", version)
+ if match:
+ return match.group(1)
+ return version
+
+
+def get_reference(username):
+ return "flatbuffers/{}@google/stable".format(get_version())
+
+
if __name__ == "__main__":
login_username = os.getenv("CONAN_LOGIN_USERNAME", "aardappel")
username = os.getenv("CONAN_USERNAME", "google")
@@ -22,7 +58,8 @@ if __name__ == "__main__":
upload_only_when_stable = os.getenv("CONAN_UPLOAD_ONLY_WHEN_STABLE", True)
set_appveyor_environment()
- builder = ConanMultiPackager(username=username,
+ builder = ConanMultiPackager(reference=get_reference(username),
+ username=username,
login_username=login_username,
upload=upload,
stable_branch_pattern=stable_branch_pattern,