-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from emmanuelguerin/eguerin2
Fix pip installation for python 3.6 and simplify virtualenv
- Loading branch information
Showing
4 changed files
with
10 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,25 @@ | ||
provides :python_virtualenv | ||
|
||
property :virtualenv, String, name_property: true | ||
property :system_site_packages, equal_to: [true, false], default: false | ||
property :path, String, name_property: true | ||
property :group, [String, Integer, NilClass] | ||
property :user, [String, Integer, NilClass] | ||
property :pip_version, [String, TrueClass, FalseClass], default: lazy { node['python3']['pip']['version'] } | ||
property :pip_binary_name, [String, TrueClass, FalseClass], default: lazy { node['python3']['pip']['binary_name'] } | ||
|
||
property :python_version, [String, FalseClass], default: lazy { node['python3']['version'] } | ||
property :python_provider, [String, FalseClass], default: lazy { node['python3']['source'] } | ||
property :python_checksum, [String, FalseClass], default: lazy { node['python3']['checksum'] } | ||
property :binary_name, [String, FalseClass], default: lazy { node['python3']['binary_name'] } | ||
property :system_site_packages, [TrueClass, FalseClass], default: false | ||
|
||
load_current_value do |new_resource| | ||
current_value_does_not_exist! unless ::File.exist?(::File.join(new_resource.virtualenv, 'bin/activate')) | ||
current_value_does_not_exist! unless ::File.exist?(::File.join(new_resource.path, 'bin/activate')) | ||
end | ||
|
||
action :create do | ||
python_install node['python3']['name'] do | ||
version new_resource.python_version | ||
source new_resource.python_provider | ||
checksum new_resource.python_checksum | ||
end | ||
|
||
cmd = ::Python3::Path.virtualenv_binary(new_resource) | ||
cmd += " --pip #{new_resource.pip_version}" if new_resource.pip_version | ||
cmd += " --python #{new_resource.binary_name}" if new_resource.binary_name | ||
cmd += " #{new_resource.virtualenv}" | ||
cmd = "#{::Python3::Path.python_binary(new_resource)} -m venv" | ||
cmd += ' --system-site-packages' if new_resource.system_site_packages | ||
cmd += " #{new_resource.path}" | ||
|
||
execute cmd do | ||
user new_resource.user | ||
group new_resource.group | ||
creates new_resource.virtualenv | ||
creates new_resource.path | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters