Add backports.weakref to Bazel build

This way people using Bazel don't have to pip install it.

PiperOrigin-RevId: 159057260
This commit is contained in:
Justine Tunney 2017-06-14 19:08:34 -07:00 committed by TensorFlower Gardener
parent 7d3497a639
commit 4ac7cc54c8
6 changed files with 47 additions and 8 deletions

View File

@ -2464,6 +2464,7 @@ py_library(
srcs_version = "PY2AND3",
deps = [
"//third_party/py/numpy",
"@org_python_pypi_backports_weakref",
"@protobuf//:protobuf_python",
"@six_archive//:six",
],

View File

@ -85,6 +85,3 @@ pip2 install mock
pip2 install portpicker
pip3 install portpicker
pip2 install backports.weakref==1.0rc1
pip3 install backports.weakref==1.0rc1

View File

@ -89,6 +89,3 @@ pip3.5 install wheel==0.29.0
pip3.5 install portpicker
pip3.5 install werkzeug
pip3.5 install backports.weakref==1.0rc1

View File

@ -122,6 +122,7 @@ filegroup(
"@six_archive//:LICENSE",
"@snappy//:COPYING",
"@zlib_archive//:zlib.h",
"@org_python_pypi_backports_weakref//:LICENSE",
] + if_not_windows([
"@nccl_archive//:LICENSE.txt",
]) + tf_additional_license_deps(),

View File

@ -291,13 +291,35 @@ def tf_workspace(path_prefix="", tf_repo_name=""):
name = "six_archive",
urls = [
"http://mirror.bazel.build/pypi.python.org/packages/source/s/six/six-1.10.0.tar.gz",
"http://pypi.python.org/packages/source/s/six/six-1.10.0.tar.gz",
"https://pypi.python.org/packages/source/s/six/six-1.10.0.tar.gz",
],
sha256 = "105f8d68616f8248e24bf0e9372ef04d3cc10104f1980f54d57b2ce73a5ad56a",
strip_prefix = "six-1.10.0",
build_file = str(Label("//third_party:six.BUILD")),
)
native.new_http_archive(
name = "org_python_pypi_backports_weakref",
urls = [
"http://mirror.bazel.build/pypi.python.org/packages/bc/cc/3cdb0a02e7e96f6c70bd971bc8a90b8463fda83e264fa9c5c1c98ceabd81/backports.weakref-1.0rc1.tar.gz",
"https://pypi.python.org/packages/bc/cc/3cdb0a02e7e96f6c70bd971bc8a90b8463fda83e264fa9c5c1c98ceabd81/backports.weakref-1.0rc1.tar.gz",
],
sha256 = "8813bf712a66b3d8b85dc289e1104ed220f1878cf981e2fe756dfaabe9a82892",
strip_prefix = "backports.weakref-1.0rc1/src",
build_file = str(Label("//third_party:backports_weakref.BUILD")),
)
filegroup_external(
name = "org_python_license",
licenses = ["notice"], # Python 2.0
sha256_urls = {
"b5556e921715ddb9242c076cae3963f483aa47266c5e37ea4c187f77cc79501c": [
"http://mirror.bazel.build/docs.python.org/2.7/_sources/license.txt",
"https://docs.python.org/2.7/_sources/license.txt",
],
},
)
native.bind(
name = "six",
actual = "@six_archive//:six",
@ -622,4 +644,3 @@ def tf_workspace(path_prefix="", tf_repo_name=""):
strip_prefix = "pprof-c0fb62ec88c411cc91194465e54db2632845b650",
build_file = str(Label("//third_party:pprof.BUILD")),
)

22
third_party/backports_weakref.BUILD vendored Normal file
View File

@ -0,0 +1,22 @@
# Description:
# Backport of new features in Python's weakref module.
package(default_visibility = ["//visibility:public"])
licenses(["notice"]) # Python 2.0
py_library(
name = "org_python_pypi_backports_weakref",
srcs = [
"backports/__init__.py",
"backports/weakref.py",
],
srcs_version = "PY2AND3",
)
genrule(
name = "license",
srcs = ["@org_python_license"],
outs = ["LICENSE"],
cmd = "cp $< $@",
)