Пример #1
0
    def __from_data(cls, data, user_flags, filename=None):
        if not user_flags:
            user_flags = {}

        d = raw_parse(data, filename)
        kw, files = raw_to_pkg_kw(d, user_flags, filename)
        return cls(**kw)
Пример #2
0
def _create_objects_no_cached(filename, user_flags, db):
    info_file = open(filename, 'r')
    try:
        data = info_file.read()
        raw = raw_parse(data, filename)

        pkg, files = _raw_to_pkg(raw, user_flags, filename)
        options = _raw_to_options(raw)

        checksums = [md5(open(f).read()).hexdigest() for f in files]
        db["bentos_checksums"] = cPickle.dumps(dict(zip(files, checksums)))
        db["package_description"] = cPickle.dumps(pkg)
        db["user_flags"] = cPickle.dumps(user_flags)
        db["parsed_dict"] = cPickle.dumps(raw)

        return pkg, options
    finally:
        info_file.close()
Пример #3
0
    def _recurse(subento, cwd):
        f = os.path.join(cwd, subento, "bento.info")
        if not os.path.exists(f):
            raise ValueError("%s not found !" % f)
        filenames.append(f)

        fid = open(f)
        try:
            key = relpath(f, source_dir)
            rdir = relpath(os.path.join(cwd, subento), source_dir)

            d = raw_parse(fid.read(), f)
            kw, subentos = raw_to_subpkg_kw(d)
            subpackages[key] = SubPackageDescription(rdir, **kw)
            filenames.extend([os.path.join(cwd, subento, h) for h in subpackages[key].hook_files])
            for s in subentos:
                _recurse(s, os.path.join(cwd, subento))
        finally:
            fid.close()
Пример #4
0
def _create_objects_no_cached(bento_info, user_flags, db):
    d = os.path.dirname(bento_info.abspath())
    info_file = open(bento_info.abspath(), 'r')
    try:
        data = info_file.read()
        raw = raw_parse(data, bento_info.abspath())

        pkg, files = _raw_to_pkg(raw, user_flags, bento_info)
        files = [os.path.join(d, f) for f in files]
        options = _raw_to_options(raw)

        checksums = [md5(open(f, "rb").read()).hexdigest() for f in files]
        db["bentos_checksums"] = pickle.dumps(dict(zip(files, checksums)))
        db["package_description"] = pickle.dumps(pkg)
        db["user_flags"] = pickle.dumps(user_flags)
        db["parsed_dict"] = pickle.dumps(raw)

        return pkg, options
    finally:
        info_file.close()
Пример #5
0
 def __from_data(cls, data):
     raw = raw_parse(data)
     kw = raw_to_options_kw(raw)
     return cls(**kw)