Commits

Stan Seibert committed 2bc2bee

Remove CommandError exception and replace with the already existing subprocess.CalledProcessException

Comments (0)

Files changed (1)

shrinkwrap/install.py

         )
 
 
-class CommandError(Exception):
-    '''Exception for when a shell command returns an error code.'''
-    def __init__(self, cmd, return_code):
-        '''
-          cmd: full command string that failed
-          return_code: error code returned to shell
-        '''
-        message = '"%s" returned %d' % (cmd, return_code)
-        self.cmd = cmd
-        self.return_code = return_code
-        Exception.__init__(self, message)
-
-
 class ShrinkwrapInstall(_install.install):
     '''Base class for a setup.py "install" command that wraps a generic tarball installation.'''
     def initialize_options(self):
         return tarball
 
     def shell(self, cmd, success_return_code=0):
-        '''Runs ``cmd`` in a shell.  Raises shrinkwrap.CommandError if the
+        '''Runs ``cmd`` in a shell.  Raises subprocess.CalledProcessError if the
         return code from ``cmd`` is not equal to ``success_return_code``.'''
         log.warn('Executing: ' + cmd)
         ret = subprocess.call('eval $(shrinkwrap activate) && ' + cmd, shell=True, executable='/bin/bash')
         if ret != success_return_code:
-            raise CommandError(cmd, ret)
+            raise CalledProcessError(cmd=cmd, returncode=ret)
 
     def make(self, parallel=True, extra_opts=None):
         '''Run make in current directory.  If ``parallel`` is true,
     #### Main command interface ####
 
     def run(self):
-        '''Base implementation of the run command that install dependencies in
-        before allowing installation to continue.
-
-        Do not override this method, but instead override the install() method.
+        '''setuptools install command that install dependencies in
+        before calling the installer function provided in the shrinkwrap_installer
+        keyword argument to setup().
         '''
         # Install dependencies
         build_deps = getattr(self.distribution, 'shrinkwrap_requires', None)