Skip to content

Commit f968e85

Browse files
committed
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: bazel-contrib#20
1 parent fa77c9c commit f968e85

6 files changed

Lines changed: 65 additions & 1 deletion

File tree

WORKSPACE

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,3 +107,15 @@ load(
107107
)
108108

109109
_version_install()
110+
111+
pip_import(
112+
name = "examples_boto",
113+
requirements = "//examples/boto:requirements.txt",
114+
)
115+
116+
load(
117+
"@examples_boto//:requirements.bzl",
118+
_boto_install = "pip_install",
119+
)
120+
121+
_boto_install()

examples/boto/BUILD

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Copyright 2017 The Bazel Authors. All rights reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
package(default_visibility = ["//visibility:public"])
15+
16+
licenses(["notice"]) # Apache 2.0
17+
18+
load("@examples_boto//:requirements.bzl", "requirement")
19+
load("//python:python.bzl", "py_test")
20+
21+
py_test(
22+
name = "boto_test",
23+
srcs = ["boto_test.py"],
24+
deps = [requirement("boto3")],
25+
)

examples/boto/boto_test.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Copyright 2017 The Bazel Authors. All rights reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
import boto3
16+
import unittest
17+
18+
19+
class BotoTest(unittest.TestCase):
20+
21+
def test_version(self):
22+
self.assertEqual(boto3.__version__, '1.4.7')
23+
24+
25+
if __name__ == '__main__':
26+
unittest.main()

examples/boto/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
boto3==1.4.7

rules_python/whl.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def dependencies(self):
7979
requires = requirement.get('requires', [])
8080
for entry in requires:
8181
# Strip off any trailing versioning data.
82-
parts = entry.split(' ', 1)
82+
parts = re.split('[ ><=()]', entry)
8383
yield parts[0]
8484

8585
def expand(self, directory):

tools/piptool.par

8 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)