<s> '''<STR_LIT>''' <EOL> from __future__ import absolute_import , division , print_function <EOL> import re <EOL> import os <EOL> import sys <EOL> import shutil <EOL> from os . path import dirname , isdir , join <EOL> import conda . config as cc <EOL> from conda_build . config import config <EOL> PY_TMPL = """<STR_LIT>""" <EOL> bin_dirname = '<STR_LIT>' if sys . platform == '<STR_LIT:win32>' else '<STR_LIT>' <EOL> entry_pat = re . compile ( '<STR_LIT>' ) <EOL> def iter_entry_points ( items ) : <EOL> for item in items : <EOL> m = entry_pat . match ( item ) <EOL> if m is None : <EOL> sys . exit ( "<STR_LIT>" % item ) <EOL> yield m . groups ( ) <EOL> def create_entry_point ( path , module , func ) : <EOL> pyscript = PY_TMPL % { '<STR_LIT>' : module , '<STR_LIT>' : func } <EOL> if sys . platform == '<STR_LIT:win32>' : <EOL> with open ( path + '<STR_LIT>' , '<STR_LIT:w>' ) as fo : <EOL> fo . write ( pyscript ) <EOL> shutil . copyfile ( join ( dirname ( __file__ ) , '<STR_LIT>' % cc . bits ) , <EOL> path + '<STR_LIT>' ) <EOL> else : <EOL> with open ( path , '<STR_LIT:w>' ) as fo : <EOL> fo . write ( '<STR_LIT>' % config . build_python ) <EOL> fo . write ( pyscript ) <EOL> os . chmod ( path , int ( '<STR_LIT>' , <NUM_LIT:8> ) ) <EOL> def create_entry_points ( items ) : <EOL> if not items : <EOL> return <EOL> bin_dir = join ( config . build_prefix , bin_dirname ) <EOL> if not isdir ( bin_dir ) : <EOL> os . mkdir ( bin_dir ) <EOL> for cmd , module , func in iter_entry_points ( items ) : <EOL> create_entry_point ( join ( bin_dir , cmd ) , module , func ) <EOL> def prepend_bin_path ( env , prefix , prepend_prefix = False ) : <EOL> env [ '<STR_LIT>' ] = join ( prefix , bin_dirname ) + os . pathsep + env [ '<STR_LIT>' ] <EOL> if sys . platform == "<STR_LIT:win32>" : <EOL> env [ '<STR_LIT>' ] = join ( prefix , "<STR_LIT>" , "<STR_LIT>" ) + os . pathsep + env [ '<STR_LIT>' ] <EOL> if prepend_prefix : <EOL> env [ '<STR_LIT>' ] = prefix + os . pathsep + env [ '<STR_LIT>' ] <EOL> return env </s>
