<s> import os <EOL> import sys <EOL> try : <EOL> import ConfigParser as configparser <EOL> except ImportError : <EOL> import configparser <EOL> def split_multiline ( value ) : <EOL> value = [ element for element in <EOL> ( line . strip ( ) for line in value . split ( '<STR_LIT:\n>' ) ) <EOL> if element ] <EOL> return value <EOL> def get_entry_points ( config ) : <EOL> if '<STR_LIT>' not in config : <EOL> return { } <EOL> return dict ( ( option , split_multiline ( value ) ) <EOL> for option , value in config [ '<STR_LIT>' ] . items ( ) ) <EOL> def make ( cfg , dest ) : <EOL> parser = configparser . RawConfigParser ( ) <EOL> parser . read ( cfg ) <EOL> config = { } <EOL> for section in parser . sections ( ) : <EOL> config [ section ] = dict ( parser . items ( section ) ) <EOL> entry_points = get_entry_points ( config ) <EOL> console_scripts = entry_points . get ( '<STR_LIT>' ) <EOL> if console_scripts : <EOL> for item in console_scripts : <EOL> tool = item . split ( '<STR_LIT:=>' ) [ <NUM_LIT:0> ] . strip ( ) <EOL> print ( '<STR_LIT>' % tool ) <EOL> os . system ( '<STR_LIT>' % <EOL> dict ( tool = tool , dest = dest ) ) <EOL> if len ( sys . argv ) < <NUM_LIT:2> : <EOL> print ( '<STR_LIT>' ) <EOL> sys . exit ( <NUM_LIT:1> ) <EOL> print ( '<STR_LIT>' ) <EOL> make ( cfg = '<STR_LIT>' , dest = sys . argv [ <NUM_LIT:1> ] ) </s>
