Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[gentoo-user] Source Python virtualenv in OpenRC script

425 views
Skip to first unread message

Julien Roy

unread,
Dec 11, 2021, 7:00:04 PM12/11/21
to
Hello,

I am trying to create an OpenRC script to start a python module.
To launch the module manually, what I would do is:
cd $moduleDir
source bin/activate
python -m $module

How can I integrate this in an OpenRC script? Do I need to write my own start function or is there a built-in way to do this?

Thanks,
Julien

Manuel McLure

unread,
Dec 12, 2021, 5:40:04 PM12/12/21
to


On Sat, Dec 11, 2021 at 3:54 PM Julien Roy <jul...@jroy.ca> wrote:
Hello,

I am trying to create an OpenRC script to start a python module.
To launch the module manually, what I would do is:
cd $moduleDir
source bin/activate
python -m $module

You can actually just use

$moduleDir/bin/python -m $module

Executing anything from the bin directory inside the venv will make it act as if it had activated the venv.
--
Manuel A. McLure WW1FA <man...@mclure.org> <http://www.mclure.org>
...for in Ulthar, according to an ancient and significant law,
no man may kill a cat.                       -- H.P. Lovecraft

Julien Roy

unread,
Dec 12, 2021, 6:00:04 PM12/12/21
to
Thanks, I didn´t realize it was this easy!

Regards,
Julien



Dec 12, 2021, 22:39 by man...@mclure.org:
0 new messages