2018-08-16 19:17:52 +00:00
|
|
|
#!/usr/bin/env python
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
import os
|
2018-11-12 16:49:42 +00:00
|
|
|
import re
|
|
|
|
import subprocess
|
|
|
|
from cpt.packager import ConanMultiPackager
|
|
|
|
|
2018-08-16 19:17:52 +00:00
|
|
|
|
2018-11-12 16:49:42 +00:00
|
|
|
|
|
|
|
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()
|
|
|
|
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())
|
|
|
|
|
|
|
|
|
2018-08-16 19:17:52 +00:00
|
|
|
if __name__ == "__main__":
|
|
|
|
login_username = os.getenv("CONAN_LOGIN_USERNAME", "aardappel")
|
|
|
|
username = os.getenv("CONAN_USERNAME", "google")
|
|
|
|
upload = os.getenv("CONAN_UPLOAD", "https://api.bintray.com/conan/aardappel/flatbuffers")
|
|
|
|
stable_branch_pattern = os.getenv("CONAN_STABLE_BRANCH_PATTERN", r"v\d+\.\d+\.\d+.*")
|
|
|
|
test_folder = os.getenv("CPT_TEST_FOLDER", os.path.join("conan", "test_package"))
|
|
|
|
upload_only_when_stable = os.getenv("CONAN_UPLOAD_ONLY_WHEN_STABLE", True)
|
|
|
|
|
2018-11-12 16:49:42 +00:00
|
|
|
builder = ConanMultiPackager(reference=get_reference(username),
|
|
|
|
username=username,
|
2018-08-16 19:17:52 +00:00
|
|
|
login_username=login_username,
|
|
|
|
upload=upload,
|
|
|
|
stable_branch_pattern=stable_branch_pattern,
|
|
|
|
upload_only_when_stable=upload_only_when_stable,
|
|
|
|
test_folder=test_folder)
|
|
|
|
builder.add_common_builds(pure_c=False)
|
|
|
|
builder.run()
|