init
Some checks failed
Docker. / Ubuntu (push) Has been cancelled
User-agent updater. / User-agent (push) Failing after 15s
Lock Threads / lock (push) Failing after 10s
Waiting for answer. / waiting-for-answer (push) Failing after 22s
Needs user action. / needs-user-action (push) Failing after 8s
Can't reproduce. / cant-reproduce (push) Failing after 8s
Close stale issues and PRs / stale (push) Has been cancelled
Some checks failed
Docker. / Ubuntu (push) Has been cancelled
User-agent updater. / User-agent (push) Failing after 15s
Lock Threads / lock (push) Failing after 10s
Waiting for answer. / waiting-for-answer (push) Failing after 22s
Needs user action. / needs-user-action (push) Failing after 8s
Can't reproduce. / cant-reproduce (push) Failing after 8s
Close stale issues and PRs / stale (push) Has been cancelled
This commit is contained in:
114
cmake/external/glib/cppgir/expected-lite/script/upload-conan.py
vendored
Normal file
114
cmake/external/glib/cppgir/expected-lite/script/upload-conan.py
vendored
Normal file
@@ -0,0 +1,114 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# Copyright 2019-2019 by Martin Moene
|
||||
#
|
||||
# Distributed under the Boost Software License, Version 1.0.
|
||||
# (See accompanying file LICENSE.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
#
|
||||
# script/upload-conan.py
|
||||
#
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
import subprocess
|
||||
|
||||
# Configuration:
|
||||
|
||||
def_conan_project = 'expected-lite'
|
||||
def_conan_user = 'nonstd-lite'
|
||||
def_conan_channel = 'stable'
|
||||
cfg_conanfile = 'conanfile.py'
|
||||
|
||||
tpl_conan_create = 'conan create . {usr}/{chn}'
|
||||
tpl_conan_upload = 'conan upload --remote {usr} {prj}/{ver}@{usr}/{chn}'
|
||||
|
||||
# End configuration.
|
||||
|
||||
def versionFrom( filename ):
|
||||
"""Obtain version from conanfile.py"""
|
||||
with open( filename ) as f:
|
||||
content = f.read()
|
||||
version = re.search(r'version\s=\s"(.*)"', content).group(1)
|
||||
return version
|
||||
|
||||
def createConanPackage( args ):
|
||||
"""Create conan package and upload it."""
|
||||
cmd = tpl_conan_create.format(usr=args.user, chn=args.channel)
|
||||
if args.verbose:
|
||||
print( "> {}".format(cmd) )
|
||||
if not args.dry_run:
|
||||
subprocess.call( cmd, shell=False )
|
||||
|
||||
def uploadConanPackage( args ):
|
||||
"""Create conan package and upload it."""
|
||||
cmd = tpl_conan_upload.format(prj=args.project, usr=args.user, chn=args.channel, ver=args.version)
|
||||
if args.verbose:
|
||||
print( "> {}".format(cmd) )
|
||||
if not args.dry_run:
|
||||
subprocess.call( cmd, shell=False )
|
||||
|
||||
def uploadToConan( args ):
|
||||
"""Create conan package and upload it."""
|
||||
print( "Updating project '{prj}' to user '{usr}', channel '{chn}', version {ver}:".
|
||||
format(prj=args.project, usr=args.user, chn=args.channel, ver=args.version) )
|
||||
createConanPackage( args )
|
||||
uploadConanPackage( args )
|
||||
|
||||
def uploadToConanFromCommandLine():
|
||||
"""Collect arguments from the commandline and create conan package and upload it."""
|
||||
|
||||
parser = argparse.ArgumentParser(
|
||||
description='Create conan package and upload it to conan.',
|
||||
epilog="""""",
|
||||
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
|
||||
|
||||
parser.add_argument(
|
||||
'-n', '--dry-run',
|
||||
action='store_true',
|
||||
help='do not execute conan commands')
|
||||
|
||||
parser.add_argument(
|
||||
'-v', '--verbose',
|
||||
action='count',
|
||||
default=0,
|
||||
help='level of progress reporting')
|
||||
|
||||
parser.add_argument(
|
||||
'--project',
|
||||
metavar='p',
|
||||
type=str,
|
||||
default=def_conan_project,
|
||||
help='conan project')
|
||||
|
||||
parser.add_argument(
|
||||
'--user',
|
||||
metavar='u',
|
||||
type=str,
|
||||
default=def_conan_user,
|
||||
help='conan user')
|
||||
|
||||
parser.add_argument(
|
||||
'--channel',
|
||||
metavar='c',
|
||||
type=str,
|
||||
default=def_conan_channel,
|
||||
help='conan channel')
|
||||
|
||||
parser.add_argument(
|
||||
'--version',
|
||||
metavar='v',
|
||||
type=str,
|
||||
default=versionFrom( cfg_conanfile ),
|
||||
help='version number [from conanfile.py]')
|
||||
|
||||
uploadToConan( parser.parse_args() )
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
uploadToConanFromCommandLine()
|
||||
|
||||
# end of file
|
||||
Reference in New Issue
Block a user