Permalink
Browse files

Add a job and button to run pip install on a pip project.

  • Loading branch information...
Dusty Phillips
Dusty Phillips committed Sep 6, 2010
1 parent 56a0fb0 commit d8c04c22130004118facbe2dbb0e15665aace49f
@@ -311,3 +311,23 @@ def virtualenv(project_id):
project.name, "success" if not process.returncode else "error"),
message=response,
project=project)
+
+@command("PIPINSTALL")
+def virtualenv(project_id):
+ """Run pip install in the project directory"""
+ project = Project.objects.get(id=project_id, pipproject__isnull=False)
+ print "Running pip install for %s" % project.name
+
+ command = "source %sbin/activate ; pip install -r requirements.txt" % (
+ project.pipproject.virtualenv_path)
+
+ process = subprocess.Popen(command, cwd=project.base_directory,
+ stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
+
+ response = process.communicate()[0]
+
+ Notification.objects.create(status="success" if not process.returncode else "error",
+ summary="pip install '%s' %s" % (
+ project.name, "success" if not process.returncode else "error"),
+ message=response,
+ project=project)
@@ -26,4 +26,5 @@
url('^(?P<project_id>\d+)/migrate/$', 'schedule_migrate', name="schedule_migrate"),
url('^(?P<project_id>\d+)/edit_buildout/$', 'edit_buildout', name="edit_buildout"),
url('^(?P<project_id>\d+)/virtualenv/$', 'schedule_virtualenv', name="schedule_virtualenv"),
+ url('^(?P<project_id>\d+)/pip_install/$', 'schedule_pip_install', name="schedule_pip_install"),
)
@@ -47,6 +47,10 @@ def schedule_virtualenv(request, project_id):
return schedule_project_command(request, project_id, "VIRTUALENV",
"Successfully queued virtualenv")
+def schedule_pip_install(request, project_id):
+ return schedule_project_command(request, project_id, "PIPINSTALL",
+ "Successfully queued pip_install")
+
def schedule_project_command(request, project_id, command, success_message):
project = get_object_or_404(Project, id=project_id)
@@ -324,6 +324,15 @@ ul.projects li .buttons .bootstrap,
background-position: 0 -480px;
}
+ul.projects li .buttons .virtualenv,
+.project .actions .virtualenv {
+ background-position: 0 -480px;
+}
+ul.projects li .buttons .pip_install,
+.project .actions .pip_install {
+ background-position: 0 0;
+}
+
ul.projects li .buttons .startapp,
.project .actions .startapp {
background-position: 0 -528px;
@@ -40,6 +40,7 @@ <h2>Actions</h2>
<a class="buildout ajax" href="{% url schedule_buildout project.id %}" title="Run Buildout">Buildout</a>
{% else %}
<a class="virtualenv ajax" href="{% url schedule_virtualenv project.id %}" title="Build Virtualenv">Build Virtualenv</a>
+ <a class="pip_install ajax" href="{% url schedule_pip_install project.id %}" title="Pip Install">Pip Install</a>
{% endif %}
<a class="tests ajax {{ project.test_status|yesno:'success,error' }}" href="{% url schedule_test project.id %}" title="Run Tests">Test</a>
</section>

0 comments on commit d8c04c2

Please sign in to comment.