<s> """<STR_LIT>""" <EOL> import os <EOL> import shutil <EOL> import stat <EOL> import sys <EOL> from spyder . core . settings import Settings <EOL> from spyder . thrift . gen . ttypes import CrawlUri <EOL> __version__ = '<STR_LIT>' <EOL> def copy_skeleton_dir ( destination ) : <EOL> """<STR_LIT>""" <EOL> if not os . path . exists ( destination ) : <EOL> os . makedirs ( destination ) <EOL> template_dir = os . path . join ( __path__ [ <NUM_LIT:0> ] , '<STR_LIT>' ) <EOL> wanted_files = [ "<STR_LIT>" , "<STR_LIT>" ] <EOL> for root , subdirs , files in os . walk ( template_dir ) : <EOL> relative = root [ len ( template_dir ) + <NUM_LIT:1> : ] <EOL> if relative : <EOL> os . mkdir ( os . path . join ( destination , relative ) ) <EOL> for subdir in subdirs : <EOL> if subdir . startswith ( '<STR_LIT:.>' ) : <EOL> subdirs . remove ( subdir ) <EOL> for filename in files : <EOL> if ( not filename . endswith ( '<STR_LIT>' ) and filename not in wanted_files ) or filename == "<STR_LIT>" : <EOL> continue <EOL> path_old = os . path . join ( root , filename ) <EOL> path_new = os . path . join ( destination , relative , filename ) <EOL> fp_old = open ( path_old , '<STR_LIT:r>' ) <EOL> fp_new = open ( path_new , '<STR_LIT:w>' ) <EOL> fp_new . write ( fp_old . read ( ) ) <EOL> fp_old . close ( ) <EOL> fp_new . close ( ) <EOL> try : <EOL> shutil . copymode ( path_old , path_new ) <EOL> if sys . platform . startswith ( '<STR_LIT>' ) : <EOL> return <EOL> if not os . access ( path_new , os . W_OK ) : <EOL> st_new = os . stat ( path_new ) <EOL> new_perm = stat . S_IMODE ( st_new . st_mode ) | stat . S_IWUSR <EOL> os . chmod ( path_new , new_perm ) <EOL> except OSError : <EOL> sys . stderr . write ( "<STR_LIT>" % <EOL> path_new ) <EOL> def spyder_admin_main ( ) : <EOL> """<STR_LIT>""" <EOL> if len ( sys . argv ) != <NUM_LIT:2> or "<STR_LIT:start>" != sys . argv [ <NUM_LIT:1> ] : <EOL> sys . stderr . write ( <EOL> """<STR_LIT>""" ) <EOL> sys . exit ( <NUM_LIT:1> ) <EOL> copy_skeleton_dir ( os . getcwd ( ) ) <EOL> def spyder_management ( settings ) : <EOL> """<STR_LIT>""" <EOL> from spyder import logsink <EOL> import spyder . workerprocess as worker <EOL> import spyder . masterprocess as master <EOL> effective_settings = Settings ( settings ) <EOL> args = [ a . lower ( ) for a in sys . argv ] <EOL> if "<STR_LIT>" in args : <EOL> args . remove ( "<STR_LIT>" ) <EOL> master . main ( effective_settings ) <EOL> elif "<STR_LIT>" in args : <EOL> worker . main ( effective_settings ) <EOL> elif "<STR_LIT>" in args : <EOL> logsink . main ( effective_settings ) <EOL> else : <EOL> print >> sys . stderr , """<STR_LIT>""" <EOL> sys . exit ( <NUM_LIT:1> ) </s>
