def register_command_contexts(global_context):
    default_mapping = defaultdict(lambda: ContextWithBuildDirectory)
    default_mapping.update(dict([
            ("configure", ConfigureYakuContext),
            ("build", BuildYakuContext),
            ("install", ContextWithBuildDirectory),
            ("sdist", SdistContext)]))

    for cmd_name in global_context.command_names(public_only=False):
        if not global_context.is_command_context_registered(cmd_name):
            global_context.register_command_context(cmd_name, default_mapping[cmd_name])
Esempio n. 2
0
def register_command_contexts(global_context):
    default_mapping = defaultdict(lambda: ContextWithBuildDirectory)
    default_mapping.update(dict([
            ("configure", ConfigureYakuContext),
            ("build", BuildYakuContext),
            ("install", ContextWithBuildDirectory),
            ("sdist", SdistContext)]))

    for cmd_name in global_context.command_names(public_only=False):
        if not global_context.is_command_context_registered(cmd_name):
            global_context.register_command_context(cmd_name, default_mapping[cmd_name])
Esempio n. 3
0
def create_wininst(ipkg,
                   src_root_node,
                   build_node,
                   egg_info=None,
                   wininst=None,
                   output_dir=None):
    meta = PackageMetadata.from_ipkg(ipkg)
    if egg_info is None:
        egg_info = EggInfo.from_ipkg(ipkg, build_node)

    # XXX: do this correctly, maybe use same as distutils ?
    if wininst is None:
        wininst = os.path.join(output_dir, wininst_filename(meta))
    else:
        wininst = os.path.join(output_dir, wininst)
    bento.utils.path.ensure_dir(wininst)

    egg_info_dir = os.path.join("PURELIB", egg_info_dirname(meta.fullname))

    fid, arcname = tempfile.mkstemp(prefix="zip")
    zid = compat.ZipFile(arcname, "w", compat.ZIP_DEFLATED)
    try:
        for filename, cnt in egg_info.iter_meta(build_node):
            zid.writestr(os.path.join(egg_info_dir, filename), cnt)

        wininst_paths = compat.defaultdict(lambda: r"DATA\share\$pkgname")
        wininst_paths.update({
            "bindir": "SCRIPTS",
            "sitedir": "PURELIB",
            "gendatadir": "$sitedir"
        })
        d = {}
        for k in ipkg._path_variables:
            d[k] = wininst_paths[k]
        ipkg.update_paths(d)
        file_sections = ipkg.resolve_paths(src_root_node)

        def write_content(source, target, kind):
            zid.write(source.abspath(), target.abspath())

        for kind, source, target in iter_files(file_sections):
            write_content(source, target, kind)

    finally:
        zid.close()
        os.close(fid)

    create_exe(ipkg, arcname, wininst)
Esempio n. 4
0
def create_wininst(ipkg, src_root_node, build_node, egg_info=None, wininst=None, output_dir=None):
    meta = PackageMetadata.from_ipkg(ipkg)
    if egg_info is None:
        egg_info = EggInfo.from_ipkg(ipkg, build_node)

    # XXX: do this correctly, maybe use same as distutils ?
    if wininst is None:
        wininst = os.path.join(output_dir, wininst_filename(meta))
    else:
        wininst = os.path.join(output_dir, wininst)
    bento.utils.path.ensure_dir(wininst)

    egg_info_dir = os.path.join("PURELIB", egg_info_dirname(meta.fullname))

    fid, arcname = tempfile.mkstemp(prefix="zip")
    zid = compat.ZipFile(arcname, "w", compat.ZIP_DEFLATED)
    try:
        for filename, cnt in egg_info.iter_meta(build_node):
            zid.writestr(os.path.join(egg_info_dir, filename), cnt)

        wininst_paths = compat.defaultdict(lambda: r"DATA\share\$pkgname")
        wininst_paths.update({"bindir": "SCRIPTS", "sitedir": "PURELIB",
                              "gendatadir": "$sitedir"})
        d = {}
        for k in ipkg._path_variables:
            d[k] = wininst_paths[k]
        ipkg.update_paths(d)
        file_sections = ipkg.resolve_paths(src_root_node)

        def write_content(source, target, kind):
            zid.write(source.abspath(), target.abspath())

        for kind, source, target in iter_files(file_sections):
            write_content(source, target, kind)

    finally:
        zid.close()
        os.close(fid)

    create_exe(ipkg, arcname, wininst)
Esempio n. 5
0
 def __init__(self, data=None):
     self._data = defaultdict(list)
     if data:
         self._data.update(data)
Esempio n. 6
0
 def __init__(self):
     self.before = defaultdict(list)
     self.command_names = {}
Esempio n. 7
0
 def __init__(self, data=None):
     self._data = defaultdict(list)
     if data:
         self._data.update(data)
Esempio n. 8
0
 def __init__(self):
     self.before = defaultdict(list)
     self.command_names = {}
Esempio n. 9
0
 def register_category(self, category, default_builder):
     if category in self._callbacks:
         raise ValueError("Category %r already registered" % category)
     else:
         self._callbacks[category] = defaultdict(lambda: default_builder)
         setattr(self.categories, category, _Dummy())
Esempio n. 10
0
 def register_category(self, category, default_builder):
     if category in self._callbacks:
         raise ValueError("Category %r already registered" % category)
     else:
         self._callbacks[category] = defaultdict(lambda: default_builder)
         setattr(self.categories, category, _Dummy())