<s> '''<STR_LIT>''' <EOL> import os . path as osp <EOL> from waflib . TaskGen import feature <EOL> import waflib . Logs as msg <EOL> from orch . util import urlopen , get_unpacker <EOL> from orch . wafutil import exec_command <EOL> import orch . features <EOL> orch . features . register_defaults ( <EOL> '<STR_LIT>' , <EOL> source_urlfile = '<STR_LIT>' , <EOL> source_unpacked = '<STR_LIT>' , <EOL> source_unpacked_path = '<STR_LIT>' , <EOL> unpacked_target = '<STR_LIT>' , <EOL> source_unpacked_target = '<STR_LIT>' , <EOL> vcs_flavor = '<STR_LIT>' , <EOL> vcs_tag = '<STR_LIT>' , <EOL> vcs_module = '<STR_LIT>' , <EOL> ) <EOL> def single_cmd_rule ( func ) : <EOL> def rule ( tgen ) : <EOL> def task_func ( task ) : <EOL> cmd = func ( tgen ) <EOL> return exec_command ( task , cmd ) <EOL> tgen . step ( '<STR_LIT>' , <EOL> rule = task_func , <EOL> source = tgen . worch . source_urlfile , <EOL> target = tgen . worch . source_unpacked_target ) <EOL> return rule <EOL> @ single_cmd_rule <EOL> def do_cvs ( tgen ) : <EOL> tag = tgen . worch . get ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> if tag : <EOL> tag = '<STR_LIT>' + tag <EOL> module = tgen . worch . get ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> if not module : <EOL> module = tgen . worch . package <EOL> pat = '<STR_LIT>' <EOL> return tgen . worch . format ( pat , vcs_tag_opt = tag , module = module ) <EOL> @ single_cmd_rule <EOL> def do_svn ( tgen ) : <EOL> if tgen . worch . get ( '<STR_LIT>' ) : <EOL> err = tgen . worch . format ( '<STR_LIT>' ) <EOL> msg . error ( err ) <EOL> raise ValueError ( err ) <EOL> pat = "<STR_LIT>" <EOL> return tgen . worch . format ( pat ) <EOL> @ single_cmd_rule <EOL> def do_hg ( tgen ) : <EOL> tag = tgen . worch . get ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> if tag : <EOL> tag = '<STR_LIT>' + tag <EOL> pat = "<STR_LIT>" <EOL> return tgen . worch . format ( pat , vcs_tag_opt = tag ) <EOL> def do_git ( tgen ) : <EOL> git_dir = tgen . make_node ( tgen . worch . format ( '<STR_LIT>' ) ) <EOL> if osp . exists ( git_dir . abspath ( ) ) : <EOL> clone_or_update = '<STR_LIT>' <EOL> else : <EOL> clone_or_update = '<STR_LIT>' <EOL> clone_or_update = tgen . worch . format ( clone_or_update , git_dir = git_dir . abspath ( ) ) <EOL> tgen . step ( '<STR_LIT>' , <EOL> rule = clone_or_update , <EOL> source = tgen . worch . source_urlfile , <EOL> target = git_dir ) <EOL> checkout = '<STR_LIT>' <EOL> checkout += '<STR_LIT>' <EOL> checkout += '<STR_LIT:U+0020>' + getattr ( tgen . worch , '<STR_LIT>' , '<STR_LIT>' ) <EOL> checkout += '<STR_LIT>' <EOL> checkout = tgen . worch . format ( checkout , git_dir = git_dir . abspath ( ) ) <EOL> tgen . step ( '<STR_LIT>' , <EOL> rule = checkout , <EOL> source = tgen . control_node ( '<STR_LIT>' ) , <EOL> target = tgen . worch . source_unpacked_target ) <EOL> @ feature ( '<STR_LIT>' ) <EOL> def feature_vcs ( tgen ) : <EOL> tgen . step ( '<STR_LIT>' , <EOL> rule = "<STR_LIT>" % ( tgen . worch . source_url , tgen . worch . source_urlfile ) , <EOL> update_outputs = True , <EOL> target = tgen . worch . source_urlfile ) <EOL> flavor = tgen . worch . vcs_flavor <EOL> doer = eval ( '<STR_LIT>' % flavor ) <EOL> doer ( tgen ) <EOL> return </s>
