<s> from jig . exc import PluginError <EOL> from jig . plugins import ( <EOL> get_jigconfig , set_jigconfig , PluginManager ) <EOL> from jig . plugins . tools import read_plugin_list <EOL> from jig . commands . base import BaseCommand , add_plugin <EOL> from jig . commands . hints import USE_RUNNOW <EOL> try : <EOL> import argparse <EOL> except ImportError : <EOL> from backports import argparse <EOL> _parser = argparse . ArgumentParser ( <EOL> description = '<STR_LIT>' , <EOL> usage = '<STR_LIT>' ) <EOL> _parser . add_argument ( <EOL> '<STR_LIT>' , '<STR_LIT>' , default = '<STR_LIT:.>' , dest = '<STR_LIT:path>' , <EOL> help = '<STR_LIT>' ) <EOL> _parser . add_argument ( <EOL> '<STR_LIT>' , <EOL> help = '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> class InstallCommandMixin ( object ) : <EOL> """<STR_LIT>""" <EOL> def install_plugins_file ( self , plugins_file , path , hints = True ) : <EOL> with self . out ( ) as printer : <EOL> try : <EOL> plugin_list = read_plugin_list ( plugins_file ) <EOL> except IOError as e : <EOL> raise PluginError ( e [ <NUM_LIT:1> ] ) <EOL> for plugin in plugin_list : <EOL> config = get_jigconfig ( path ) <EOL> pm = PluginManager ( config ) <EOL> try : <EOL> added = add_plugin ( pm , plugin , path ) <EOL> except Exception as e : <EOL> printer ( <EOL> '<STR_LIT>' . format ( <EOL> plugin , e ) ) <EOL> continue <EOL> set_jigconfig ( path , pm . config ) <EOL> printer ( '<STR_LIT>' . format ( plugin ) ) <EOL> for p in added : <EOL> printer ( <EOL> '<STR_LIT>' . format ( <EOL> p . name , p . bundle ) ) <EOL> if hints : <EOL> printer ( USE_RUNNOW ) <EOL> class Command ( BaseCommand , InstallCommandMixin ) : <EOL> parser = _parser <EOL> def process ( self , argv ) : <EOL> path = argv . path <EOL> plugins_file = argv . pluginsfile <EOL> self . install_plugins_file ( plugins_file , path ) </s>
