Ejemplo n.º 1
0
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

    if platform.system() == "Windows":
        dll = install_dir + '/bin/tesseract41.dll'
        lib = install_dir + '/lib/tesseract41.lib'
        if not os.path.exists(dll) or not os.path.exists(lib):
            return False
        c.symlink(dll, install_dir + '/bin/tesseract.dll')
        c.symlink(lib, install_dir + '/lib/tesseract.lib')
    elif platform.system() == "Darwin":
        lib = install_dir + '/lib/libtesseract.4.1.1.dylib'
        if not os.path.exists(lib):
            return False
        c.symlink(lib, install_dir + '/lib/libtesseract.dylib')
    else:
        if not os.path.exists(install_dir + '/lib/libtesseract.so'):
            return False

    includes_path = install_dir + '/include/tesseract'
    if len(c.get_folder_files(includes_path)) == 0:
        return False

    return True
Ejemplo n.º 2
0
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

    if platform.system() == "Windows":
        dll = install_dir + '/bin/hunspell.dll'
        lib = install_dir + '/lib/hunspell.lib'
        if not os.path.exists(dll) or not os.path.exists(lib):
            return False
    elif platform.system() == "Darwin":
        lib = install_dir + '/lib/libhunspell.1.7.0.dylib'
        if not os.path.exists(lib):
            return False
        c.symlink(lib, install_dir + '/lib/libhunspell.dylib')
    else:
        lib = install_dir + '/lib/libhunspell-1.7.so'
        if not os.path.exists(lib):
            return False
        c.symlink(lib, install_dir + '/lib/libhunspell.so')

    includes_path = install_dir + '/include/hunspell'
    if len(c.get_folder_files(includes_path)) == 0:
        return False

    version_file = install_dir + '/lib/pkgconfig/hunspell.pc'
    if not os.path.exists(version_file):
        return False

    with open(version_file, 'rt') as f:
        lines = f.readlines()
        for l in lines:
            if not l.startswith('Version'):
                continue
            existing_version = l[9:14]  # Version: 1.7.0
            if existing_version != required_version:
                return False
            break
    return True
Ejemplo n.º 3
0
def check_existing():
    includes_path = install_dir + '/include/tesseract'
    if len(c.get_folder_files(includes_path)) == 0:
        return False

    if platform.system() == "Windows":
        lib = install_dir + '/bin/tesseract{}.dll'.format(lib_suffix)
        orig_lib = install_dir + '/bin/tesseract41.dll'
    elif platform.system() == "Darwin":
        lib = install_dir + '/lib/libtesseract{}.dylib'.format(lib_suffix)
        orig_lib = install_dir + '/lib/libtesseract.4.1.1.dylib'
    else:
        lib = install_dir + '/lib/libtesseract{}.so'.format(lib_suffix)
        orig_lib = install_dir + '/lib/libtesseract.so.4.1.1'

    if os.path.exists(lib):
        return True
    if os.path.exists(orig_lib):
        os.rename(orig_lib, lib)
        return True

    return False
Ejemplo n.º 4
0
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

    if platform.system() == "Windows":
        dll = install_dir + '/bin/leptonica-1.78.0.dll'
        lib = install_dir + '/lib/leptonica-1.78.0.lib'
        if not os.path.exists(dll) or not os.path.exists(lib):
            return False
        c.symlink(dll, install_dir + '/bin/leptonica.dll')
        c.symlink(lib, install_dir + '/lib/leptonica.lib')
    elif platform.system() == "Darwin":
        lib = install_dir + '/lib/libleptonica.1.78.0.dylib'
        if not os.path.exists(lib):
            return False
        c.symlink(lib, install_dir + '/lib/libleptonica.dylib')
    else:
        if not os.path.exists(install_dir + '/lib/libleptonica.so'):
            return False

    includes_path = install_dir + '/include/leptonica'
    if len(c.get_folder_files(includes_path)) == 0:
        return False

    version_file = install_dir + '/cmake/LeptonicaConfig-version.cmake'
    if not os.path.exists(version_file):
        return False

    with open(version_file, 'rt') as f:
        existing_version = f.readline()[22:28]  # set(Leptonica_VERSION 1.78.0)
        if existing_version != required_version:
            return False
    return True
Ejemplo n.º 5
0
vcredist_for_ssl_url = ''
vcredist_for_ssl_file = ''
if bitness == '32':
    vcredist_for_ssl_url = 'https://download.microsoft.com/download/C/6/D/C6D0FD4E-9E53-4897-9B91-836EBA2AACD3/vcredist_x86.exe'
    vcredist_for_ssl_file = 'vc_redist.x86.2010.exe'
else:
    vcredist_for_ssl_url = 'https://download.microsoft.com/download/A/8/0/A80747C3-41BD-45DF-B505-E9710D2744E0/vcredist_x64.exe'
    vcredist_for_ssl_file = 'vc_redist.x64.2010.exe'

c.download(vcredist_for_ssl_url,
           os.path.join(install_dir, vcredist_for_ssl_file))

libs_dir = os.path.join(dependencies_dir, 'bin')
for file in os.scandir(libs_dir):
    if file.is_file(follow_symlinks=False) and file.name.endswith('.dll'):
        full_name = os.path.join(libs_dir, file.name)
        c.print('>> Copying {} to {}'.format(full_name, install_dir))
        shutil.copy(full_name, install_dir)

for f in glob(ssl_dir + '/bin/*.dll'):
    c.print('>> Copying {} to {}'.format(f, install_dir))
    shutil.copy(f, install_dir)

open(os.path.join(install_dir, 'qt.conf'),
     'a').close()  # fix for non-latin paths

c.archive(c.get_folder_files(os.path.relpath(install_dir)), artifact_path)

bin_path = install_dir + '\\' + bin_name + '.exe'
c.print('>> Md5 {} {}'.format(bin_path, c.md5sum(bin_path)))