Split on more characters when stripping the version metadata. `boto3`s `metadata.json` file doesn't delimit the version specifier the way other packages I've come across seem to, so support splitting on the kinds of characters this variation might foist upon us. Fixes: https://github.com/bazelbuild/rules_python/issues/20
diff --git a/WORKSPACE b/WORKSPACE index 07f84eb..d62ea20 100644 --- a/WORKSPACE +++ b/WORKSPACE
@@ -107,3 +107,15 @@ ) _version_install() + +pip_import( + name = "examples_boto", + requirements = "//examples/boto:requirements.txt", +) + +load( + "@examples_boto//:requirements.bzl", + _boto_install = "pip_install", +) + +_boto_install()
diff --git a/examples/boto/BUILD b/examples/boto/BUILD new file mode 100644 index 0000000..0f22871 --- /dev/null +++ b/examples/boto/BUILD
@@ -0,0 +1,25 @@ +# Copyright 2017 The Bazel Authors. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +package(default_visibility = ["//visibility:public"]) + +licenses(["notice"]) # Apache 2.0 + +load("@examples_boto//:requirements.bzl", "requirement") +load("//python:python.bzl", "py_test") + +py_test( + name = "boto_test", + srcs = ["boto_test.py"], + deps = [requirement("boto3")], +)
diff --git a/examples/boto/boto_test.py b/examples/boto/boto_test.py new file mode 100644 index 0000000..8de0e3e --- /dev/null +++ b/examples/boto/boto_test.py
@@ -0,0 +1,26 @@ +# Copyright 2017 The Bazel Authors. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import boto3 +import unittest + + +class BotoTest(unittest.TestCase): + + def test_version(self): + self.assertEqual(boto3.__version__, '1.4.7') + + +if __name__ == '__main__': + unittest.main()
diff --git a/examples/boto/requirements.txt b/examples/boto/requirements.txt new file mode 100644 index 0000000..2e58c78 --- /dev/null +++ b/examples/boto/requirements.txt
@@ -0,0 +1 @@ +boto3==1.4.7
diff --git a/rules_python/whl.py b/rules_python/whl.py index 83c4d0d..2905d77 100644 --- a/rules_python/whl.py +++ b/rules_python/whl.py
@@ -79,7 +79,7 @@ requires = requirement.get('requires', []) for entry in requires: # Strip off any trailing versioning data. - parts = entry.split(' ', 1) + parts = re.split('[ ><=()]', entry) yield parts[0] def expand(self, directory):
diff --git a/tools/piptool.par b/tools/piptool.par index 46da218..ba7fb26 100755 --- a/tools/piptool.par +++ b/tools/piptool.par Binary files differ