mi mi
/
DirectSPI-test
DirectSPI test program
Diff: makelib.py
- Revision:
- 8:e11a0361f57f
- Parent:
- 7:84a0a208ebb2
- Child:
- 9:7dfa4f5adf42
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/makelib.py Sat Feb 25 16:11:44 2017 +0900 @@ -0,0 +1,67 @@ +#### lib.py for mbed #### +# v0.4 +# 2017/02 made by dinau +# + +# Notice: Unsupported libraries. +# These libraries must be specified in Makefile. +# mbed-os +# mbed-dev + + +# Usage: +# $ make lib +# or +# $ python makelib.py +# + +import os,sys +import commands + +def getlibs(cdir): + liblist=[] + for f in os.listdir(cdir): + if os.path.isfile(f): + name, ext = os.path.splitext(f) + if ext == '.lib': + if name != 'mbed-os': + liblist.append(f) + if len( liblist ) > 0: + for f in liblist: + subdir, ext = os.path.splitext(f) + print subdir + url = open(f).read() + print url + sys.stdout.flush() + if ('developer.mbed.org' in url) or ('mbed.org' in url): + cmd = 'hg clone -q ' + url + res = os.system( cmd ) + os.chdir(subdir) + getlibs(cdir) + elif 'mbed-os' in url: + print 'mbed-os is unsupported at this moment.' + elif 'github.com' in url: + urllist = url.split('#') + if len(urllist) == 1: + cmd = 'git clone ' + urllist[0] + res = os.system( cmd ) + os.chdir(subdir) + getlibs(cdir) + elif len(urllist) == 2: + cmd = 'git clone -q ' + urllist[0] + print cmd + sys.stdout.flush() + res = os.system( cmd ) + os.chdir(subdir) + print 'cd %s' % (subdir) + sys.stdout.flush() + cmd = 'git checkout -q ' + urllist[1] + print cmd + sys.stdout.flush() + res = os.system( cmd ) + getlibs(cdir) + +print '--- Getting libraries ----' +getlibs('.') +print '--- end ---' +