Closed pjz closed 7 years ago
pipsi tries hard to find those, but its easy to fail, if you want proper support, use a reasonable mechanism, the scripts argument isn't and its only supported on a best effort basis
If I need to package up a shell script with a python package, what's a "reasonable mechanism" ?
For shell scripts I don't think there is one, but I think @RonnyPfannschmidt was talking about console_scripts
.
@pjz pipsi does not care about shell scripts at all, it has no sane way to run them with the right python to begin with and its not portable to stuff like windows
pipsi is about python stuff - if you want pipsi to ship shell stuff, then do it as an executable that gives you something as output to feed to eval
after all there is a need to fill in direly needed metadata if the shell script is supposed to invoke something of the right python version
@untitaker i was talking about the scripts section, at least last i took a look we checked if a distribution had scripts in the script location
What I want to ship is some convenience wrappers around the much more powerful console_script
that pipsi installs. I'm not doing anything super special in my setup.py; I just say scripts = [ 'bin/foo.sh', 'bin/bar.sh' ]
and pip installs them correctly into the virtualenv's bin directory. I just would like them to be linked from the .local/bin as well, like the main console_script
endpoint is.
@pjz interestingly, according to https://github.com/mitsuhiko/pipsi/blob/master/pipsi.py#L110-L134 and the surrounding code, the scripts should be copied by default if they where executable as intended
I don't see that. I see it only looks in the package metadata for console_scripts in https://github.com/mitsuhiko/pipsi/blob/master/pipsi.py#L47-L49 . This method seems prone to failure if the organization of the metadata changes. How about something more robust like:
on L242ish add
venv_files = set(os.listdir(BIN_DIR))
and then line 255 could be someting as simple as:
scripts = set(os.listdir(BIN_DIR)) - venv_files
...but may have to be more complicated to work correctly on windows.
@pjz the lines before try RECORD/INSTALLED-files before falling back to console_scripts going for all ofbin-dir is inherently broken due to dependencies potentially having scripts
and RECORD/INSTALLED presumably fail in the -e ./mypackage
case. Which is my case, so I may just be out of luck.
And good catch on the dependencies; I hadn't considered that.
Scripts packaged using the scripts argument to setup.py aren't shared, and they probably should be.