Пример #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/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
Пример #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/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
Пример #3
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
Пример #4
0
    if len(c.get_folder_files(includes_path)) == 0:
        return False

    return True


if check_existing() and not 'FORCE' in os.environ:
    c.print('>> Using cached')
    exit(0)

archive = 'tesseract-' + os.path.basename(url)
c.download(url, archive)

src_dir = os.path.abspath('tesseract_src')
c.extract(archive, '.')
c.symlink(c.get_archive_top_dir(archive), src_dir)

c.ensure_got_path(install_dir)

c.recreate_dir(build_dir)
os.chdir(build_dir)

cmake_args = '"{0}" -DCMAKE_INSTALL_PREFIX="{1}" -DLeptonica_DIR="{1}/cmake" \
-DBUILD_TRAINING_TOOLS=OFF -DBUILD_TESTS=OFF'.format(src_dir, install_dir)

if platform.system() == "Windows":
    env_cmd = c.get_msvc_env_cmd(bitness=bitness, msvc_version=msvc_version)
    c.apply_cmd_env(env_cmd)
    cmake_args += ' ' + c.get_cmake_arch_args(bitness=bitness)

c.set_make_threaded()
Пример #5
0
    exit(0)
artifact_path = os.path.abspath(artifact_name)

c.print('>> Making appimage')

base_url = 'https://github.com/probonopd/linuxdeployqt/releases/download'
continuous_url = base_url + '/continuous/linuxdeployqt-continuous-x86_64.AppImage'
tagged_url = base_url + '/6/linuxdeployqt-6-x86_64.AppImage'
linuxdeployqt_url = tagged_url
linuxdeployqt_original = os.path.basename(linuxdeployqt_url)

c.download(linuxdeployqt_url, linuxdeployqt_original)
c.run('chmod a+x {}'.format(linuxdeployqt_original))

linuxdeployqt_bin = os.path.abspath('linuxdeployqt')
c.symlink(linuxdeployqt_original, linuxdeployqt_bin)

os.chdir(build_dir)

install_dir = os.path.abspath('appdir')
c.recreate_dir(install_dir)
c.run('make INSTALL_ROOT={0} DESTDIR={0} install'.format(install_dir))

if c.is_inside_docker():
    c.run('{}  --appimage-extract'.format(linuxdeployqt_bin))
    linuxdeployqt_bin = os.path.abspath('squashfs-root/AppRun')

os.environ['LD_LIBRARY_PATH'] = dependencies_dir + '/lib'
os.environ['VERSION'] = app_version
# debug flags: -unsupported-bundle-everything -unsupported-allow-new-glibc
flags = '' if os.getenv("DEBUG") is None else '-unsupported-allow-new-glibc'
Пример #6
0
c.download(base_url + '/' + src_archive, src_archive)
c.extract(src_archive, '.')

if os_name == 'linux':
    os_url = get_linux_url(qtc_main_version)
elif os_name == 'win32_msvc':
    os_url = get_windows_url(32, qtc_main_version)
elif os_name == 'win64_msvc':
    os_url = get_windows_url(64, qtc_main_version)
elif os_name == 'macos':
    os_url = 'mac_x64'

if os_name == 'macos':
    c.print('>> Workaround')
    shutil.rmtree(
        qtc_dir +
        '/src/shared/qbs/examples/cocoa-application/CocoaApplication/en_US.lproj',
        ignore_errors=True)

for archive in ['qtcreator.7z', 'qtcreator_dev.7z']:
    url = base_url + '/installer_source/{}/{}'.format(os_url, archive)
    c.download(url, archive)
    c.extract(archive, qtc_dir)

c.symlink(qtc_dir, 'qtcreator')

if os_name == 'macos':
    os.makedirs('qtcreator/bin', exist_ok=True)
    c.symlink(os.path.abspath('qtcreator/Qt Creator.app'),
              'qtcreator/bin/Qt Creator.app')
Пример #7
0
    if sys.argv[1] == 'list':
        c.print('Available modules:')
        for k in iter(sorted(all_modules.keys())):
            c.print(k, '---', all_modules[k]['file'])
    exit(0)

for module in qt_modules:
    if module not in all_modules:
        c.print('>> Required module {} not available'.format(module))
        continue
    file_name = all_modules[module]['file']
    package = all_modules[module]['package']
    c.download(base_url + '/' + package + '/' + file_name, file_name)
    c.extract(file_name, '.')

c.symlink(qt_dir_prefix, qt_dir)

c.print('>> Updating license')
config_name = qt_dir + '/mkspecs/qconfig.pri'
config = ''
with open(config_name, 'r') as f:
    config = f.read()

config = config.replace('Enterprise', 'OpenSource')
config = config.replace('licheck.exe', '')
config = config.replace('licheck64', '')
config = config.replace('licheck_mac', '')

with open(config_name, 'w') as f:
    f.write(config)
Пример #8
0
if len(sys.argv) > 1:  # handle subcommand
    if sys.argv[1] == 'list':
        c.print('Available modules:')
        for k in iter(all_modules):
            c.print(k, '---', all_modules[k]['file'])
    exit(0)

for module in qt_modules:
    if module not in all_modules:
        continue
    file_name = all_modules[module]['file']
    package = all_modules[module]['package']
    c.download(base_url + '/' + package + '/' + file_name, file_name)
    c.extract(file_name, '.')

c.symlink(qt_dir_prefix, 'qt')

c.print('>> Updating license')
config_name = 'qt/mkspecs/qconfig.pri'
config = ''
with open(config_name, 'r') as f:
    config = f.read()

config = config.replace('Enterprise', 'OpenSource')
config = config.replace('licheck.exe', '')
config = config.replace('licheck64', '')
config = config.replace('licheck_mac', '')

with open(config_name, 'w') as f:
    f.write(config)
Пример #9
0
base_url = 'https://download.qt.io/online/qtsdkrepository/{}/desktop/{}' \
    .format(os_url, tool_name)
updates_file = 'Updates-{}-{}.xml'.format(tool_name, os_name)
c.download(base_url + '/Updates.xml', updates_file)

updates = ET.parse(updates_file)
updates_root = updates.getroot()
url = ''
file_name = ''
for i in updates_root.iter('PackageUpdate'):
    name = i.find('Name').text
    if not 'qt.tools.openssl' in name:
        continue

    archives = i.find('DownloadableArchives')
    if archives.text is None:
        continue

    version = i.find('Version').text
    url = base_url + '/' + name + '/' + version + archives.text
    file_name = archives.text

if len(url) == 0:
    c.print('>> No ssl url found')
    exit(1)

c.download(url, file_name)
c.extract(file_name, '.')

c.symlink(root_path, ssl_dir)
Пример #10
0
    os_url = 'windows_x86'
    kit_arch = get_windows_arch('msvc', 64, qt_version)
    qt_dir_prefix = get_windows_qt_dir_prefix('msvc', 64, qt_version)
    target_platform = 'desktop'
## win32_mingw
elif os_name == 'win32_mingw':
    os_url = 'windows_x86'
    kit_arch = get_windows_arch('mingw', 32, qt_version)
    qt_dir_prefix = get_windows_qt_dir_prefix('mingw', 32, qt_version)
    target_platform = 'desktop'

    download_mingw_tool()
    tool_var = get_windows_mingw_tool_prefix(32, qt_version)
    tool_path = 'Tools/{}'.format(tool_var)
    c.print('>>> tool_path: {}'.format(tool_path))
    c.symlink(tool_path, 'mingwTools')
    # os.environ['PATH'] = os.path.abspath(tool_path) + ';' + os.environ['PATH']
    # c.print('>>> os.environ path: {}'.format(os.environ['PATH']))

## win64_mingw
elif os_name == 'win64_mingw':
    os_url = 'windows_x86'
    kit_arch = get_windows_arch('mingw', 64, qt_version)
    qt_dir_prefix = get_windows_qt_dir_prefix('mingw', 64, qt_version)
    target_platform = 'desktop'

    download_mingw_tool()
    tool_var = get_windows_mingw_tool_prefix(64, qt_version)
    tool_path = 'Tools/{}/bin'.format(tool_var)
    c.print('>>> tool_path: {}'.format(tool_path))
    c.symlink(tool_path, 'mingwTools')