<s> import logging <EOL> from os . path import exists <EOL> from plumbum import local <EOL> from plumbum . cmd import git <EOL> from plumbum . commands import CommandNotFound <EOL> from changes import attributes , exceptions <EOL> log = logging . getLogger ( __name__ ) <EOL> TOOLS = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> TEST_RUNNERS = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> README_EXTENSIONS = [ <EOL> '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' <EOL> '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' <EOL> ] <EOL> def report_and_raise ( probe_name , probe_result , failure_msg ) : <EOL> """<STR_LIT>""" <EOL> log . info ( '<STR_LIT>' % ( probe_name , probe_result ) ) <EOL> if not probe_result : <EOL> raise exceptions . ProbeException ( failure_msg ) <EOL> else : <EOL> return True <EOL> def has_setup ( ) : <EOL> """<STR_LIT>""" <EOL> return report_and_raise ( <EOL> '<STR_LIT>' , <EOL> exists ( '<STR_LIT>' ) , <EOL> '<STR_LIT>' <EOL> ) <EOL> def has_binary ( command ) : <EOL> try : <EOL> local . which ( command ) <EOL> return True <EOL> except CommandNotFound : <EOL> log . info ( '<STR_LIT>' % command ) <EOL> return False <EOL> def has_tools ( ) : <EOL> return any ( [ has_binary ( tool ) for tool in TOOLS ] ) <EOL> def has_test_runner ( ) : <EOL> return any ( [ has_binary ( runner ) for runner in TEST_RUNNERS ] ) <EOL> def has_changelog ( ) : <EOL> """<STR_LIT>""" <EOL> return report_and_raise ( <EOL> '<STR_LIT>' , <EOL> exists ( '<STR_LIT>' ) , <EOL> '<STR_LIT>' <EOL> ) <EOL> def has_readme ( ) : <EOL> """<STR_LIT>""" <EOL> return report_and_raise ( <EOL> '<STR_LIT>' , <EOL> any ( [ exists ( '<STR_LIT>' . format ( ext ) ) for ext in README_EXTENSIONS ] ) , <EOL> '<STR_LIT>' <EOL> ) <EOL> def has_metadata ( context ) : <EOL> """<STR_LIT>""" <EOL> init_path = '<STR_LIT>' % context . module_name <EOL> has_metadata = ( <EOL> exists ( init_path ) and <EOL> attributes . has_attribute ( context . module_name , '<STR_LIT>' ) and <EOL> attributes . has_attribute ( context . module_name , '<STR_LIT>' ) <EOL> ) <EOL> return report_and_raise ( <EOL> '<STR_LIT>' , <EOL> has_metadata , <EOL> '<STR_LIT>' <EOL> ) <EOL> def has_signing_key ( context ) : <EOL> return '<STR_LIT>' in git ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> def probe_project ( context ) : <EOL> """<STR_LIT>""" <EOL> log . info ( '<STR_LIT>' ) <EOL> return ( <EOL> has_tools ( ) and has_setup ( ) and has_metadata ( context ) and <EOL> has_test_runner ( ) and has_readme ( ) and has_changelog ( ) <EOL> ) </s>
