Ejemplo n.º 1
0
def open_cloud_source(path, session, params, request, response):
    """
    List Packages from channel/source
    """
    def job():
        pkg_source = findSource(params['channel'], params['name'])
        session.set_state(pkgSource=pkg_source)
        session.route_to('/CloudSources/Packages')
        response.render_template('index.html')

    Worker(job).start()
Ejemplo n.º 2
0
 def getMacroList(self):
     install_dir = get_macro_path()
     macros = []
     path = self.downloadMacroList()
     if path:
         workers = []
         for entry in path.glob('**/*'):
             if '.git' in entry.name.lower():
                 continue
             if entry.name.lower().endswith('.fcmacro'):
                 worker = Worker(build_macro_package,
                                 entry,
                                 entry.stem,
                                 is_git=True,
                                 install_path=Path(install_dir, entry.name),
                                 base_path=entry.relative_to(path).parent)
                 worker.start()
                 workers.append(worker)
         macros = [flags.apply_predefined_flags(w.get()) for w in workers]
     return macros
Ejemplo n.º 3
0
def show_uninstall_info(path, session, params, request, response):
    """
    Show information before uninstall
    """

    pkg_name = params['pkg']
    session.set_state(installResult=None)

    def job():
        pkg_source = InstalledPackageSource()
        install_pkg = pkg_source.findPackageByName(pkg_name)
        if install_pkg:
            session.set_state(pkgSource=pkg_source,
                              pkgName=pkg_name,
                              installPkg=install_pkg)
            session.route_to('/CloudSources/Packages/Install')
        response.render_template('index.html')

    Worker(job).start()
Ejemplo n.º 4
0
def uninstall_package(path, session, params, request, response):
    """
    Uninstall package
    """

    pkg_name = params['pkg']
    session.set_state(installResult=None)

    def job():
        pkg_source = InstalledPackageSource()
        install_pkg = pkg_source.findPackageByName(pkg_name)
        result = pkg_source.uninstall(install_pkg)
        session.set_state(pkgSource=pkg_source,
                          pkgName=pkg_name,
                          installPkg=install_pkg,
                          installResult=result)
        session.route_to('/InstalledPackages')
        response.render_template('index.html')

    Worker(job).start()
Ejemplo n.º 5
0
def install_package(path, session, params, request, response):
    """
    Install/Update package
    """

    channel_id = params['channel']
    source = params['source']
    pkg_name = params['pkg']
    session.set_state(installResult=None)

    def job():
        pkg_source = findSource(channel_id, source)
        if pkg_source:
            install_pkg = pkg_source.findPackageByName(pkg_name)
            result = pkg_source.install(pkg_name)
            session.set_state(pkgSource=pkg_source,
                              pkgName=pkg_name,
                              installPkg=install_pkg,
                              installResult=result)
            session.route_to('/CloudSources/Packages/Install')
        response.render_template('index.html')

    Worker(job).start()