Skip to content
This repository has been archived by the owner on Jan 31, 2022. It is now read-only.

Commit

Permalink
Merge pull request #9 from mexanick/develop
Browse files Browse the repository at this point in the history
Adding get_binaries.py and ipbus to the list of uploads
  • Loading branch information
jsturdy committed Sep 5, 2017
2 parents 02eeb49 + 1619f07 commit b7f1812
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 1 deletion.
42 changes: 42 additions & 0 deletions .github/get_binaries.py
Original file line number Diff line number Diff line change
@@ -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()
3 changes: 2 additions & 1 deletion .github/uploads.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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"}

0 comments on commit b7f1812

Please sign in to comment.