def wrap_command(cmds, data_dirs, cls, strict=True):
    """Wrap a setup command
    Parameters
    ----------
    cmds: list(str)
        The names of the other commands to run prior to the command.
    strict: boolean, optional
        Wether to raise errors when a pre-command fails.
    """

    class WrappedCommand(cls):

        def run(self):
            if not getattr(self, 'uninstall', None):
                try:
                    [self.run_command(cmd) for cmd in cmds]
                except Exception:
                    if strict:
                        raise
                    else:
                        pass

            result = cls.run(self)
            data_files = []
            for dname in data_dirs:
                data_files.extend(get_data_files(dname))
            # update data-files in case this created new files
            self.distribution.data_files = data_files
            # also update package data
            update_package_data(self.distribution)
            return result

    return WrappedCommand
def wrap_command ( cmds , data_dirs , cls , strict = True ) : class WrappedCommand ( cls ) : def run ( self ) : if not getattr ( self , 'uninstall' , None ) : try : [ self . run_command ( cmd ) for cmd in cmds ] except Exception : if strict : raise else : pass result = cls . run ( self ) data_files = [ ] for dname in data_dirs : data_files . extend ( get_data_files ( dname ) ) self . distribution . data_files = data_files update_package_data ( self . distribution ) return result return WrappedCommand
Wrap a setup command
    Parameters
    ----------
    cmds: list(str)
        The names of the other commands to run prior to the command.
    strict: boolean, optional
        Wether to raise errors when a pre-command fails.