comparison mxtool/mx.py @ 15355:43aa6a7e60bd

mx exportlibs: include libs only if there's a real dependency from a project
author Bernhard Urban <bernhard.urban@jku.at>
date Thu, 24 Apr 2014 11:50:40 +0200
parents 1ea79f17ab95
children 9e7f87dc6395
comparison
equal deleted inserted replaced
15354:4ab89f0ff10c 15355:43aa6a7e60bd
4363 elif entries[arcname] != apath: 4363 elif entries[arcname] != apath:
4364 logv('[warning: ' + apath + ' collides with ' + entries[arcname] + ' as ' + arcname + ']') 4364 logv('[warning: ' + apath + ' collides with ' + entries[arcname] + ' as ' + arcname + ']')
4365 else: 4365 else:
4366 logv('[already added ' + path + ']') 4366 logv('[already added ' + path + ']')
4367 4367
4368 for lib in _libs.itervalues(): 4368 libsToExport = set()
4369 if len(lib.urls) != 0 or args.include_system_libs: 4369 def isValidLibrary(dep):
4370 add(lib.get_path(resolve=True), lib.path) 4370 if dep in _libs.iterkeys():
4371 lib = _libs[dep]
4372 if len(lib.urls) != 0 or args.include_system_libs:
4373 return lib
4374 return None
4375
4376 # iterate over all project dependencies and find used libraries
4377 for p in _projects.itervalues():
4378 for dep in p.deps:
4379 r = isValidLibrary(dep)
4380 if r:
4381 libsToExport.add(r)
4382
4383 # a library can have other libraries as dependency
4384 size = 0
4385 while size != len(libsToExport):
4386 for lib in libsToExport.copy():
4387 for dep in lib.deps:
4388 r = isValidLibrary(dep)
4389 if r:
4390 libsToExport.add(r)
4391 size = len(libsToExport)
4392
4393 for lib in libsToExport:
4394 add(lib.get_path(resolve=True), lib.path)
4395
4371 if args.extras: 4396 if args.extras:
4372 for e in args.extras: 4397 for e in args.extras:
4373 if os.path.isdir(e): 4398 if os.path.isdir(e):
4374 for root, _, filenames in os.walk(e): 4399 for root, _, filenames in os.walk(e):
4375 for name in filenames: 4400 for name in filenames: