def whl_library(wheel): attrs = [] attrs += [("name", quote(lib_repo(wheel)))] attrs += [("version", quote(wheel.version()))] attrs += [("wheel_name", quote(wheel.basename()))] if args.digests: attrs += [("sha256", quote(wheel_digests[wheel.name()]))] url = downloaded_wheel_urls.get(wheel.basename(), None) if url: attrs += [("urls", '[{}]'.format(quote(url)))] if args.output_format != 'download': attrs += [("wheel", '"@{}//:{}"'.format(args.name, wheel.basename()))] extras = ', '.join( [quote(extra) for extra in sorted(possible_extras.get(wheel, []))]) if extras != '': attrs += [("extras", '[{}]'.format(extras))] build_deps = { w.name() for w in transitive_build_deps(wheel, build_info) } build_deps = ', '.join([quote(dep) for dep in sorted(build_deps)]) if build_deps != '': attrs += [("build_deps", '[{}]'.format(build_deps))] return """"{}": {{ {}, }},""".format( wheel.name(), ",\n ".join(['"{}": {}'.format(k, v) for k, v in attrs]))
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]))
def whl_library(wheel): # Indentation here matters. whl_library must be within the scope # of the function below. We also avoid reimporting an existing WHL. return """ if "{repo_name}" not in native.existing_rules(): whl_library( name = "{repo_name}", whl = "@{name}//:{path}", requirements = "@{name}//:requirements.bzl", extras = [{extras}] )""".format(name=args.name, repo_name=wheel.repository_name(), path=wheel.basename(), extras=','.join([ '"%s"' % extra for extra in possible_extras.get(wheel, []) ]))
def whl_library(wheel): # Indentation here matters. whl_library must be within the scope # of the function below. We also avoid reimporting an existing WHL. srcs_version = '' if args.srcs_version: srcs_version = ' srcs_version = "{srcs_version}",\n '.format( srcs_version=args.srcs_version) return """ if "{repo_name}" not in native.existing_rules(): whl_library( name = "{repo_name}", python_interpreter = "{python_interpreter}", whl = "@{name}//:{path}", requirements = "@{name}//:requirements.bzl", extras = [{extras}], {srcs_version})""".format(name=args.name, repo_name=repository_name(wheel), python_interpreter=args.python_interpreter, path=wheel.basename(), extras=','.join([ '"%s"' % extra for extra in possible_extras.get(wheel, []) ]), srcs_version=srcs_version)