forked from ungleich-public/cdist
		
	Use pyvenv instead of virtualenv.
This commit is contained in:
		
					parent
					
						
							
								2410b30b40
							
						
					
				
			
			
				commit
				
					
						49423e174b
					
				
			
		
					 3 changed files with 73 additions and 86 deletions
				
			
		| 
						 | 
				
			
			@ -30,13 +30,6 @@ destination="/$__object_id"
 | 
			
		|||
owner="$(cat "$__object/parameter/owner")"
 | 
			
		||||
group="$(cat "$__object/parameter/group")"
 | 
			
		||||
mode="$(cat "$__object/parameter/mode")"
 | 
			
		||||
python="$(cat "$__object/parameter/python")"
 | 
			
		||||
if [ "$python" ]
 | 
			
		||||
then
 | 
			
		||||
    python_opt="-p $python"
 | 
			
		||||
else
 | 
			
		||||
    python_opt=""
 | 
			
		||||
fi
 | 
			
		||||
venvparams="$(cat "$__object/parameter/venvparams")"
 | 
			
		||||
 | 
			
		||||
[  "$state_should" = "$state_is" -a \
 | 
			
		||||
| 
						 | 
				
			
			@ -46,9 +39,8 @@ venvparams="$(cat "$__object/parameter/venvparams")"
 | 
			
		|||
 | 
			
		||||
case $state_should in
 | 
			
		||||
    present)
 | 
			
		||||
 | 
			
		||||
        if [ "$state_should" != "$state_is" ]; then
 | 
			
		||||
            echo virtualenv "$python_opt" $venvparams "$destination"
 | 
			
		||||
            echo pyvenv $venvparams "$destination"
 | 
			
		||||
        fi
 | 
			
		||||
        if [ \( -n "$owner" -a "$owner_is" != "$owner" \) -o \
 | 
			
		||||
             \( -n "$group" -a "$group_is" != "$group" \) ]; then
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,26 +1,24 @@
 | 
			
		|||
cdist-type__pyvenv(7)
 | 
			
		||||
cdist-type__pyvenv(7)
 | 
			
		||||
==================
 | 
			
		||||
Darko Poljak <darko.poljak--@--gmail.com>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
NAME
 | 
			
		||||
----
 | 
			
		||||
cdist-type__pyvenv - Create or remove python virtualenv
 | 
			
		||||
cdist-type__pyvenv - Create or remove python virtual environment
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
DESCRIPTION
 | 
			
		||||
-----------
 | 
			
		||||
This cdist type allows you to create or remove python virtualenv.
 | 
			
		||||
It assumes pip and virtualenv are already installed. Concrete packages
 | 
			
		||||
or installation procedures depend on concrete OS and/or OS
 | 
			
		||||
version/distribution.
 | 
			
		||||
Ensure this in your init manifest as in the following example:
 | 
			
		||||
This cdist type allows you to create or remove python virtual environment using pyvenv.
 | 
			
		||||
It assumes python >= 3.3 is already installed. Concrete package depends on concrete OS
 | 
			
		||||
and/or OS version/distribution.
 | 
			
		||||
Ensure this for e.g. in your init manifest as in the following example:
 | 
			
		||||
--------------------------------------------------------------------------------
 | 
			
		||||
case "$__target_host" in
 | 
			
		||||
    localhost)
 | 
			
		||||
        __package python3-pip --state present
 | 
			
		||||
        require="__package/python3-pip" __package_pip virtualenv --pip pip3 --state present
 | 
			
		||||
        require="__package/python3-pip __package_pip/virtualenv" __pyvenv /home/darko/testenv --owner darko --group darko --mode 740 --state present
 | 
			
		||||
        __package python3 --state present
 | 
			
		||||
        require="__package/python3" __pyvenv /home/darko/testenv --owner darko --group darko --mode 740 --state present
 | 
			
		||||
    ;;
 | 
			
		||||
--------------------------------------------------------------------------------
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -35,20 +33,16 @@ state::
 | 
			
		|||
    Either "present" or "absent", defaults to "present"
 | 
			
		||||
 | 
			
		||||
group::
 | 
			
		||||
   Group to chgrp to.
 | 
			
		||||
   Group to chgrp to
 | 
			
		||||
 | 
			
		||||
mode::
 | 
			
		||||
   Unix permissions, suitable for chmod.
 | 
			
		||||
   Unix permissions, suitable for chmod
 | 
			
		||||
 | 
			
		||||
owner::
 | 
			
		||||
   User to chown to.
 | 
			
		||||
 | 
			
		||||
python::
 | 
			
		||||
    Use specific python interpreter for creating virtualenv.
 | 
			
		||||
    The default is the interpreter that virtualenv was installed with.
 | 
			
		||||
   User to chown to
 | 
			
		||||
 | 
			
		||||
venvparams::
 | 
			
		||||
    virtualenv specific parameters to pass to virtualenv invocation.
 | 
			
		||||
   Specific parameters to pass to pyvenv invocation
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
EXAMPLES
 | 
			
		||||
| 
						 | 
				
			
			@ -57,11 +51,11 @@ EXAMPLES
 | 
			
		|||
--------------------------------------------------------------------------------
 | 
			
		||||
__pyvenv /home/services/djangoenv
 | 
			
		||||
 | 
			
		||||
# Create python virtualenv for user foo using specific python interpreter.
 | 
			
		||||
__pyvenv /home/foo/fooenv --group foo --user foo --python python2.6
 | 
			
		||||
# Create python virtualenv for user foo.
 | 
			
		||||
__pyvenv /home/foo/fooenv --group foo --user foo
 | 
			
		||||
 | 
			
		||||
# Create python virtualenv with specific parameters.
 | 
			
		||||
__pyvenv /home/services/djangoenv --venvparams "--relocatable --system-site-packages"
 | 
			
		||||
__pyvenv /home/services/djangoenv --venvparams "--copies --system-site-packages"
 | 
			
		||||
--------------------------------------------------------------------------------
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -74,3 +68,4 @@ COPYING
 | 
			
		|||
-------
 | 
			
		||||
Copyright \(C) 2016 Darko Poljak. Free use of this software is
 | 
			
		||||
granted under the terms of the GNU General Public License version 3 (GPLv3).
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -18,7 +18,7 @@
 | 
			
		|||
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
# It assumes pip and virtualenv are already installed. Concrete packages
 | 
			
		||||
# It assumes python >= 3.3 is already installed. Concrete packages
 | 
			
		||||
# or installation procedures depend on concrete OS and/or OS
 | 
			
		||||
# version/distribution.
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue