Return the Python package path by looking for the last directory upwards which still contains an __init__.py. Return None if a pkgpath cannot be determined.
(self)
| 1043 | error.checked_call(os.chmod, self.strpath, mode) |
| 1044 | |
| 1045 | def pypkgpath(self): |
| 1046 | """Return the Python package path by looking for the last |
| 1047 | directory upwards which still contains an __init__.py. |
| 1048 | Return None if a pkgpath cannot be determined. |
| 1049 | """ |
| 1050 | pkgpath = None |
| 1051 | for parent in self.parts(reverse=True): |
| 1052 | if parent.isdir(): |
| 1053 | if not parent.join("__init__.py").exists(): |
| 1054 | break |
| 1055 | if not isimportable(parent.basename): |
| 1056 | break |
| 1057 | pkgpath = parent |
| 1058 | return pkgpath |
| 1059 | |
| 1060 | def _ensuresyspath(self, ensuremode, path): |
| 1061 | if ensuremode: |