예제 #1
0
def apprun_path_gst_plugin_path(appdir_root, appimage):
    content = []

    apprepo_lib = appimage.get_folder_lib(appdir_root)
    if not os.path.exists(apprepo_lib) or not os.path.isdir(apprepo_lib):
        return content

    gst_plugin_path = "{}/gstreamer-1.0".format(apprepo_lib)
    if os.path.exists(gst_plugin_path) and os.path.isdir(gst_plugin_path):
        path_local = gst_plugin_path.replace(appdir_root, '')
        content.append(
            "GST_PLUGIN_PATH=${{GST_PLUGIN_PATH}}:${{APPDIR}}{}".format(
                path_local))

    gst_plugin_path = "{}/gstreamer1.0".format(apprepo_lib)
    if os.path.exists(gst_plugin_path) and os.path.isdir(gst_plugin_path):
        path_local = gst_plugin_path.replace(appdir_root, '')
        content.append(
            "GST_PLUGIN_PATH=${{GST_PLUGIN_PATH}}:${{APPDIR}}{}".format(
                path_local))

    if not len(content):
        return content

    content.append("export GST_PLUGIN_PATH=${GST_PLUGIN_PATH}\n")

    return content
예제 #2
0
def apprun_path_pythonpath(appdir_root, appimage):
    content = []

    apprepo_lib = appimage.get_folder_lib(appdir_root)
    if not os.path.exists(apprepo_lib) or not os.path.isdir(apprepo_lib):
        return content

    content.append('PYTHONPATH=${PYTHONPATH}:${APPDIR}/lib64')
    content.append('PYTHONPATH=${PYTHONPATH}:${APPDIR}/lib64/python3.6')
    content.append(
        'PYTHONPATH=${PYTHONPATH}:${APPDIR}/lib64/python3.6/site-packages')
    content.append(
        'PYTHONPATH=${PYTHONPATH}:${APPDIR}/lib64/python3.6/site-packages/PIL')
    content.append(
        'PYTHONPATH=${PYTHONPATH}:${APPDIR}/lib64/python3.6/lib-dynload')
    content.append('PYTHONPATH=${PYTHONPATH}:${APPDIR}/lib64/python3.8')
    content.append(
        'PYTHONPATH=${PYTHONPATH}:${APPDIR}/lib64/python3.8/site-packages')
    content.append(
        'PYTHONPATH=${PYTHONPATH}:${APPDIR}/lib64/python3.8/site-packages/PIL')
    content.append(
        'PYTHONPATH=${PYTHONPATH}:${APPDIR}/lib64/python3.8/lib-dynload')
    content.append('PYTHONPATH=${PYTHONPATH}:${APPDIR}/lib64/python3.9')
    content.append(
        'PYTHONPATH=${PYTHONPATH}:${APPDIR}/lib64/python3.9/site-packages')
    content.append(
        'PYTHONPATH=${PYTHONPATH}:${APPDIR}/lib64/python3.9/site-packages/PIL')
    content.append(
        'PYTHONPATH=${PYTHONPATH}:${APPDIR}/lib64/python3.9/lib-dynload')

    content.append('PYTHONPATH=${PYTHONPATH}:${APPDIR}/vendor')
    content.append("export PYTHONPATH=${PYTHONPATH}\n")

    return content
예제 #3
0
def factory_shaper_gtk_immodules(appdir_root, appdir_build, appimage):
    apprepo_lib = appimage.get_folder_lib(appdir_root)
    apprepo_bin = appimage.get_folder_bin(appdir_root)

    GTK_IM_MODULEDIR = "{}/gtk-3.0/3.0.0/immodules".format(apprepo_lib)
    GTK_IM_MODULE_FILE = "{}/gtk-3.0/3.0.0/immodules.cache".format(apprepo_lib)
    if not os.path.exists(GTK_IM_MODULEDIR) or not os.path.isdir(
            GTK_IM_MODULEDIR):
        yield None, None

    command = []
    command.append("export GTK_IM_MODULE_FILE={}".format(GTK_IM_MODULE_FILE))

    modules = []
    for path in glob.glob("{}/*.so".format(GTK_IM_MODULEDIR)):
        modules.append(path)

    modules = " ".join(modules)
    GTK_IM_MODULE_BINARY = "{}/gtk-query-immodules".format(apprepo_bin)
    if os.path.exists(GTK_IM_MODULE_BINARY) and os.path.isfile(
            GTK_IM_MODULE_BINARY):
        command.append("{} --update-cache {}".format(GTK_IM_MODULE_BINARY,
                                                     modules))

    GTK_IM_MODULE_BINARY = "{}/gtk-query-immodules-3.0".format(apprepo_bin)
    if os.path.exists(GTK_IM_MODULE_BINARY) and os.path.isfile(
            GTK_IM_MODULE_BINARY):
        command.append("{} --update-cache {}".format(GTK_IM_MODULE_BINARY,
                                                     modules))

    GTK_IM_MODULE_BINARY = "{}/libgtk-3-0/gtk-query-immodules".format(
        apprepo_lib)
    if os.path.exists(GTK_IM_MODULE_BINARY) and os.path.isfile(
            GTK_IM_MODULE_BINARY):
        command.append("{} --update-cache {}".format(GTK_IM_MODULE_BINARY,
                                                     modules))

    GTK_IM_MODULE_BINARY = "{}/libgtk-3-0/gtk-query-immodules-3.0".format(
        apprepo_lib)
    if os.path.exists(GTK_IM_MODULE_BINARY) and os.path.isfile(
            GTK_IM_MODULE_BINARY):
        command.append("{} --update-cache {}".format(GTK_IM_MODULE_BINARY,
                                                     modules))

    os.system(" && ".join(command))

    if os.path.exists(GTK_IM_MODULE_FILE):
        with open(GTK_IM_MODULE_FILE, 'r+') as stream:
            content = stream.read()
            content = content.replace("{}/".format(GTK_IM_MODULEDIR), '')
            content = content.replace(GTK_IM_MODULEDIR, '')
            stream.close()

            with open(GTK_IM_MODULE_FILE, 'w') as stream:
                stream.write(content)
                stream.close()

    yield None, None
예제 #4
0
def factory_shaper_libexec(appdir_root, appdir_build, appimage):
    apprepo_libexec = appimage.get_folder_libexec(appdir_root)
    apprepo_lib = appimage.get_folder_lib(appdir_root)

    copypool = []

    copypool.append(
        ('{}/lib64/libexec/*'.format(appdir_build), apprepo_libexec))
    copypool.append(('{}/lib/libexec/*'.format(appdir_build), apprepo_libexec))
    copypool.append(('{}/libexec/*'.format(apprepo_lib), apprepo_libexec))

    for output in _reshapre(copypool):
        yield output
예제 #5
0
def factory_shaper_mime(appdir_root, appdir_build, appimage):
    apprepo_lib = appimage.get_folder_lib(appdir_root)
    apprepo_share = appimage.get_folder_share(appdir_root)
    apprepo_bin = appimage.get_folder_bin(appdir_root)

    command = []
    command.append(
        "export XDG_DATA_DIRS=${{XDG_DATA_DIRS}}:{}".format(apprepo_share))
    command.append(
        "export LD_LIBRARY_PATH=${{LD_LIBRARY_PATH}}:{}".format(apprepo_lib))
    command.append("{}/update-mime-database {}/mime".format(
        apprepo_bin, apprepo_share))

    os.system(" && ".join(command))
    yield None, None
예제 #6
0
def apprun_path_ld_library_path(appdir_root, appimage):
    content = []

    apprepo_lib = appimage.get_folder_lib(appdir_root)
    if not os.path.exists(apprepo_lib) or not os.path.isdir(apprepo_lib):
        return content

    path_local = apprepo_lib.replace(appdir_root, '')

    content.append(
        'GDK_PIXBUF_MODULEDIR=${{APPDIR}}{}/gdk-pixbuf-2.0/2.10.0/loaders'.
        format(path_local))
    content.append("export GDK_PIXBUF_MODULEDIR=${GDK_PIXBUF_MODULEDIR}\n")

    content.append(
        'GDK_PIXBUF_MODULE_FILE=${{APPDIR}}{}/gdk-pixbuf-2.0/2.10.0/loaders.cache'
        .format(path_local))
    content.append("export GDK_PIXBUF_MODULE_FILE=${GDK_PIXBUF_MODULE_FILE}\n")

    content.append(
        'GTK_PATH=${{GTK_PATH}}:${{APPDIR}}{}/gtk-2.0'.format(path_local))
    content.append(
        'GTK_PATH=${{GTK_PATH}}:${{APPDIR}}{}/gtk-3.0'.format(path_local))
    content.append("export GTK_PATH=${GTK_PATH}\n")

    content.append(
        'GTK_IM_MODULE_FILE=${{APPDIR}}{}/gtk-3.0/3.0.0/immodules.cache'.
        format(path_local))
    content.append("export GTK_IM_MODULE_FILE=${GTK_IM_MODULE_FILE}\n")

    content.append('PANGO_LIBDIR=${{APPDIR}}{}'.format(path_local))
    content.append("export PANGO_LIBDIR=${PANGO_LIBDIR}\n")

    for path in _get_folders(apprepo_lib):
        path_local = path.replace(appdir_root, '')
        content.append(
            'LD_LIBRARY_PATH=${{LD_LIBRARY_PATH}}:${{APPDIR}}{}'.format(
                path_local))

    content.append(
        'LD_LIBRARY_PATH=${{LD_LIBRARY_PATH}}:${{APPDIR}}{}/gdk-pixbuf-2.0/loaders'
        .format(path_local))
    content.append("export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}\n")

    return content
예제 #7
0
def factory_shaper_lib(appdir_root, appdir_build, appimage):
    apprepo_lib = appimage.get_folder_lib(appdir_root)

    copypool = []

    copypool.append(('{}/usr/lib/*'.format(appdir_build), apprepo_lib))
    copypool.append(('{}/usr/lib64/*'.format(appdir_build), apprepo_lib))
    copypool.append(('{}/lib64/*'.format(appdir_build), apprepo_lib))
    copypool.append(('{}/lib/*'.format(appdir_build), apprepo_lib))
    copypool.append(('{}/x86_64-linux-gnu/*'.format(apprepo_lib), apprepo_lib))

    for output in _reshapre(copypool):
        yield output

    command = []
    command.append("ln -s ./lib64 {}/lib".format(appdir_root))
    command.append(
        "ln -s ../lib64 {}/lib64/x86_64-linux-gnu".format(appdir_root))

    os.system(" && ".join(command))
    yield None, None
예제 #8
0
def factory_shaper_glib_schemas(appdir_root, appdir_build, appimage):
    apprepo_lib = appimage.get_folder_lib(appdir_root)
    apprepo_share = appimage.get_folder_share(appdir_root)
    apprepo_bin = appimage.get_folder_bin(appdir_root)

    command = []
    command.append(
        "export XDG_DATA_DIRS=${{XDG_DATA_DIRS}}:{}".format(apprepo_share))
    command.append(
        "export LD_LIBRARY_PATH=${{LD_LIBRARY_PATH}}:{}".format(apprepo_lib))

    command.append(
        "{}/glib-2.0/glib-compile-schemas {}/glib-2.0/schemas/ > /dev/null 2>&1"
        .format(apprepo_lib, apprepo_share))

    command.append(
        "{}/glib-compile-schemas {}/glib-2.0/schemas/ > /dev/null 2>&1".format(
            apprepo_bin, apprepo_share))

    os.system(" && ".join(command))
    yield None, None
예제 #9
0
def factory_shaper_gdk_pixbuf_loaders(appdir_root, appdir_build, appimage):
    apprepo_lib = appimage.get_folder_lib(appdir_root)
    apprepo_share = appimage.get_folder_share(appdir_root)
    apprepo_bin = appimage.get_folder_bin(appdir_root)

    GDK_PIXBUF_MODULEDIR = "{}/gdk-pixbuf-2.0/2.10.0/loaders".format(
        apprepo_lib)
    GDK_PIXBUF_MODULE_FILE = "{}/gdk-pixbuf-2.0/2.10.0/loaders.cache".format(
        apprepo_lib)
    if not os.path.exists(GDK_PIXBUF_MODULEDIR) or not os.path.isdir(
            GDK_PIXBUF_MODULEDIR):
        yield None, None

    command = []
    command.append(
        "export XDG_DATA_DIRS=${{XDG_DATA_DIRS}}:{}".format(apprepo_share))
    command.append(
        "export LD_LIBRARY_PATH=${{LD_LIBRARY_PATH}}:{}".format(apprepo_lib))
    command.append(
        "export GDK_PIXBUF_MODULEDIR={}".format(GDK_PIXBUF_MODULEDIR))

    GDK_PIXBUF_QUERY_LOADER = "{}/gdk-pixbuf-query-loaders-64".format(
        apprepo_bin)
    if os.path.exists(GDK_PIXBUF_QUERY_LOADER) and os.path.isfile(
            GDK_PIXBUF_QUERY_LOADER):
        command.append("{} > {}".format(GDK_PIXBUF_QUERY_LOADER,
                                        GDK_PIXBUF_MODULE_FILE))

    GDK_PIXBUF_QUERY_LOADER = "{}/gdk-pixbuf-query-loaders".format(apprepo_bin)
    if os.path.exists(GDK_PIXBUF_QUERY_LOADER) and os.path.isfile(
            GDK_PIXBUF_QUERY_LOADER):
        command.append("{} > {}".format(GDK_PIXBUF_QUERY_LOADER,
                                        GDK_PIXBUF_MODULE_FILE))

    GDK_PIXBUF_QUERY_LOADER = "{}/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders".format(
        apprepo_lib)
    if os.path.exists(GDK_PIXBUF_QUERY_LOADER) and os.path.isfile(
            GDK_PIXBUF_QUERY_LOADER):
        command.append("{} > {}".format(GDK_PIXBUF_QUERY_LOADER,
                                        GDK_PIXBUF_MODULE_FILE))

    GDK_PIXBUF_QUERY_LOADER = "{}/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders-64".format(
        apprepo_lib)
    if os.path.exists(GDK_PIXBUF_QUERY_LOADER) and os.path.isfile(
            GDK_PIXBUF_QUERY_LOADER):
        command.append("{} > {}".format(GDK_PIXBUF_QUERY_LOADER,
                                        GDK_PIXBUF_MODULE_FILE))

    os.system(" && ".join(command))

    if os.path.exists(GDK_PIXBUF_MODULE_FILE):
        with open(GDK_PIXBUF_MODULE_FILE, 'r+') as stream:
            content = stream.read()
            content = content.replace("{}/".format(GDK_PIXBUF_MODULEDIR), '')
            content = content.replace(GDK_PIXBUF_MODULEDIR, '')
            stream.close()

            with open(GDK_PIXBUF_MODULE_FILE, 'w') as stream:
                stream.write(content)
                stream.close()

    yield None, None