diff --git a/.conan/build.py b/.conan/build.py index 4dc07fd..d714403 100644 --- a/.conan/build.py +++ b/.conan/build.py @@ -4,6 +4,8 @@ import os import re from cpt.packager import ConanMultiPackager +from cpt.ci_manager import CIManager +from cpt.printer import Printer class BuilderSettings(object): @@ -15,10 +17,26 @@ def username(self): @property def upload(self): - """ Set taocpp repository to be used on upload + """ Set taocpp repository to be used on upload. + The upload server address could be customized by env var + CONAN_UPLOAD. If not defined, the method will check the branch name. + Only master or CONAN_STABLE_BRANCH_PATTERN will be accepted. + The master branch will be pushed to testing channel, because it does + not match the stable pattern. Otherwise it will upload to stable + channel. """ - bintray_url = "https://api.bintray.com/conan/taocpp/public-conan" - return os.getenv("CONAN_UPLOAD", bintray_url) + if os.getenv("CONAN_UPLOAD", None) is not None: + return os.getenv("CONAN_UPLOAD") + + printer = Printer(None) + ci_manager = CIManager(printer) + branch = ci_manager.get_branch() + + patterns = [r"v?\d+\.\d+\.\d+-.*", self.stable_branch_pattern] + for pattern in patterns: + prog = re.compile(pattern) + if branch and prog.match(branch): + return "https://api.bintray.com/conan/taocpp/public-conan" @property def upload_only_when_stable(self): diff --git a/conanfile.py b/conanfile.py index ed18476..d8ff7cd 100644 --- a/conanfile.py +++ b/conanfile.py @@ -9,7 +9,6 @@ class OperatorsConan(ConanFile): url = homepage license = "MIT" author = "taocpp@icemx.net" - settings = "compiler", "arch" exports = "LICENSE" exports_sources = "include/*", "CMakeLists.txt" no_copy_source = True