简体   繁体   中英

console_scripts not on path when debianising a python package using dh_virtualenv

I have followed the tutorial here https://dh-virtualenv.readthedocs.io/en/latest/tutorial.html#step-2-setup-the-debian-packaging closely and everything builds and installs fine.

However, my python package usually installs some console scripts, and I would like to be able to install the .deb so that these commands are available globally, ie are on the path, rather than only be available when the virtual env in activated.

I could just copy whatever I want from /opt/venvs/my_package/bin/ to /usr/bin/, or some other simple method like that, possibly in the postinst file.

However, what I would like to know is whether there a specific way of doing this that constitutes 'best practice'.

Thanks

The dh_virtualenv docs recommend creating symbolink links.

So use the debian/«pkgname».links file to add a symbolic link to those exectuables you want to be visible, typically the one created by your main application package.

opt/venvs/«venvname»/bin/«cmdname» usr/bin/«cmdname»

In your console scripts change the shebang #! line to use the python executable in /opt/venvs/my_package/bin if dh_virtualenv hasn't already.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM