return the path's package path by looking for the given
pkgname. If pkgname is None then look for the last
directory upwards which still contains an __init__.py.
Return None if a pkgpath can not be determined.
def pypkgpath(self, pkgname=None):
origin: path.local
where:
function source:
def pypkgpath(self, pkgname=None):
""" return the path's package path by looking for the given
pkgname. If pkgname is None then look for the last
directory upwards which still contains an __init__.py.
Return None if a pkgpath can not be determined.
"""
pkgpath = None
for parent in self.parts(reverse=True):
if pkgname is None:
if parent.check(file=1):
continue
if parent.join('__init__.py').check():
pkgpath = parent
continue
return pkgpath
else:
if parent.basename == pkgname:
return parent
return pkgpath
called in /home/johnny/projects/merlinux/py/dist/py/path/local/local.py
traceback path.local.pypkgpath.0
called in /home/johnny/projects/merlinux/py/dist/py/path/local/local.py
traceback path.local.pypkgpath.1
called in /home/johnny/projects/merlinux/py/dist/py/path/local/local.py
traceback path.local.pypkgpath.2
called in /home/johnny/projects/merlinux/py/dist/py/path/local/local.py
traceback path.local.pypkgpath.3
called in /home/johnny/projects/merlinux/py/dist/py/test/collect.py
traceback path.local.pypkgpath.4
called in /home/johnny/projects/merlinux/py/dist/py/path/local/local.py
traceback path.local.pypkgpath.5
called in /home/johnny/projects/merlinux/py/dist/py/path/local/testing/test_local.py
traceback path.local.pypkgpath.6
called in /home/johnny/projects/merlinux/py/dist/py/path/local/local.py
traceback path.local.pypkgpath.7
called in /home/johnny/projects/merlinux/py/dist/py/path/local/local.py
traceback path.local.pypkgpath.8
called in /home/johnny/projects/merlinux/py/dist/py/path/local/local.py
traceback path.local.pypkgpath.9
called in /home/johnny/projects/merlinux/py/dist/py/path/local/local.py
traceback path.local.pypkgpath.10
called in /home/johnny/projects/merlinux/py/dist/py/test/collect.py
traceback path.local.pypkgpath.11
called in /home/johnny/projects/merlinux/py/dist/py/path/local/local.py
traceback path.local.pypkgpath.12
called in /home/johnny/projects/merlinux/py/dist/py/path/local/local.py
traceback path.local.pypkgpath.13
called in /home/johnny/projects/merlinux/py/dist/py/path/local/local.py
traceback path.local.pypkgpath.14
called in /home/johnny/projects/merlinux/py/dist/py/path/local/local.py
traceback path.local.pypkgpath.15
called in /home/johnny/projects/merlinux/py/dist/py/path/local/local.py
traceback path.local.pypkgpath.16
called in /home/johnny/projects/merlinux/py/dist/py/path/local/local.py
traceback path.local.pypkgpath.17
called in /home/johnny/projects/merlinux/py/dist/py/path/local/local.py
traceback path.local.pypkgpath.18
called in /home/johnny/projects/merlinux/py/dist/py/path/local/local.py
traceback path.local.pypkgpath.19
called in /home/johnny/projects/merlinux/py/dist/py/test/collect.py