Fingerprint the filenames in site-packages to decide when to install requirements.
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
require './rakefiles/helpers.rb'
|
require './rakefiles/helpers.rb'
|
||||||
|
require 'tempfile'
|
||||||
|
|
||||||
PREREQS_MD5_DIR = ENV["PREREQ_CACHE_DIR"] || File.join(REPO_ROOT, '.prereqs_cache')
|
PREREQS_MD5_DIR = ENV["PREREQ_CACHE_DIR"] || File.join(REPO_ROOT, '.prereqs_cache')
|
||||||
|
|
||||||
@@ -28,15 +28,21 @@ end
|
|||||||
|
|
||||||
desc "Install all python prerequisites for the lms and cms"
|
desc "Install all python prerequisites for the lms and cms"
|
||||||
task :install_python_prereqs => "ws:migrate" do
|
task :install_python_prereqs => "ws:migrate" do
|
||||||
unchanged = 'Python requirements unchanged, nothing to install'
|
if !ENV['NO_PREREQ_INSTALL']
|
||||||
when_changed(unchanged, 'requirements/**/*') do
|
Tempfile.open('pyinstalled') do |pyinstalled|
|
||||||
ENV['PIP_DOWNLOAD_CACHE'] ||= '.pip_download_cache'
|
# Read the names of everything in site-packages, and include them in the fingerprint.
|
||||||
sh('pip install --exists-action w -r requirements/edx/base.txt')
|
sh("python -c 'import os; import distutils.sysconfig as dusc; print sorted(os.listdir(dusc.get_python_lib()))' > #{pyinstalled.path}")
|
||||||
sh('pip install --exists-action w -r requirements/edx/post.txt')
|
unchanged = 'Python requirements unchanged, nothing to install'
|
||||||
# Check for private-requirements.txt: used to install our libs as working dirs,
|
when_changed(unchanged, 'requirements/**/*', pyinstalled.path) do
|
||||||
# or personal-use tools.
|
ENV['PIP_DOWNLOAD_CACHE'] ||= '.pip_download_cache'
|
||||||
if File.file?("requirements/private.txt")
|
sh('pip install --exists-action w -r requirements/edx/base.txt')
|
||||||
sh('pip install -r requirements/private.txt')
|
sh('pip install --exists-action w -r requirements/edx/post.txt')
|
||||||
|
# requirements/private.txt is used to install our libs as
|
||||||
|
# working dirs, or for personal-use tools.
|
||||||
|
if File.file?("requirements/private.txt")
|
||||||
|
sh('pip install -r requirements/private.txt')
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end unless ENV['NO_PREREQ_INSTALL']
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user