I want to create a setup.py which would install my files into custom directories. I have a certain prefix, where I would like to get the following result:
/my/prefix/
bin/
script.sh
libexec/
one.py
two.py
...
lib/pythonX.Y/site-packages/
package/...
My initial project is following:
/
script.sh
one.py
two.py
...
setup.py
package/...
__init__.py
...
What would be the best way to achieve that? I would like to be able to install it later with something like:
python setup.py install --prefix=/my/prefix
I can get "package" nicely installed in the correct directory as lib/pythonX.Y/site-packages under --prefix is the default location. But is there a clean way to get script.sh into "bin" and other python files into "libexec"? The only way I see to achieve that would be to manually copy those files in my setup.py script. Maybe there is a cleaner and more standard way to do that?
The scripts are handled by use of the
scriptsparameter to the setup function. For libexec you can treat them as data files and use a data options.I’m not sure how that would work with a
--prefixoption, I’ve never tried that.