<s> import os <EOL> import shutil <EOL> from pybuilder . core import init , task , description , depends , optional <EOL> from pybuilder . pip_utils import get_package_version , version_satisfies_spec , pip_install , as_pip_install_target <EOL> @ init <EOL> def init ( project ) : <EOL> project . set_property ( "<STR_LIT>" , "<STR_LIT:target>" ) <EOL> project . set_property ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> project . set_property ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> def write_report ( file , * content ) : <EOL> with open ( project . expand_path ( "<STR_LIT>" , file ) , "<STR_LIT:w>" ) as report_file : <EOL> report_file . writelines ( content ) <EOL> project . write_report = write_report <EOL> @ task <EOL> @ description ( "<STR_LIT>" ) <EOL> def clean ( project , logger ) : <EOL> target_directory = project . expand_path ( "<STR_LIT>" ) <EOL> logger . info ( "<STR_LIT>" , target_directory ) <EOL> shutil . rmtree ( target_directory , ignore_errors = True ) <EOL> @ task <EOL> @ description ( "<STR_LIT>" ) <EOL> def prepare ( project , logger ) : <EOL> target_directory = project . expand_path ( "<STR_LIT>" ) <EOL> if not os . path . exists ( target_directory ) : <EOL> logger . debug ( "<STR_LIT>" , target_directory ) <EOL> os . mkdir ( target_directory ) <EOL> reports_directory = project . expand_path ( "<STR_LIT>" ) <EOL> if not os . path . exists ( reports_directory ) : <EOL> logger . debug ( "<STR_LIT>" , reports_directory ) <EOL> os . mkdir ( reports_directory ) <EOL> plugin_dependency_versions = get_package_version ( project . plugin_dependencies , logger ) <EOL> for plugin_dependency in project . plugin_dependencies : <EOL> logger . debug ( "<STR_LIT>" % plugin_dependency ) <EOL> if plugin_dependency . name . lower ( ) not in plugin_dependency_versions or not version_satisfies_spec ( plugin_dependency . version , <EOL> plugin_dependency_versions [ plugin_dependency . name . lower ( ) ] ) : <EOL> logger . info ( "<STR_LIT>" % plugin_dependency ) <EOL> log_file = project . expand_path ( "<STR_LIT>" , "<STR_LIT>" % plugin_dependency ) <EOL> pip_install ( as_pip_install_target ( plugin_dependency ) , <EOL> index_url = project . get_property ( "<STR_LIT>" ) , <EOL> extra_index_url = project . get_property ( "<STR_LIT>" ) , <EOL> verbose = project . get_property ( "<STR_LIT>" ) , logger = logger , <EOL> force_reinstall = plugin_dependency . url is not None , outfile_name = log_file , <EOL> error_file_name = log_file ) <EOL> @ task <EOL> @ depends ( prepare ) <EOL> @ description ( "<STR_LIT>" ) <EOL> def compile_sources ( ) : <EOL> pass <EOL> @ task <EOL> @ depends ( compile_sources ) <EOL> @ description ( "<STR_LIT>" ) <EOL> def run_unit_tests ( ) : <EOL> pass <EOL> @ task <EOL> @ depends ( compile_sources , optional ( run_unit_tests ) ) <EOL> @ description ( "<STR_LIT>" ) <EOL> def package ( ) : <EOL> pass <EOL> @ task <EOL> @ depends ( package ) <EOL> @ description ( "<STR_LIT>" ) <EOL> def run_integration_tests ( ) : <EOL> pass <EOL> @ task <EOL> @ depends ( run_integration_tests ) <EOL> @ description ( "<STR_LIT>" ) <EOL> def verify ( ) : <EOL> pass <EOL> @ task <EOL> @ depends ( package , optional ( verify ) ) <EOL> @ description ( "<STR_LIT>" ) <EOL> def publish ( ) : <EOL> pass <EOL> @ task <EOL> @ depends ( package , optional ( publish ) ) <EOL> @ description ( "<STR_LIT>" ) <EOL> def install ( ) : <EOL> pass <EOL> @ task ( description = "<STR_LIT>" ) <EOL> def print_module_path ( project ) : <EOL> print ( project . expand_path ( "<STR_LIT>" ) ) <EOL> @ task ( description = "<STR_LIT>" ) <EOL> def print_scripts_path ( project ) : <EOL> print ( project . expand_path ( "<STR_LIT>" ) ) </s>
