Skip to content

Commit

Permalink
WIP: trying to debug Windows
Browse files Browse the repository at this point in the history
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
  • Loading branch information
henryiii committed Nov 3, 2023
1 parent 746670e commit 23bbf01
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/pipx/commands/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ def _http_get_request(url: str) -> str:


PEP723 = re.compile(
r"(?m)^# /// (?P<type>[a-zA-Z0-9-]+)$\s{1,2}(?P<content>(^#(| .*)$\s{1,2})+)^# ///$"
r"(?m)^# /// (?P<type>[a-zA-Z0-9-]+)$\s(?P<content>(^#(| .*)$\s)+)^# ///$"
)


Expand All @@ -337,6 +337,8 @@ def _get_requirements_from_script(content: str) -> Optional[List[str]]:
"""

name = "pyproject"
# TODO: testing this, issue on Windows
content = content.replace("\r\n", "\n")
matches = [m for m in PEP723.finditer(content) if m.group("type") == name]

if not matches:
Expand Down
3 changes: 2 additions & 1 deletion tests/test_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,8 @@ def test_run_with_requirements(caplog, pipx_temp_env, tmp_path):
from pathlib import Path
Path({repr(str(out))}).write_text(requests.__version__)
"""
).strip()
).strip(),
encoding="utf-8",
)
run_pipx_cli_exit(["run", script.as_uri()])
assert out.read_text() == "2.28.1"
Expand Down

0 comments on commit 23bbf01

Please sign in to comment.