I’m using pyproject.toml to define enry points. This somehow generates shell scripts starting my python code. I was told that this scripts are generated by pip and not by setuptools. That is why I’m asking here.
I want to replace or modify that scripts. Because I will offer my users to start the application not only as usual user but also as root. I use policy-kit for that and starting python via pkexec. Or in other cases I would like to modify environment variables.
Is there an offical standardizied and elegant/pythonic way to achiev this?
Re-reading my response, it sounds a little harsh. But it’s a genuine question. Let me rephrase it as : What is it that you don’t think you can accomplish by doing it in the entry point function? If we understand that, we can better respond to your question.
To modify the scripts? No. But as Eric mentioned, this can be done in the Python code.
In your polkit use-case, you would provide a new entrypoint that simply runs os.execv('pkexec', ['your-original-entrypoint']). In the environment variables use-case, you just change os.environ as desired and call the original entrypoint function.
Thanks for your reply’s.
As it often is it is much easier with Python then someone can think. Of course your solutions are easy but they didn’t come to my mind.
That you can replace a process (via os.execv()) was new to me.