<s> """<STR_LIT>""" <EOL> import distutils . util <EOL> import platform <EOL> import os <EOL> import sys <EOL> import testoptions <EOL> def path_join ( * args ) : <EOL> "<STR_LIT>" <EOL> return os . path . abspath ( os . path . join ( * args ) ) <EOL> def info ( msg ) : <EOL> "<STR_LIT>" <EOL> sys . stderr . write ( msg + '<STR_LIT:\n>' ) <EOL> def stop ( msg ) : <EOL> "<STR_LIT>" <EOL> info ( msg ) <EOL> sys . exit ( ) <EOL> curr_dir = os . path . dirname ( __file__ ) <EOL> base_dir = path_join ( curr_dir , '<STR_LIT:..>' , '<STR_LIT:..>' ) <EOL> pygr_source_dir = path_join ( base_dir , '<STR_LIT>' ) <EOL> os_info = distutils . util . get_platform ( ) <EOL> version = "<STR_LIT:.>" . join ( [ str ( x ) for x in platform . python_version_tuple ( ) [ : <NUM_LIT:2> ] ] ) <EOL> lib_dir = '<STR_LIT>' % ( os_info , version , ) <EOL> temp_dir = '<STR_LIT>' % ( os_info , version , ) <EOL> pygr_build_dir = path_join ( base_dir , '<STR_LIT>' , lib_dir ) <EOL> pygr_temp_dir = path_join ( base_dir , '<STR_LIT>' , temp_dir ) <EOL> parser = testoptions . option_parser ( ) <EOL> options , args = parser . parse_args ( ) <EOL> use_pathfix = not options . no_pathfix <EOL> path_errmsg = None <EOL> if use_pathfix : <EOL> if options . builddir : <EOL> path_errmsg = "<STR_LIT>" % pygr_build_dir <EOL> sys . path = [ pygr_build_dir ] + sys . path <EOL> required_prefix = pygr_build_dir <EOL> else : <EOL> path_errmsg = "<STR_LIT>" % base_dir <EOL> sys . path = [ base_dir ] + sys . path <EOL> required_prefix = pygr_source_dir <EOL> required_prefix = os . path . realpath ( required_prefix ) <EOL> else : <EOL> path_errmsg = "<STR_LIT>" <EOL> def start_coverage ( ) : <EOL> import figleaf <EOL> from figleaf import annotate_html <EOL> import logging <EOL> root = logging . getLogger ( ) <EOL> for hand in root . handlers : <EOL> root . removeHandler ( hand ) <EOL> figleaf . start ( ) <EOL> if options . coverage : <EOL> start_coverage ( ) <EOL> try : <EOL> import pygr <EOL> from pygr import logger <EOL> logger . info ( "<STR_LIT>" % pygr . __file__ ) <EOL> from pygr import cnestedlist <EOL> except ImportError , exc : <EOL> stop ( """<STR_LIT>""" % ( path_errmsg , exc ) ) <EOL> if use_pathfix : <EOL> for mod in [ pygr , cnestedlist ] : <EOL> if not os . path . realpath ( mod . __file__ ) . startswith ( required_prefix ) : <EOL> stop ( "<STR_LIT>" % ( mod . __name__ , os . path . realpath ( mod . __file__ ) ) ) </s>
