I have a package which I am building locally to use inside an embedded environment.
I am trying to generate a console script automatically, so I am using console_scripts inside entry_points like the following:
setup(...,
entry_points={
'console_scripts': [
'app=x.y:main'
]
},
# Below is added as the other tried methods failed.
options={
'build_scripts': {
'executable': '/bin/custom_python',
},
}
)
I am trying to set the python interpreter used in my entry_point as it is different than the one inside the build system. But no matter what I try it keeps set to the local interpreter.
I tried several options like:
But none of the above worked. I wonder if there is something I am missing?
So finally I managed to do it.
First I had to add the following to my setup call, which is suggested in various posts:
options={
'build_scripts': {
'executable': '/bin/custom_python',
},
}
Now I build and install the package as usual. In my case, I create a wheel and install it:
python3 setup.py sdist bdist_wheel -d wheels
pip3 install --no-deps -U --prefix $TARGET_INSTALL wheels/mypackage.whl
The above will use the local python interpreter for the created scripts
To fix that I run the following:
python3 setup.py install_scripts -d $TARGET_INSTALL/bin
which replaces the scripts with the correct ones passed in 'build_scripts' option.
But I am still wondering if there is a way to get the correct interpreter directly when installing the wheel with pip?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With