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:
- Setting an interpreter in shebang header in setup.py
- Setting sys.executable inside setup.py
- Using options={'build_scripts': {'executable': 'bin/custom_python'}}
- Using pip install --global-option=build --global-option='--executable=/bin/custom_python'
But none of the above worked. I wonder if there is something I am missing?
entry_pointis not actually executed, it is merely a hook for other code to find it. If you mean that you define aconsole_scripts, that one simply uses the python version used to runsetup.py. Just use your desired python version in this case. Overwritingsys.executableand the like is futile, as your process is already running.console_scriptsis executed when installing, not when building. Whatever version is used on the target host to install, that one is used forconsole_scripts. How do you "generate" the console scripts? How do you install?