示例#1
0
 def transitive_deps(wheel, extra=None, collected=None):
     deps = wheel.dependencies(extra)
     if collected is None:
         collected = set()
     for dep in wheel.dependencies(extra):
         if dep not in collected:
             collected.add(dep)
             d, extra = split_extra(dep)
             deps = deps.union(transitive_deps(whl_map[d], extra,
                                               collected))
     return deps
示例#2
0
    def whl_library(wheel):
        attrs = []
        attrs += [("name", quote(lib_repo(wheel)))]
        attrs += [("version", quote(wheel.version()))]
        attrs += [("wheel_name", quote(wheel.basename()))]
        url = requirement_download_url(wheel.basename())
        if url:
            attrs += [("urls", '[{}]'.format(quote(url)))]
        if args.output_format != 'download':
            attrs += [("whl", '"@{}//:{}"'.format(args.name,
                                                  wheel.basename()))]
        extras = ', '.join(
            [quote(extra) for extra in sorted(possible_extras.get(wheel, []))])
        if extras != '':
            attrs += [("extras", '[{}]'.format(extras))]
        runtime_deps = ', '.join([quote(dep) for dep in wheel.dependencies()])
        #if runtime_deps != '':
        #  attrs["runtime_deps"] = '[{}]'.format(runtime_deps)
        transitive_runtime_deps = set(
            [split_extra(dep)[0] for dep in transitive_deps(wheel)])
        transitive_runtime_deps = ', '.join(
            [quote(dep) for dep in sorted(transitive_runtime_deps)])
        if transitive_runtime_deps != '':
            attrs += [("transitive_runtime_deps",
                       '[{}]'.format(transitive_runtime_deps))]

        # Indentation here matters.  whl_library must be within the scope
        # of the function below.  We also avoid reimporting an existing WHL.
        return """"{}": {{
      {},
    }},""".format(
            wheel.name(),
            ",\n      ".join(['"{}": {}'.format(k, v) for k, v in attrs]))
示例#3
0
 def transitive_deps(wheel, extra=None, collected=None, build_info=None):
   deps = wheel.dependencies(extra)
   if build_info:
     deps |= set(build_info.get(wheel.name(), {}).get("additional_runtime_deps", []))
   if collected is None:
     collected = set()
   for dep in deps.copy():
     if dep not in collected:
       collected.add(dep)
       d, extra = split_extra(dep)
       deps |= transitive_deps(whl_map[d], extra, collected, build_info)
   return deps