<s> """<STR_LIT>""" <EOL> import os <EOL> import sys <EOL> from os . path import join , isfile , getmtime , exists <EOL> import imp <EOL> import platform <EOL> from lib . compile import compile_script <EOL> current_platform = platform . system ( ) . lower ( ) <EOL> if current_platform != '<STR_LIT>' : <EOL> import pwd <EOL> VERSION = '<STR_LIT>' <EOL> MASTER = True <EOL> COPYRIGHT = "<STR_LIT>" <EOL> REPO_URL = "<STR_LIT>" <EOL> MASTER_BRANCH = REPO_URL + "<STR_LIT>" <EOL> REPOSITORY = MASTER_BRANCH if MASTER else REPO_URL + VERSION + "<STR_LIT:/>" <EOL> HOME_DIR = os . path . expanduser ( '<STR_LIT>' ) <EOL> for dir in ( HOME_DIR , os . path . join ( HOME_DIR , '<STR_LIT>' ) , os . path . join ( HOME_DIR , '<STR_LIT>' ) ) : <EOL> if not os . path . exists ( dir ) : <EOL> try : <EOL> os . makedirs ( dir ) <EOL> if ( current_platform != '<STR_LIT>' ) and os . getenv ( "<STR_LIT>" ) : <EOL> pw = pwd . getpwnam ( os . getenv ( "<STR_LIT>" ) ) <EOL> os . chown ( dir , pw . pw_uid , pw . pw_gid ) <EOL> except OSError : <EOL> print "<STR_LIT>" <EOL> raise <EOL> SCRIPT_SEARCH_PATHS = [ <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> os . path . join ( HOME_DIR , '<STR_LIT>' ) , <EOL> ] <EOL> SCRIPT_WRITE_PATH = SCRIPT_SEARCH_PATHS [ - <NUM_LIT:1> ] <EOL> DATA_SEARCH_PATHS = [ <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> os . path . join ( HOME_DIR , '<STR_LIT>' ) , <EOL> ] <EOL> DATA_WRITE_PATH = DATA_SEARCH_PATHS [ - <NUM_LIT:1> ] <EOL> isgui = len ( sys . argv ) == <NUM_LIT:1> or ( ( len ( sys . argv ) > <NUM_LIT:1> and sys . argv [ <NUM_LIT:1> ] == '<STR_LIT>' ) ) <EOL> if current_platform == '<STR_LIT>' and isgui : <EOL> DATA_DIR = os . path . join ( os . path . expanduser ( '<STR_LIT>' ) , '<STR_LIT>' ) <EOL> else : <EOL> DATA_DIR = '<STR_LIT:.>' <EOL> def MODULE_LIST ( force_compile = False ) : <EOL> """<STR_LIT>""" <EOL> modules = [ ] <EOL> for search_path in [ search_path for search_path in SCRIPT_SEARCH_PATHS if exists ( search_path ) ] : <EOL> to_compile = [ <EOL> file for file in os . listdir ( search_path ) if file [ - <NUM_LIT:7> : ] == "<STR_LIT>" and <EOL> file [ <NUM_LIT:0> ] != "<STR_LIT:_>" and ( <EOL> ( not isfile ( join ( search_path , file [ : - <NUM_LIT:7> ] + '<STR_LIT>' ) ) ) or ( <EOL> isfile ( join ( search_path , file [ : - <NUM_LIT:7> ] + '<STR_LIT>' ) ) and ( <EOL> getmtime ( join ( search_path , file [ : - <NUM_LIT:7> ] + '<STR_LIT>' ) ) < getmtime ( <EOL> join ( search_path , file ) ) ) ) or force_compile ) ] <EOL> for script in to_compile : <EOL> script_name = '<STR_LIT:.>' . join ( script . split ( '<STR_LIT:.>' ) [ : - <NUM_LIT:1> ] ) <EOL> compile_script ( join ( search_path , script_name ) ) <EOL> files = [ file for file in os . listdir ( search_path ) <EOL> if file [ - <NUM_LIT:3> : ] == "<STR_LIT>" and file [ <NUM_LIT:0> ] != "<STR_LIT:_>" and <EOL> '<STR_LIT>' in open ( join ( search_path , file ) , '<STR_LIT:r>' ) . readline ( ) . lower ( ) ] <EOL> for script in files : <EOL> script_name = '<STR_LIT:.>' . join ( script . split ( '<STR_LIT:.>' ) [ : - <NUM_LIT:1> ] ) <EOL> file , pathname , desc = imp . find_module ( script_name , [ search_path ] ) <EOL> try : <EOL> new_module = imp . load_module ( script_name , file , pathname , desc ) <EOL> if new_module not in modules : <EOL> new_module . SCRIPT . download <EOL> modules . append ( new_module ) <EOL> except : <EOL> sys . stderr . write ( "<STR_LIT>" % ( script_name , search_path ) ) <EOL> return modules <EOL> def SCRIPT_LIST ( force_compile = False ) : <EOL> return [ module . SCRIPT for module in MODULE_LIST ( force_compile ) ] <EOL> def ENGINE_LIST ( ) : <EOL> from retriever . engines import engine_list <EOL> return engine_list <EOL> def set_proxy ( ) : <EOL> """<STR_LIT>""" <EOL> proxies = [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ] <EOL> for proxy in proxies : <EOL> if os . getenv ( proxy ) : <EOL> if len ( os . environ [ proxy ] ) != <NUM_LIT:0> : <EOL> for i in proxies : <EOL> os . environ [ i ] = os . environ [ proxy ] <EOL> break <EOL> set_proxy ( ) <EOL> sample_script = """<STR_LIT>""" </s>
