(logger)
| 164 | |
| 165 | |
| 166 | def resolve_pip_dev(logger): |
| 167 | # type: (Logger) -> Tuple[Version, Optional[SpecifierSet], List[str], str] |
| 168 | |
| 169 | build_system_requires = [] # type: List[str] |
| 170 | pip_adhoc_build_system_requires = os.environ.get("_PEX_PIP_ADHOC_BUILD_SYSTEM_REQUIRES") |
| 171 | if pip_adhoc_build_system_requires: |
| 172 | build_system_requires.extend(json.loads(pip_adhoc_build_system_requires)) |
| 173 | |
| 174 | extra_log_lines = [] # type: List[Text] |
| 175 | |
| 176 | pip_adhoc_requirement = os.environ.get("_PEX_PIP_ADHOC_REQUIREMENT") |
| 177 | if pip_adhoc_requirement: |
| 178 | pip_requirement = parse_requirement_string(pip_adhoc_requirement) |
| 179 | pip_from = "_PEX_PIP_ADHOC_REQUIREMENT={requirement}".format(requirement=pip_requirement) |
| 180 | else: |
| 181 | data = json.loads( |
| 182 | subprocess.check_output( |
| 183 | args=[ |
| 184 | "gh", |
| 185 | "run", |
| 186 | "-R", |
| 187 | PIP_REPO, |
| 188 | "list", |
| 189 | "-b", |
| 190 | PIP_BRANCH, |
| 191 | "-w", |
| 192 | PIP_WORKFLOW, |
| 193 | "-e", |
| 194 | "push", |
| 195 | "-s", |
| 196 | "success", |
| 197 | "-L1", |
| 198 | "--json", |
| 199 | "createdAt,displayTitle,headSha", |
| 200 | ] |
| 201 | ) |
| 202 | ) |
| 203 | if not data: |
| 204 | raise RunError( |
| 205 | "There were no green commits found for the {repo} {branch} branch in the " |
| 206 | "{workflow} workflow.".format( |
| 207 | repo=PIP_REPO, branch=PIP_BRANCH, workflow=PIP_WORKFLOW |
| 208 | ) |
| 209 | ) |
| 210 | green_ci_run = data[0] |
| 211 | commit = green_ci_run["headSha"] |
| 212 | pip_requirement = parse_requirement_string( |
| 213 | "pip @ git+https://github.com/{repo}@{sha}".format(repo=PIP_REPO, sha=commit) |
| 214 | ) |
| 215 | |
| 216 | pip_from = "green {workflow} commit: https://github.com/{repo}/commit/{commit}".format( |
| 217 | workflow=PIP_WORKFLOW, repo=PIP_REPO, commit=commit |
| 218 | ) |
| 219 | extra_log_lines.append( |
| 220 | to_unicode("> {created_at}: {pr_title}").format( |
| 221 | created_at=dateutil.parser.isoparse(green_ci_run["createdAt"]).strftime("%c"), |
| 222 | pr_title=green_ci_run["displayTitle"], |
| 223 | ) |
no test coverage detected