-
Notifications
You must be signed in to change notification settings - Fork 15.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove hack for building Python support with Bazel.
This change makes use of new imports attribute for Bazel's Python rules, which enable adding directories to the PYTHONPATH. This allows us to remove the hack for building protobuf's Python support with Bazel and now allows projects to include protobuf using a Bazel external repository rather than requiring it to be imported directly into the source tree as //google/protobuf. This change also updates the protobuf BUILD file to use a named repository, @python//, for including Python headers rather than //util/python. This allows projects to specify their own package for Python headers when including protobuf with an external repository. Fixes #1230
- Loading branch information
1 parent
fb714b3
commit 985c968
Showing
4 changed files
with
51 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,33 @@ | ||
new_http_archive( | ||
name = "gmock_archive", | ||
url = "https://googlemock.googlecode.com/files/gmock-1.7.0.zip", | ||
sha256 = "26fcbb5925b74ad5fc8c26b0495dfc96353f4d553492eb97e85a8a6d2f43095b", | ||
build_file = "gmock.BUILD", | ||
name = "gmock_archive", | ||
url = "https://googlemock.googlecode.com/files/gmock-1.7.0.zip", | ||
sha256 = "26fcbb5925b74ad5fc8c26b0495dfc96353f4d553492eb97e85a8a6d2f43095b", | ||
build_file = "gmock.BUILD", | ||
) | ||
|
||
new_http_archive( | ||
name = "six_archive", | ||
url = "https://pypi.python.org/packages/source/s/six/six-1.10.0.tar.gz#md5=34eed507548117b2ab523ab14b2f8b55", | ||
sha256 = "105f8d68616f8248e24bf0e9372ef04d3cc10104f1980f54d57b2ce73a5ad56a", | ||
build_file = "six.BUILD", | ||
name = "six_archive", | ||
url = "https://pypi.python.org/packages/source/s/six/six-1.10.0.tar.gz#md5=34eed507548117b2ab523ab14b2f8b55", | ||
sha256 = "105f8d68616f8248e24bf0e9372ef04d3cc10104f1980f54d57b2ce73a5ad56a", | ||
build_file = "six.BUILD", | ||
) | ||
|
||
bind( | ||
name = "gtest", | ||
actual = "@gmock_archive//:gtest", | ||
name = "python_headers", | ||
actual = "//util/python:python_headers", | ||
) | ||
|
||
bind( | ||
name = "gtest_main", | ||
actual = "@gmock_archive//:gtest_main", | ||
name = "gtest", | ||
actual = "@gmock_archive//:gtest", | ||
) | ||
|
||
bind( | ||
name = "six", | ||
actual = "@six_archive//:six", | ||
name = "gtest_main", | ||
actual = "@gmock_archive//:gtest_main", | ||
) | ||
|
||
bind( | ||
name = "six", | ||
actual = "@six_archive//:six", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
985c968
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@davidzchen : I think this has broken the python test suite, can you have a look? http://ci.bazel.io/job/protobuf/92/
/cc @philwo
985c968
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking.
985c968
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have root-caused the test failures. Interestingly, they are not caused by this patch but by a bug in the Python launcher where it does not check whether the file is a directory when looking for the
python
binary.The fix is simple. I have opened bazelbuild/bazel#981 for the bug.
985c968
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
985c968
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm trying to update Tensorflow to use a newer version of protobuf, but am having some trouble with this commit.
With no other change than bumping our protobuf version up to this commit from the preceding, I get this error:
I then added:
to our WORKSPACE file, but this made no difference. Any ideas?