<s> """<STR_LIT>""" <EOL> import os <EOL> import shutil <EOL> import sys <EOL> import tempfile <EOL> from optparse import OptionParser <EOL> tmpeggs = tempfile . mkdtemp ( ) <EOL> usage = '''<STR_LIT>''' <EOL> parser = OptionParser ( usage = usage ) <EOL> parser . add_option ( "<STR_LIT>" , "<STR_LIT>" , help = "<STR_LIT>" ) <EOL> parser . add_option ( "<STR_LIT>" , "<STR_LIT>" , <EOL> dest = '<STR_LIT>' , <EOL> action = "<STR_LIT:store_true>" , default = False , <EOL> help = ( "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) ) <EOL> parser . add_option ( "<STR_LIT:-c>" , "<STR_LIT>" , <EOL> help = ( "<STR_LIT>" <EOL> "<STR_LIT>" ) ) <EOL> parser . add_option ( "<STR_LIT>" , "<STR_LIT>" , <EOL> help = ( "<STR_LIT>" ) ) <EOL> options , args = parser . parse_args ( ) <EOL> to_reload = False <EOL> try : <EOL> import pkg_resources <EOL> import setuptools <EOL> except ImportError : <EOL> ez = { } <EOL> try : <EOL> from urllib . request import urlopen <EOL> except ImportError : <EOL> from urllib2 import urlopen <EOL> exec ( urlopen ( '<STR_LIT>' ) . read ( ) , ez ) <EOL> setup_args = dict ( to_dir = tmpeggs , download_delay = <NUM_LIT:0> ) <EOL> ez [ '<STR_LIT>' ] ( ** setup_args ) <EOL> if to_reload : <EOL> reload ( pkg_resources ) <EOL> import pkg_resources <EOL> for path in sys . path : <EOL> if path not in pkg_resources . working_set . entries : <EOL> pkg_resources . working_set . add_entry ( path ) <EOL> ws = pkg_resources . working_set <EOL> cmd = [ sys . executable , '<STR_LIT:-c>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , tmpeggs ] <EOL> find_links = os . environ . get ( <EOL> '<STR_LIT>' , <EOL> options . find_links or <EOL> ( '<STR_LIT>' <EOL> if options . accept_buildout_test_releases else None ) <EOL> ) <EOL> if find_links : <EOL> cmd . extend ( [ '<STR_LIT>' , find_links ] ) <EOL> setuptools_path = ws . find ( <EOL> pkg_resources . Requirement . parse ( '<STR_LIT>' ) ) . location <EOL> requirement = '<STR_LIT>' <EOL> version = options . version <EOL> if version is None and not options . accept_buildout_test_releases : <EOL> import setuptools . package_index <EOL> _final_parts = '<STR_LIT>' , '<STR_LIT>' <EOL> def _final_version ( parsed_version ) : <EOL> for part in parsed_version : <EOL> if ( part [ : <NUM_LIT:1> ] == '<STR_LIT:*>' ) and ( part not in _final_parts ) : <EOL> return False <EOL> return True <EOL> index = setuptools . package_index . PackageIndex ( <EOL> search_path = [ setuptools_path ] ) <EOL> if find_links : <EOL> index . add_find_links ( ( find_links , ) ) <EOL> req = pkg_resources . Requirement . parse ( requirement ) <EOL> if index . obtain ( req ) is not None : <EOL> best = [ ] <EOL> bestv = None <EOL> for dist in index [ req . project_name ] : <EOL> distv = dist . parsed_version <EOL> if _final_version ( distv ) : <EOL> if bestv is None or distv > bestv : <EOL> best = [ dist ] <EOL> bestv = distv <EOL> elif distv == bestv : <EOL> best . append ( dist ) <EOL> if best : <EOL> best . sort ( ) <EOL> version = best [ - <NUM_LIT:1> ] . version <EOL> if version : <EOL> requirement = '<STR_LIT>' . join ( ( requirement , version ) ) <EOL> cmd . append ( requirement ) <EOL> import subprocess <EOL> if subprocess . call ( cmd , env = dict ( os . environ , PYTHONPATH = setuptools_path ) ) != <NUM_LIT:0> : <EOL> raise Exception ( <EOL> "<STR_LIT>" , <EOL> repr ( cmd ) [ <NUM_LIT:1> : - <NUM_LIT:1> ] ) <EOL> ws . add_entry ( tmpeggs ) <EOL> ws . require ( requirement ) <EOL> import zc . buildout . buildout <EOL> if not [ a for a in args if '<STR_LIT:=>' not in a ] : <EOL> args . append ( '<STR_LIT>' ) <EOL> if options . config_file is not None : <EOL> args [ <NUM_LIT:0> : <NUM_LIT:0> ] = [ '<STR_LIT:-c>' , options . config_file ] <EOL> zc . buildout . buildout . main ( args ) <EOL> shutil . rmtree ( tmpeggs ) </s>
