Commit c22d0865 by clytwynec

Merge pull request #3952 from edx/clytwynec/prereqs_installation_update

fix for prereqs installation cache check
parents 0d37b4b2 f073afbf
...@@ -85,20 +85,22 @@ def prereq_cache(cache_name, paths, install_func): ...@@ -85,20 +85,22 @@ def prereq_cache(cache_name, paths, install_func):
raise raise
with open(cache_file_path, "w") as cache_file: with open(cache_file_path, "w") as cache_file:
cache_file.write(new_hash) # Since the pip requirement files are modified during the install
# process, we need to store the hash generated AFTER the installation
post_install_hash = compute_fingerprint(paths)
cache_file.write(post_install_hash)
else: else:
print('{cache} unchanged, skipping...'.format(cache=cache_name)) print('{cache} unchanged, skipping...'.format(cache=cache_name))
def install_ruby_prereqs(): def ruby_prereqs_installation():
""" """
Installs Ruby prereqs Installs Ruby prereqs
""" """
sh('bundle install --quiet') sh('bundle install --quiet')
def install_node_prereqs(): def node_prereqs_installation():
""" """
Installs Node prerequisites Installs Node prerequisites
""" """
...@@ -106,8 +108,7 @@ def install_node_prereqs(): ...@@ -106,8 +108,7 @@ def install_node_prereqs():
sh('npm install') sh('npm install')
@task def python_prereqs_installation():
def install_python_prereqs():
""" """
Installs Python prerequisites Installs Python prerequisites
""" """
...@@ -116,6 +117,30 @@ def install_python_prereqs(): ...@@ -116,6 +117,30 @@ def install_python_prereqs():
@task @task
def install_ruby_prereqs():
"""
Installs Ruby prereqs
"""
prereq_cache("Ruby prereqs", ["Gemfile"], ruby_prereqs_installation)
@task
def install_node_prereqs():
"""
Installs Node prerequisites
"""
prereq_cache("Node prereqs", ["package.json"], node_prereqs_installation)
@task
def install_python_prereqs():
"""
Installs Python prerequisites
"""
prereq_cache("Python prereqs", PYTHON_REQ_FILES + [sysconfig.get_python_lib()], python_prereqs_installation)
@task
def install_prereqs(): def install_prereqs():
""" """
Installs Ruby, Node and Python prerequisites Installs Ruby, Node and Python prerequisites
...@@ -123,6 +148,6 @@ def install_prereqs(): ...@@ -123,6 +148,6 @@ def install_prereqs():
if os.environ.get("NO_PREREQ_INSTALL", False): if os.environ.get("NO_PREREQ_INSTALL", False):
return return
prereq_cache("Ruby prereqs", ["Gemfile"], install_ruby_prereqs) install_ruby_prereqs()
prereq_cache("Node prereqs", ["package.json"], install_node_prereqs) install_node_prereqs()
prereq_cache("Python prereqs", PYTHON_REQ_FILES + [sysconfig.get_python_lib()], install_python_prereqs) install_python_prereqs()
...@@ -60,7 +60,7 @@ end ...@@ -60,7 +60,7 @@ end
namespace :'test:js' do namespace :'test:js' do
desc "Run the JavaScript tests and print results to the console" desc "Run the JavaScript tests and print results to the console"
task :run, [:env] => [:clean_test_files, JS_REPORT_DIR] do |t, args| task :run, [:env] => [:clean_test_files, JS_REPORT_DIR, :install_node_prereqs] do |t, args|
compile_coffeescript() compile_coffeescript()
if args[:env].nil? if args[:env].nil?
...@@ -71,7 +71,7 @@ namespace :'test:js' do ...@@ -71,7 +71,7 @@ namespace :'test:js' do
end end
desc "Run the JavaScript tests in your default browser" desc "Run the JavaScript tests in your default browser"
task :dev, [:env] => [:clean_test_files] do |t, args| task :dev, [:env] => [:clean_test_files, :install_node_prereqs] do |t, args|
compile_coffeescript() compile_coffeescript()
if args[:env].nil? if args[:env].nil?
...@@ -83,7 +83,7 @@ namespace :'test:js' do ...@@ -83,7 +83,7 @@ namespace :'test:js' do
end end
desc "Run all JavaScript tests and collect coverage information" desc "Run all JavaScript tests and collect coverage information"
task :coverage => [:clean_reports_dir, :clean_test_files, JS_REPORT_DIR] do task :coverage => [:clean_reports_dir, :clean_test_files, JS_REPORT_DIR, :install_node_prereqs] do
compile_coffeescript() compile_coffeescript()
js_test_tool(nil, 'run', true) js_test_tool(nil, 'run', true)
end end
......
...@@ -15,7 +15,7 @@ def deprecated(deprecated, deprecated_by) ...@@ -15,7 +15,7 @@ def deprecated(deprecated, deprecated_by)
end end
deprecated('install_prereqs','paver install_prereqs') deprecated('install_prereqs','paver install_prereqs')
deprecated('install_node_prereqs','paver install_prereqs') deprecated('install_node_prereqs','paver install_node_prereqs')
deprecated('install_ruby_prereqs','paver install_prereqs') deprecated('install_ruby_prereqs','paver install_ruby_prereqs')
deprecated('install_python_prereqs','paver install_prereqs') deprecated('install_python_prereqs','paver install_python_prereqs')
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment