Exemple #1
0
def run(repo_config, package_list, s3_target, **kwargs):
    """
    Greets a person and prints a message of the day.
    """
    auth.validate_creds(**kwargs)
    session = auth.Credentials(**kwargs).create_session()

    package_list = expand(package_list)
    repo_config = expand(repo_config)

    Syncer(repos=repo_config, s3target=s3_target,
           session=session).load_repos().run(
               open(package_list, 'r').read().strip().split("\n"))
Exemple #2
0
def run(repo_config, package_list, s3_target, **kwargs):
    """
    Greets a person and prints a message of the day.
    """
    auth.validate_creds(**kwargs)
    session = auth.Credentials(**kwargs).create_session()

    package_list = expand(package_list)
    repo_config = expand(repo_config)

    Syncer(
        repos=repo_config,
        s3target=s3_target,
        session=session
    ).load_repos().run(
        open(package_list, 'r').read().strip().split("\n")
    )
Exemple #3
0
def _initialise(cache_path):
    cache_path = expand(cache_path)

    def initialise_path(path):
        if not os.path.isdir(path):
            (head, tail) = os.path.split(path)
            if not os.path.isdir(head):
                initialise_path(head)
            os.mkdir(path)

    initialise_path(cache_path)
Exemple #4
0
def __call__(self, *args, **kwargs):
    if len(args) > 0:
        arg_names = self.arg_names
        if 'self' in arg_names:
            arg_names.remove('self')
        key_args = dict(zip(arg_names, args))
        key_args.update(kwargs)
    else:
        key_args = kwargs
    self._initialise(cache_path=expand(self.cache_path))
    key = self._build_key(key_args)
    if self.key_exists(key):
        result = self.get_key(key)
    else:
        result = self.f()
        self.set_key(key, result)
    return result
Exemple #5
0
def _key_path(key, cache_path):
    return os.path.join(expand(cache_path), key)