I have a python package that comes with a variety of scripts in other languages. Setuptools already supports copying these scripts into the scripts
directory of the environment to make them accessible from the command line. For this purpose I can simply use the following keyword in the setup commmand:
setup(
...
scripts=["bin/script1.bat", "bin/script2.bat"],
...
)
After installing the package, the script files will end up correctly in the scripts
folder of the environment.
My question:
Is there a way to have these files end up in a subfolder of the scripts
directory? Something like scripts/odd_scripts/script1.bat
and scripts/even_scripts/script2.bat
.
Since they are not Python scripts, you don't need the main feature of scripts
(which is: rewriting the shebang to point to the same executable as the Python runtime which was used to install the package).
In this case, you can just package them as data_files
, the original executable bits and shebangs will be preserved:
from setuptools import setup
setup(
...
data_files=[('bin/odd_scripts', ['bin/script1.bat']),
('bin/even_scripts', ['bin/script2.bat'])],
...
)