https://pantsbuild.org/ logo
#development
Title
# development
h

happy-kitchen-89482

07/13/2021, 1:16 AM
Brainstorm: We currently have elementary support for the
package
goal running existing
setup.py
files in the repo. But there is an issue with the cwd:
VenvPexProcess
is currently set up to run with the cwd as the sandbox root. But handwritten
setup.py
files are usually authored under the assumption that the
cwd
is wherever the
setup.py
is. This affects what relpaths in
setup.py
are relative to, for example. It seems like the right thing to do is to set
working_directory
on the underlying
Process
to wherever
setup.py
is. I've tried this, but unfortunately the
VenvPexProcess
shim script machinery doesn't like it. We could strip the relevant prefix so that
setup.py
ends up in the root, under the reasonable assumption that everything it references is under it in the repo. However this causes issues with capturing the output of running
setup.py develop
which writes in unpredictable locations under the cwd. So we'd have to capture the entire sandbox as output (this currently fails, due to absolute symlinks in the pex cache dir, but we could fix that I imagine). Any thoughts on which is the right way to go? Could the Pex/VenvPex machinery be easily made to support running from a cwd other than the root, or is that just asking for trouble?
cc @enough-analyst-54434 as this is your wheelhouse
e

enough-analyst-54434

07/13/2021, 2:05 AM
if setting working directory doesn't work today that's a bug.
I'll take a look...
Can you share a backtrace?
It looks like the option is simply not plumbed.
h

happy-kitchen-89482

07/13/2021, 3:57 AM
Right, I plumbed it
I'll post a branch
e

enough-analyst-54434

07/13/2021, 4:38 AM
Excellent - thank you.
h

happy-kitchen-89482

07/14/2021, 1:57 PM
Turned out to be not that hard to get it working: https://github.com/pantsbuild/pants/pull/12347
Required a little finessing with the shim scripts in the VenvPex case