<s> import sys <EOL> import os <EOL> from bento . core import PackageDescription <EOL> from bento . utils . utils import pprint , MODE_755 <EOL> from bento . core . node import create_root_with_source_tree <EOL> from bento . commands . script_utils import create_posix_script , create_win32_script <EOL> root = create_root_with_source_tree ( os . getcwd ( ) , os . path . join ( os . getcwd ( ) , "<STR_LIT>" ) ) <EOL> def _create_executable ( name , executable , scripts_node ) : <EOL> if sys . platform == "<STR_LIT:win32>" : <EOL> nodes = create_win32_script ( name , executable , scripts_node ) <EOL> else : <EOL> nodes = create_posix_script ( name , executable , scripts_node ) <EOL> for n in nodes : <EOL> n . chmod ( MODE_755 ) <EOL> return nodes <EOL> def install_inplace ( pkg ) : <EOL> """<STR_LIT>""" <EOL> for basename , executable in pkg . executables . items ( ) : <EOL> version_str = "<STR_LIT:.>" . join ( [ str ( i ) for i in sys . version_info [ : <NUM_LIT:2> ] ] ) <EOL> scripts_node = root . _ctx . srcnode <EOL> for name in [ basename , "<STR_LIT>" % ( basename , version_str ) ] : <EOL> nodes = _create_executable ( name , executable , scripts_node ) <EOL> installed = "<STR_LIT:U+002C>" . join ( [ n . path_from ( scripts_node ) for n in nodes ] ) <EOL> pprint ( "<STR_LIT>" , "<STR_LIT>" % installed ) <EOL> def main ( ) : <EOL> pkg = PackageDescription . from_file ( "<STR_LIT>" ) <EOL> if pkg . executables : <EOL> install_inplace ( pkg ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> main ( ) </s>
