Add file to store cached tesseract version in ci
This commit is contained in:
		
							parent
							
								
									5581f385ae
								
							
						
					
					
						commit
						ff041facd8
					
				@ -37,8 +37,17 @@ lib_suffix = os.environ.get('TAG', '')
 | 
				
			|||||||
if len(lib_suffix) > 0:
 | 
					if len(lib_suffix) > 0:
 | 
				
			||||||
    lib_suffix = '-' + lib_suffix
 | 
					    lib_suffix = '-' + lib_suffix
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					cache_file = install_dir + '/tesseract{}.cache'.format(lib_suffix)
 | 
				
			||||||
 | 
					cache_file_data = required_version + build_type_flag
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def check_existing():
 | 
					def check_existing():
 | 
				
			||||||
 | 
					    if not os.path.exists(cache_file):
 | 
				
			||||||
 | 
					        return False
 | 
				
			||||||
 | 
					    with open(cache_file, 'r') as f:
 | 
				
			||||||
 | 
					        cached = f.read()
 | 
				
			||||||
 | 
					        if cached != cache_file_data:
 | 
				
			||||||
 | 
					            return False
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    includes_path = install_dir + '/include/tesseract'
 | 
					    includes_path = install_dir + '/include/tesseract'
 | 
				
			||||||
    if len(c.get_folder_files(includes_path)) == 0:
 | 
					    if len(c.get_folder_files(includes_path)) == 0:
 | 
				
			||||||
        return False
 | 
					        return False
 | 
				
			||||||
@ -128,6 +137,9 @@ if len(compat_flags) > 0:
 | 
				
			|||||||
c.run('cmake --build . --config {}'.format(build_type_flag))
 | 
					c.run('cmake --build . --config {}'.format(build_type_flag))
 | 
				
			||||||
c.run('cmake --build . --target install --config {}'.format(build_type_flag))
 | 
					c.run('cmake --build . --target install --config {}'.format(build_type_flag))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					with open(cache_file, 'w') as f:
 | 
				
			||||||
 | 
					    f.write(cache_file_data)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if not check_existing():  # add suffix
 | 
					if not check_existing():  # add suffix
 | 
				
			||||||
    c.print('>> Build failed')
 | 
					    c.print('>> Build failed')
 | 
				
			||||||
    exit(1)
 | 
					    exit(1)
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user