From 3564dc4b921cfb449a72161bc22b28a0118599b8 Mon Sep 17 00:00:00 2001 From: Iacopo Spalletti Date: Tue, 20 May 2014 22:22:38 +0200 Subject: [PATCH] In case of pip errors while installing, immediately raise exception to provide a better error message to the user. Fix #108. --- djangocms_installer/install/__init__.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/djangocms_installer/install/__init__.py b/djangocms_installer/install/__init__.py index 4f365f2..435cf61 100644 --- a/djangocms_installer/install/__init__.py +++ b/djangocms_installer/install/__init__.py @@ -1,8 +1,9 @@ # -*- coding: utf-8 -*- -import tempfile import os.path import pip +from pip.exceptions import InstallationError +from pip.status_codes import SUCCESS def check_install(config_data): @@ -60,4 +61,7 @@ def requirements(requirements, is_file=False): else: args = ['install', '-q', ] args.extend(requirements.split()) - command = pip.main(args) + exit_status = pip.main(args) + if exit_status != SUCCESS: + raise InstallationError("Error while installing requirements. Check pip log file for error details.") + return True \ No newline at end of file