MCPcopy
hub / github.com/pex-tool/pex / resolve_pip_dev

Function resolve_pip_dev

testing/bin/run_tests.py:166–362  ·  view source on GitHub ↗
(logger)

Source from the content-addressed store, hash-verified

164
165
166def 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 )

Callers 1

mainFunction · 0.85

Calls 14

parse_requirement_stringFunction · 0.90
to_unicodeFunction · 0.90
temporary_dirFunction · 0.90
URLFetcherClass · 0.90
RunErrorClass · 0.85
extendMethod · 0.80
appendMethod · 0.80
get_body_streamMethod · 0.80
decodeMethod · 0.80
getMethod · 0.45
loadMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected