Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BD-18] Remove paver with Make #128

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -119,3 +119,5 @@ docker_push: docker_tag docker_auth ## push to docker hub
docker push 'openedx/edx-platform:latest-newrelic'
docker push "openedx/edx-platform:${GITHUB_SHA}-newrelic"

install_prereqs:
$ python -c 'from pavelib.prereqs import install_prereqs; install_prereqs()'
22 changes: 8 additions & 14 deletions pavelib/prereqs.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@
import hashlib
import os
import re
import subprocess
from subprocess import Popen, call, check_output
import sys
from distutils import sysconfig

from paver.easy import BuildFailure, sh, task

from .utils.envs import Env
from .utils.timer import timed
Expand Down Expand Up @@ -141,14 +140,14 @@ def node_prereqs_installation():
# The implementation of Paver's `sh` function returns before the forked
# actually returns. Using a Popen object so that we can ensure that
# the forked process has returned
proc = subprocess.Popen(npm_command, stderr=npm_log_file)
proc = Popen(npm_command, stderr=npm_log_file)
retcode = proc.wait()
if retcode == 1:
# Error handling around a race condition that produces "cb() never called" error. This
# evinces itself as `cb_error_text` and it ought to disappear when we upgrade
# npm to 3 or higher. TODO: clean this up when we do that.
print("npm install error detected. Retrying...")
proc = subprocess.Popen(npm_command, stderr=npm_log_file)
proc = Popen(npm_command, stderr=npm_log_file)
retcode = proc.wait()
if retcode == 1:
raise Exception("npm install failed: See {}".format(npm_log_file_path))
Expand All @@ -168,10 +167,8 @@ def python_prereqs_installation():
def pip_install_req_file(req_file):
"""Pip install the requirements file."""
pip_cmd = 'pip install -q --disable-pip-version-check --exists-action w'
sh("{pip_cmd} -r {req_file}".format(pip_cmd=pip_cmd, req_file=req_file))
call("{pip_cmd} -r {req_file}".format(pip_cmd=pip_cmd, req_file=req_file), shell=True)


@task
@timed
def install_node_prereqs():
"""
Expand Down Expand Up @@ -203,7 +200,6 @@ def install_node_prereqs():
]


@task
@timed
def uninstall_python_packages():
"""
Expand Down Expand Up @@ -239,12 +235,12 @@ def uninstall_python_packages():
# to really really get rid of it.
for _ in range(3):
uninstalled = False
frozen = sh("pip freeze", capture=True)
frozen = check_output('pip freeze', shell=True).decode("utf-8")

for package_name in PACKAGES_TO_UNINSTALL:
if package_in_frozen(package_name, frozen):
# Uninstall the pacakge
sh("pip uninstall --disable-pip-version-check -y {}".format(package_name))
call("pip uninstall --disable-pip-version-check -y {}".format(package_name), shell=True)
uninstalled = True
if not uninstalled:
break
Expand Down Expand Up @@ -275,7 +271,6 @@ def package_in_frozen(package_name, frozen_output):
return bool(re.search(pattern, frozen_output))


@task
@timed
def install_coverage_prereqs():
""" Install python prereqs for measuring coverage. """
Expand All @@ -285,7 +280,6 @@ def install_coverage_prereqs():
pip_install_req_file(COVERAGE_REQ_FILE)


@task
@timed
def install_python_prereqs():
"""
Expand Down Expand Up @@ -319,12 +313,12 @@ def install_python_prereqs():
prereq_cache("Python prereqs", files_to_fingerprint, python_prereqs_installation)


@task
@timed
def install_prereqs():
"""
Installs Node and Python prerequisites
"""

if no_prereq_install():
print(NO_PREREQ_MESSAGE)
return
Expand All @@ -338,7 +332,7 @@ def install_prereqs():

def log_installed_python_prereqs():
""" Logs output of pip freeze for debugging. """
sh("pip freeze > {}".format(Env.GEN_LOG_DIR + "/pip_freeze.log"))
call("pip freeze > {}".format(Env.GEN_LOG_DIR + "/pip_freeze.log"), shell=True)


def print_devstack_warning():
Expand Down