From 1619f0722c78854a796274a5dac20e3792554eac Mon Sep 17 00:00:00 2001 From: Mykhailo Dalchenko Date: Mon, 4 Sep 2017 14:26:33 +0200 Subject: [PATCH] Adding get_binaries.py and ipbus to the list of uploads --- .github/get_binaries.py | 42 +++++++++++++++++++++++++++++++++++++++++ .github/uploads.cfg | 3 ++- 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 .github/get_binaries.py diff --git a/.github/get_binaries.py b/.github/get_binaries.py new file mode 100644 index 0000000..f8aa177 --- /dev/null +++ b/.github/get_binaries.py @@ -0,0 +1,42 @@ +import os +from urllib2 import urlopen, URLError, HTTPError +from ast import literal_eval +from optparse import OptionParser + +parser = OptionParser() +parser.add_option("-t", "--tag", dest="tag", + help="Tag name", metavar="tag") +parser.add_option("-l", "--uploads", dest="uploads", + help="List of files to upload\n Should be a dict:\n {\"filename\":\"path_to_file\"}", metavar="uploads") + +def dlfile(url, local_path): + # Open the url + try: + f = urlopen(url) + print "downloading " + url + + # Open our local file for writing + with open(local_path, "wb") as local_file: + local_file.write(f.read()) + + #handle errors + except HTTPError, e: + print "HTTP Error:", e.code, url + except URLError, e: + print "URL Error:", e.reason, url + + +def main(): + # parse command line options + (options,args) = parser.parse_args() + base_url = "https://github.com/cms-gem-daq-project/xhal/releases/download/" + uploads_dict = {} + with open(options.uploads,'r') as f: + uploads_dict = literal_eval(f.read()) + for key,val in uploads_dict.iteritems(): + url = base_url+options.tag+"/"+key + local_path = val.replace('$XHAL_ROOT', os.getenv('XHAL_ROOT')) + dlfile(url, local_path) + +if __name__ == '__main__': + main() diff --git a/.github/uploads.cfg b/.github/uploads.cfg index 8b75df9..a32930d 100644 --- a/.github/uploads.cfg +++ b/.github/uploads.cfg @@ -4,4 +4,5 @@ "liblog4cplus.so" :"$XHAL_ROOT/lib/arm/liblog4cplus.so", "liblmdb.so" :"$XHAL_ROOT/lib/arm/liblmdb.so", "libxerces-c.so" :"$XHAL_ROOT/lib/arm/libxerces-c.so", - "libxhal_ctp7.so" :"$XHAL_ROOT/lib/arm/libxhal_ctp7.so"} + "libxhal_ctp7.so" :"$XHAL_ROOT/lib/arm/libxhal_ctp7.so", + "ipbus" :"$XHAL_ROOT/bin/ipbus"}