<s> """<STR_LIT>""" <EOL> import TestGyp <EOL> import sys <EOL> if sys . platform == '<STR_LIT:win32>' : <EOL> import pywintypes <EOL> import win32api <EOL> import winerror <EOL> RT_MANIFEST = <NUM_LIT> <EOL> class LoadLibrary ( object ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , path ) : <EOL> self . _path = path <EOL> self . _handle = None <EOL> def __enter__ ( self ) : <EOL> self . _handle = win32api . LoadLibrary ( self . _path ) <EOL> return self . _handle <EOL> def __exit__ ( self , type , value , traceback ) : <EOL> win32api . FreeLibrary ( self . _handle ) <EOL> def extract_manifest ( path , resource_name ) : <EOL> """<STR_LIT>""" <EOL> with LoadLibrary ( path ) as handle : <EOL> try : <EOL> return win32api . LoadResource ( handle , RT_MANIFEST , resource_name ) <EOL> except pywintypes . error as error : <EOL> if error . args [ <NUM_LIT:0> ] == winerror . ERROR_RESOURCE_DATA_NOT_FOUND : <EOL> return None <EOL> else : <EOL> raise <EOL> test = TestGyp . TestGyp ( formats = [ '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> CHDIR = '<STR_LIT>' <EOL> test . run_gyp ( '<STR_LIT>' , chdir = CHDIR ) <EOL> test . build ( '<STR_LIT>' , test . ALL , chdir = CHDIR ) <EOL> test . run_gyp ( '<STR_LIT>' , chdir = CHDIR ) <EOL> test . up_to_date ( '<STR_LIT>' , test . ALL , chdir = CHDIR ) <EOL> def test_manifest ( filename , generate_manifest , embedded_manifest , <EOL> extra_manifest ) : <EOL> exe_file = test . built_file_path ( filename , chdir = CHDIR ) <EOL> if not generate_manifest : <EOL> test . must_not_exist ( exe_file + '<STR_LIT>' ) <EOL> manifest = extract_manifest ( exe_file , <NUM_LIT:1> ) <EOL> test . fail_test ( manifest ) <EOL> return <EOL> if embedded_manifest : <EOL> manifest = extract_manifest ( exe_file , <NUM_LIT:1> ) <EOL> test . fail_test ( not manifest ) <EOL> else : <EOL> test . must_exist ( exe_file + '<STR_LIT>' ) <EOL> manifest = test . read ( exe_file + '<STR_LIT>' ) <EOL> test . fail_test ( not manifest ) <EOL> test . fail_test ( extract_manifest ( exe_file , <NUM_LIT:1> ) ) <EOL> if generate_manifest : <EOL> test . must_contain_any_line ( manifest , '<STR_LIT>' ) <EOL> if extra_manifest : <EOL> test . must_contain_any_line ( manifest , <EOL> '<STR_LIT>' ) <EOL> test . must_contain_any_line ( manifest , <EOL> '<STR_LIT>' ) <EOL> test_manifest ( '<STR_LIT>' , <EOL> generate_manifest = True , <EOL> embedded_manifest = False , <EOL> extra_manifest = False ) <EOL> test_manifest ( '<STR_LIT>' , <EOL> generate_manifest = False , <EOL> embedded_manifest = False , <EOL> extra_manifest = False ) <EOL> test_manifest ( '<STR_LIT>' , <EOL> generate_manifest = True , <EOL> embedded_manifest = False , <EOL> extra_manifest = False ) <EOL> test_manifest ( '<STR_LIT>' , <EOL> generate_manifest = True , <EOL> embedded_manifest = True , <EOL> extra_manifest = False ) <EOL> test_manifest ( '<STR_LIT>' , <EOL> generate_manifest = False , <EOL> embedded_manifest = True , <EOL> extra_manifest = False ) <EOL> test_manifest ( '<STR_LIT>' , <EOL> generate_manifest = True , <EOL> embedded_manifest = True , <EOL> extra_manifest = False ) <EOL> test_manifest ( '<STR_LIT>' , <EOL> generate_manifest = True , <EOL> embedded_manifest = False , <EOL> extra_manifest = True ) <EOL> test_manifest ( '<STR_LIT>' , <EOL> generate_manifest = False , <EOL> embedded_manifest = False , <EOL> extra_manifest = True ) <EOL> test_manifest ( '<STR_LIT>' , <EOL> generate_manifest = True , <EOL> embedded_manifest = False , <EOL> extra_manifest = True ) <EOL> test_manifest ( '<STR_LIT>' , <EOL> generate_manifest = False , <EOL> embedded_manifest = False , <EOL> extra_manifest = True ) <EOL> test_manifest ( '<STR_LIT>' , <EOL> generate_manifest = True , <EOL> embedded_manifest = True , <EOL> extra_manifest = False ) <EOL> test . pass_test ( ) </s>
