Possible issue with parsing setup.py
(pdm.models.in_process.parse_setup_py
)
#1995
Labels
🐛 bug
Something isn't working
Steps to reproduce
In a project running in a Python 3.9.6 virtual env., without a preexisting
pyproject.toml
, with a validsetup.py
, and no previous runs ofpdm
, run the following from the project root:Actual behavior
Produces this output:
Expected behavior
I expect to see something like:
Environment Information
I've checked and re-checked
setup.py
, and it is completely valid in its original form, and as JSON (no JSON validation errors).Using the debuggger I looked at how
pdm.models.in_process.parse_setup_py
is processing the output of parsingsetup.py
here:Here, the executed command,
cmd
, is:and output of
subprocess.check_output(cmd)
is the byte string:Here,
json.loads
cannot process this as valid jSON, because you have various directory paths being prepended to the validsetup.py
JSON inside the byte string.If I modify
parse_setup_py
to the following then the parsing works, and thepyproject.toml
is generated:The
477
happens to be the index of the start of the validsetup.py
JSON substring inside the byte string produced bysubprocess.check_output
.Am I running the
pdm import
correctly, or isparse_setup_py
running the parse command incorrectly?The text was updated successfully, but these errors were encountered: