Ejemplo n.º 1
0
def execCommand(args, following_args):
    success = False
    for result in itertools.islice(
            registry_access.search(query=args.query,
                                   keywords=args.kw,
                                   registry=args.registry), args.limit):
        success = True
        if args.type == 'both' or args.type == result['type']:
            print(formatResult(result, args.plain, short=args.short))
    for repo in filter(lambda s: 'type' in s and s['type'] == 'registry',
                       settings.get('sources') or []):
        count = 0
        print('')
        print('additional results from %s:' % repo['url'])
        for result in itertools.islice(
                registry_access.search(query=args.query,
                                       keywords=args.kw,
                                       registry=repo['url']), args.limit):
            success = True
            if args.type == 'both' or args.type == result['type']:
                print(
                    formatResult(result,
                                 args.plain,
                                 indent='  ',
                                 short=args.short))
    # exit status: success if we found something, otherwise fail
    return 0 if success else 1
Ejemplo n.º 2
0
def _getYottaClientUUID():
    import uuid
    current_uuid = settings.get('uuid')
    if current_uuid is None:
        current_uuid = u'%s' % uuid.uuid4()
        settings.set('uuid', current_uuid)
    return current_uuid
Ejemplo n.º 3
0
def _getYottaClientUUID():
    import uuid
    current_uuid = settings.get('uuid')
    if current_uuid is None:
        current_uuid = u'%s' % uuid.uuid4()
        settings.set('uuid', current_uuid)
    return current_uuid
Ejemplo n.º 4
0
def deauthorize(registry=None):
    registry = registry or Registry_Base_URL
    if _isPublicRegistry(registry):
        if settings.get('keys'):
            settings.set('keys', dict())
    else:
        sources = [s for s in _getSources() if not _sourceMatches(s, registry)]
        settings.set('sources', sources)
Ejemplo n.º 5
0
def getMaxCachedModules():
    global _max_cached_modules
    if _max_cached_modules is None:
        _max_cached_modules = settings.get('maxCachedModules')
        if _max_cached_modules is None:
            # arbitrary default value
            _max_cached_modules = 400
    return _max_cached_modules
Ejemplo n.º 6
0
def deauthorize(registry=None):
    registry = registry or Registry_Base_URL
    if _isPublicRegistry(registry):
        if settings.get('keys'):
            settings.set('keys', dict())
    else:
        sources = [s for s in _getSources() if not _sourceMatches(s, registry)]
        settings.set('sources', sources)
Ejemplo n.º 7
0
def getMaxCachedModules():
    global _max_cached_modules
    if _max_cached_modules is None:
        _max_cached_modules = settings.get('maxCachedModules')
        if _max_cached_modules is None:
            # arbitrary default value
            _max_cached_modules = 200
    return _max_cached_modules
Ejemplo n.º 8
0
def execCommand(args, following_args):
    success = False
    for result in itertools.islice(registry_access.search(query=args.query, keywords=args.kw, registry=args.registry), args.limit):
        success= True
        if args.type == 'both' or args.type == result['type']:
            print(formatResult(result, args.plain, short=args.short))
    for repo in filter(lambda s: 'type' in s and s['type'] == 'registry', settings.get('sources') or []) :
        count = 0
        print('')
        print('additional results from %s:' % repo['url'])
        for result in itertools.islice(registry_access.search(query=args.query, keywords=args.kw, registry=repo['url']), args.limit):
            success= True
            if args.type == 'both' or args.type == result['type']:
                print(formatResult(result, args.plain, indent='  ', short=args.short))
    # exit status: success if we found something, otherwise fail
    return 0 if success else 1
Ejemplo n.º 9
0
def _getSources():
    sources = settings.get('sources')
    if sources is None:
        sources = []
    return sources
Ejemplo n.º 10
0
def _getSources():
    sources = settings.get('sources')
    if sources is None:
        sources = []
    return sources
Ejemplo n.º 11
0
 def test_envvars(self):
     testval = str(random.randint(1,100000))
     os.environ['YOTTA_SETTINGS_TEST_VARIABLE'] = testval
     self.assertEqual(settings.get('settings.TEST.Variable'), testval)
Ejemplo n.º 12
0
 def test_envvars(self):
     testval = str(random.randint(1, 100000))
     os.environ['YOTTA_SETTINGS_TEST_VARIABLE'] = testval
     self.assertEqual(settings.get('settings.TEST.Variable'), testval)