virtualenv and make DESTDIR=

Hartmut Goebel h.goebel at goebel-consult.de
Fri Mar 4 08:03:50 EST 2022


Hi,

How can I make installing a virtual environment honor DESTDIR? How can I 
install a virtual environment in $(DESTDIR)$(PREFIX), which behaves as 
being set-up in $(PREFIX)? (Of course, this virtual environment can not 
be used. My aim is to ship it as part of a rpm package)

In Makefiles is good practice to honor DESTDIR in the "install" target, 
like this

install:
     install -t $(DESTDIR)$(PREFIX)/bin build/bin/my-tool

Now when running

     python3 -m venv $(DESTDIR)$(PREFIX)

all paths in this virtual environment refer to $(DESTDIR)$(PREFIX) 
instead of just $$(PREFIX)

Any ideas?


Background:

More about DESTDIR: 
https://www.gnu.org/prep/standards/html_node/DESTDIR.html

Following Redhat's commendations, I want to install my (somewhat 
complex) software into /opt/my-software. To make it easier for users to 
use the software, my idea was to setup a virtual environment in 
/opt/my-software. Thus users can easily use /opt/my-software/bin/python 
and have the library provided by my-software available. My Software also 
includes some scripts, which will also reside in /opt/my-software/bin 
and refer to /opt/my-software/bin/python. This will avoid to require 
users to set up PYTHONPATH when thy want to use MY Software.


-- 
Schönen Gruß
Hartmut Goebel
Dipl.-Informatiker (univ), CISSP, CSSLP, ISO 27001 Lead Implementer
Information Security Management, Security Governance, Secure Software 
Development

Goebel Consult, Landshut
http://www.goebel-consult.de

Blog: https://www.goe-con.de/blog/why-a-pki-is-barely-trustworthy
Kolumne: 
https://www.goe-con.de/hartmut-goebel/cissp-gefluester/2011-11-in-troja-nichts-neues 



More information about the Python-list mailing list