Returns the root folder of the project.
()
| 256 | |
| 257 | |
| 258 | def _get_repo_root() -> Optional[str]: |
| 259 | """Returns the root folder of the project.""" |
| 260 | # Get root of this repository. Assume we don't have directories nested deeper than 10 items. |
| 261 | p = Path(os.getcwd()) |
| 262 | for i in range(10): |
| 263 | if p is None: |
| 264 | break |
| 265 | if Path(p / ".git").exists(): |
| 266 | return str(p) |
| 267 | # .git is not available in repos cloned via Cloud Build |
| 268 | # setup.py is always in the library's root, so use that instead |
| 269 | # https://github.com/googleapis/synthtool/issues/792 |
| 270 | if Path(p / "setup.py").exists(): |
| 271 | return str(p) |
| 272 | p = p.parent |
| 273 | raise Exception("Unable to detect repository root.") |
| 274 | |
| 275 | |
| 276 | GENERATED_READMES = sorted([x for x in Path(".").rglob("*.rst.in")]) |
no outgoing calls
no test coverage detected
searching dependent graphs…