291 |
292 |
293 |
294 |
295 |
296 |
297 |
298 |
299 |
300 |
301 |
302 |
303 | |
def gettopdir(args): |
""" return the top directory for the given paths. |
if the common base dir resides in a python package |
parent directory of the root package is returned. |
""" |
args = [py.path.local(arg) for arg in args] |
-> p = reduce(py.path.local.common, args) |
assert p, "cannot determine common basedir of %s" %(args,) |
pkgdir = p.pypkgpath() |
if pkgdir is None: |
return p |
else: |
return pkgdir.dirpath() | |