diff --git a/README.md b/README.md index 7af44ae..b05dda8 100644 --- a/README.md +++ b/README.md @@ -98,6 +98,7 @@ Install packages using the new hotness in Python package management...[`pip`](ht - interpreter: The Python interpreter to use. default is `python2.6` - owner: The owner for the virtualenv - group: The group owner of the file (string or id) +- options : Command line options (string) # Example @@ -116,6 +117,14 @@ Install packages using the new hotness in Python package management...[`pip`](ht action :create end + # create a Python 2.6 virtualenv with access to the global packages owned by ubuntu user + python_virtualenv "/home/ubuntu/my_old_ve" do + owner "ubuntu" + group "ubuntu" + options "--system-site-packages" + action :create + end + Usage ===== diff --git a/providers/virtualenv.rb b/providers/virtualenv.rb index 22f2b7b..d10f099 100644 --- a/providers/virtualenv.rb +++ b/providers/virtualenv.rb @@ -25,7 +25,7 @@ action :create do unless exists? Chef::Log.info("Creating virtualenv #{@new_resource} at #{@new_resource.path}") - execute "#{virtualenv_cmd} --python=#{@new_resource.interpreter} #{@new_resource.path}" do + execute "#{virtualenv_cmd} --python=#{@new_resource.interpreter} #{@new_resource.options} #{@new_resource.path}" do user new_resource.owner if new_resource.owner group new_resource.group if new_resource.group end diff --git a/resources/virtualenv.rb b/resources/virtualenv.rb index c5840a2..7803c14 100644 --- a/resources/virtualenv.rb +++ b/resources/virtualenv.rb @@ -24,3 +24,4 @@ attribute :interpreter, :default => 'python2.6' attribute :owner, :regex => Chef::Config[:user_valid_regex] attribute :group, :regex => Chef::Config[:group_valid_regex] +attribute :options, :kind_of => String