コード例 #1
0
ファイル: cli.py プロジェクト: mrvicadai/ubrew
def install(app, app_name, app_version, install_directory, cache_directory, arguments):
    available = app.available()
    versions = available.keys()
    versions = sort_versions(versions)
    
    if app_version == 'all':
        failed = False
        # lets attempt to install every available version
        for version in versions:
            download_url = available[version]['url']
            try:
                __install(app, app_name, version, install_directory, cache_directory, download_url, arguments)
            except Exception as e:
                failed = True
                log.error(str(e))
                pass

        if failed:
            sys.exit(1)

    elif app_version in versions:
        download_url = available[app_version]['url']
        __install(app, app_name, app_version, install_directory, cache_directory, download_url, arguments)
    else:
        print('version %s is unavailable.' % app_version)
        sys.exit(1)
コード例 #2
0
ファイル: cli.py プロジェクト: mrvicadai/ubrew
def installed(apps, install_directory):

    print('Installed Versions:')
    for (app_name, app) in apps:
        app_directory = '%s/%s' % (install_directory, app_name)
        
        if os.path.exists(app_directory):
            versions = sort_versions(os.listdir(app_directory))
        else:
            versions = []

        if len(versions) != 0:
            print('%s:\n %s' % (app_name, ', '.join(versions)))
            print('')
コード例 #3
0
ファイル: cli.py プロジェクト: mrvicadai/ubrew
def available(apps, unstable_releases=False):
    """
    """
    
    print('Installable Versions:')
    for (app_name, app) in apps:
        try:
            available = app.available()
            versions = available.keys()
            versions = sort_versions(versions)
                
            grouped_versions = {}
            print('\n%s:' % app_name)
            for version in versions:

                if unstable_releases:
                    match = re.match('([a-z0-9]+).*', version)
                else:
                    match = re.match('([v0-9]+\.?[0-9]*)\.?[0-9]*$', version)

                if match:
                    major = match.group(1)
                    if major not in grouped_versions:
                        grouped_versions[major] = []

                    grouped_versions[major].append(version)

            majors = grouped_versions.keys()
            majors = sort_versions(majors)
            for major in majors:
                sub_versions = grouped_versions[major]
                print(' * %s' % ' '.join(sub_versions))

        except:
            import traceback
            traceback.print_exc()
            sys.exit(1)