Hello, I would like to use pip to install some python modules. The problem is that I want to keep all my stuff isolated. I saw this https://projects.puppetlabs.com/issues/7286 about virtualenv support. Anyone knows at what stage that is? Any other solution for virtualenv and pip? Best regards, Luis -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
These modules work fine for what I need... define virtualenv($ensure = ''present'', $executable=false, $relocatable=false, $extra_search_dir=false, $site_packages=false, $never_download=false, $prompt=false, $user=''root'') { $executable_opt = $executable ? { false => '''', default => $executable } $relocatable_opt = $relocatable ? { false => '''', default => ''--relocatable'' } $site_packages_opt = $site_packages ? { false => ''--no-site-packages'', default => '''' } $never_download_opt = $never_download ? { false => '''', default => ''-never-download'' } $prompt_opt = $prompt ? { false => '''', default => "--prompt=$prompt" } $extra_search_dir_opt = $extra_search_dir ? { false => '''', default => inline_template(''<%= extra_search_dir.collect { |dir| "--extra-search-dir={dir}"}.join(" ") %>'') } if $ensure == ''present'' { exec { "virtual_env-$nme": command => "virtualenv $executable_opt $relocatable_opt $site_packages_opt \ $never_download_opt $extrasearch_dir_opt $prompt_opt $name", creates => "$name", user => $user, require => Pip::Install[''virtualenv''], } } else { file { $name : ensure => absent, recurse => true, force => true, } } } define pip::install ($ensure = ''present'', $virtualenv = false, $package = false, $version = false) { $_package = $package ? { false => $name, default => $package } $env_opt = $virtualenv ? { false => '''', default => "--environment $virtualenv" } $package_opt = $version ? { false => $_package, default => "$_package==$version" } if $ensure == ''present'' { exec { "pip_install_${_package}_${virtualenv}": unless => "pip freeze $env_opt | grep $package_opt", command => "pip install $env_opt $package_opt" } } else { exec { "pip_uninstall_${package}_${virtualenv}": onlyif => "pip freeze $env_opt | grep $package_opt", command => "pip uninstall $env_opt $package_opt" } } } I declare the virtualenv and then declare the modules I want installed in them. I have a very targeted use but I think they might be generic enough to help. Working on Puppet 2.5.7. On Fri, Feb 3, 2012 at 6:18 AM, lfrodrigues <lfrodrigues@gmail.com> wrote:> Hello, > > I would like to use pip to install some python modules. The problem is > that I want to keep all my stuff isolated. > > I saw this https://projects.puppetlabs.com/issues/7286 about > virtualenv support. > > Anyone knows at what stage that is? Any other solution for virtualenv > and pip? > > Best regards, > > Luis > > -- > You received this message because you are subscribed to the Google Groups > "Puppet Users" group. > To post to this group, send email to puppet-users@googlegroups.com. > To unsubscribe from this group, send email to > puppet-users+unsubscribe@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/puppet-users?hl=en. > >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Could you please provide an example of using the modules to install something Luis On Feb 3, 3:31 pm, Michael Cumings <mcumi...@narrativescience.com> wrote:> These modules work fine for what I need... > > define virtualenv($ensure = ''present'', $executable=false, > $relocatable=false, > $extra_search_dir=false, $site_packages=false, > $never_download=false, $prompt=false, $user=''root'') { > > $executable_opt = $executable ? { false => '''', default => $executable } > $relocatable_opt = $relocatable ? { false => '''', default => > ''--relocatable'' } > $site_packages_opt = $site_packages ? { false => ''--no-site-packages'', > default => '''' } > $never_download_opt = $never_download ? { false => '''', default => > ''-never-download'' } > $prompt_opt = $prompt ? { false => '''', default => "--prompt=$prompt" } > $extra_search_dir_opt = $extra_search_dir ? { > false => '''', > default => inline_template(''<%= extra_search_dir.collect { |dir| > "--extra-search-dir={dir}"}.join(" ") %>'') > } > > if $ensure == ''present'' { > exec { "virtual_env-$nme": > command => "virtualenv $executable_opt $relocatable_opt > $site_packages_opt \ > $never_download_opt $extrasearch_dir_opt $prompt_opt $name", > creates => "$name", > user => $user, > require => Pip::Install[''virtualenv''],} > > } > else { > file { $name : > ensure => absent, > recurse => true, > force => true, > > } > } > } > > define pip::install ($ensure = ''present'', $virtualenv = false, > $package = false, $version = false) { > > $_package = $package ? { false => $name, default => $package } > $env_opt = $virtualenv ? { false => '''', default => "--environment > $virtualenv" } > $package_opt = $version ? { false => $_package, default => > "$_package==$version" } > > if $ensure == ''present'' { > exec { "pip_install_${_package}_${virtualenv}": > unless => "pip freeze $env_opt | grep $package_opt", > command => "pip install $env_opt $package_opt" > } > } > else { > exec { "pip_uninstall_${package}_${virtualenv}": > onlyif => "pip freeze $env_opt | grep $package_opt", > command => "pip uninstall $env_opt $package_opt" > > } > } > } > > I declare the virtualenv and then declare the modules I want installed in > them. I have a very targeted use but I think they might be generic enough > to help. Working on Puppet 2.5.7. > > > > > > > > On Fri, Feb 3, 2012 at 6:18 AM, lfrodrigues <lfrodrig...@gmail.com> wrote: > > Hello, > > > I would like to use pip to install some python modules. The problem is > > that I want to keep all my stuff isolated. > > > I saw thishttps://projects.puppetlabs.com/issues/7286about > > virtualenv support. > > > Anyone knows at what stage that is? Any other solution for virtualenv > > and pip? > > > Best regards, > > > Luis > > > -- > > You received this message because you are subscribed to the Google Groups > > "Puppet Users" group. > > To post to this group, send email to puppet-users@googlegroups.com. > > To unsubscribe from this group, send email to > > puppet-users+unsubscribe@googlegroups.com. > > For more options, visit this group at > >http://groups.google.com/group/puppet-users?hl=en.-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
On Fri, Feb 3, 2012 at 04:18, lfrodrigues <lfrodrigues@gmail.com> wrote:> I would like to use pip to install some python modules. The problem is > that I want to keep all my stuff isolated. > > I saw this https://projects.puppetlabs.com/issues/7286 about > virtualenv support. > > Anyone knows at what stage that is? Any other solution for virtualenv > and pip?We don''t have any virtualenv support, and we have recently rejected similar changes to the yum provider to install to an alternate root. My strong inclination is to think that, like the rvm/gems, and yum or rpm / installroot options we don''t have a good model for this yet. Moving forward would require someone proposing a good change to the model - the package type - that would cleanly map to the required semantics of each of the various implementations of these things. -- Daniel Pittman ⎋ Puppet Labs Developer – http://puppetlabs.com ♲ Made with 100 percent post-consumer electrons -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.