Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 8aaddbf

Browse filesBrowse files
authored
Merge branch 'master' into dslomov-patch-1
2 parents 2572f9a + 640e88a commit 8aaddbf
Copy full SHA for 8aaddbf

File tree

Expand file treeCollapse file tree

19 files changed

+1295
-4
lines changed
Filter options
Expand file treeCollapse file tree

19 files changed

+1295
-4
lines changed

‎.bazelci/presubmit.yml

Copy file name to clipboardExpand all lines: .bazelci/presubmit.yml
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
---
22
platforms:
3-
ubuntu1404:
3+
ubuntu1604:
44
build_targets:
55
- "..."
66
test_targets:
77
- "..."
8-
ubuntu1604:
8+
ubuntu1804:
99
build_targets:
1010
- "..."
1111
test_targets:

‎WORKSPACE

Copy file name to clipboardExpand all lines: WORKSPACE
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,8 @@ _piptool_install()
8080

8181
git_repository(
8282
name = "subpar",
83-
# HEAD as of 2018-12-18
84-
commit = "81d33bafbad4edcb2c9e98548888fc9815c004c4",
8583
remote = "https://github.com/google/subpar",
84+
tag = "2.0.0",
8685
)
8786

8887
###################################

‎examples/boto/requirements.txt

Copy file name to clipboard
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
11
boto3==1.4.7
2+
# Release 0.15 appears to have a broken wheel.
3+
# See https://github.com/bazelbuild/rules_python/issues/205.
4+
docutils!=0.15.post1

‎examples/extras/BUILD

Copy file name to clipboardExpand all lines: examples/extras/BUILD
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,5 @@ py_test(
2626
# Make sure that we can resolve the "extra" dependency
2727
requirement("googleapis-common-protos[grpc]"),
2828
],
29+
python_version = "PY2",
2930
)

‎examples/helloworld/BUILD

Copy file name to clipboardExpand all lines: examples/helloworld/BUILD
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,5 @@ py_test(
2828
name = "helloworld_test",
2929
srcs = ["helloworld_test.py"],
3030
deps = [":helloworld"],
31+
python_version = "PY2",
3132
)

‎experimental/BUILD

Copy file name to clipboard
+16Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Copyright 2018 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

‎experimental/examples/wheel/BUILD

Copy file name to clipboard
+144Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
# Copyright 2018 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("//python:python.bzl", "py_library", "py_test")
19+
load("//experimental/python:wheel.bzl", "py_package", "py_wheel")
20+
21+
py_library(
22+
name = "main",
23+
srcs = ["main.py"],
24+
deps = [
25+
"//experimental/examples/wheel/lib:simple_module",
26+
"//experimental/examples/wheel/lib:module_with_data",
27+
# Example dependency which is not packaged in the wheel
28+
# due to "packages" filter on py_package rule.
29+
"//examples/helloworld",
30+
],
31+
)
32+
33+
# Package just a specific py_libraries, without their dependencies
34+
py_wheel(
35+
name = "minimal_with_py_library",
36+
# Package data. We're building "example_minimal_library-0.0.1-py3-none-any.whl"
37+
distribution = "example_minimal_library",
38+
python_tag = "py3",
39+
version = "0.0.1",
40+
deps = [
41+
"//experimental/examples/wheel/lib:module_with_data",
42+
"//experimental/examples/wheel/lib:simple_module",
43+
],
44+
)
45+
46+
# Use py_package to collect all transitive dependencies of a target,
47+
# selecting just the files within a specific python package.
48+
py_package(
49+
name = "example_pkg",
50+
# Only include these Python packages.
51+
packages = ["experimental.examples.wheel"],
52+
deps = [":main"],
53+
)
54+
55+
py_wheel(
56+
name = "minimal_with_py_package",
57+
# Package data. We're building "example_minimal_package-0.0.1-py3-none-any.whl"
58+
distribution = "example_minimal_package",
59+
python_tag = "py3",
60+
version = "0.0.1",
61+
deps = [":example_pkg"],
62+
)
63+
64+
# An example that uses all features provided by py_wheel.
65+
py_wheel(
66+
name = "customized",
67+
author = "Example Author with non-ascii characters: żółw",
68+
author_email = "example@example.com",
69+
classifiers = [
70+
"License :: OSI Approved :: Apache Software License",
71+
"Intended Audience :: Developers",
72+
],
73+
console_scripts = {
74+
"customized_wheel": "experimental.examples.wheel.main:main",
75+
},
76+
description_file = "README.md",
77+
# Package data. We're building "example_customized-0.0.1-py3-none-any.whl"
78+
distribution = "example_customized",
79+
homepage = "www.example.com",
80+
license = "Apache 2.0",
81+
python_tag = "py3",
82+
# Requirements embedded into the wheel metadata.
83+
requires = ["pytest"],
84+
version = "0.0.1",
85+
deps = [":example_pkg"],
86+
)
87+
88+
# An example of how to change the wheel package root directory using 'strip_path_prefixes'.
89+
py_wheel(
90+
name = "custom_package_root",
91+
# Package data. We're building "custom_package_root-0.0.1-py3-none-any.whl"
92+
distribution = "example_custom_package_root",
93+
python_tag = "py3",
94+
version = "0.0.1",
95+
deps = [
96+
":example_pkg"
97+
],
98+
strip_path_prefixes = [
99+
"experimental"
100+
]
101+
)
102+
103+
py_wheel(
104+
name = "custom_package_root_multi_prefix",
105+
# Package data. We're building "custom_custom_package_root_multi_prefix-0.0.1-py3-none-any.whl"
106+
distribution = "example_custom_package_root_multi_prefix",
107+
python_tag = "py3",
108+
version = "0.0.1",
109+
deps = [
110+
":example_pkg"
111+
],
112+
strip_path_prefixes = [
113+
"experimental/examples/wheel/lib",
114+
"experimental/examples/wheel"
115+
]
116+
)
117+
118+
py_wheel(
119+
name = "custom_package_root_multi_prefix_reverse_order",
120+
# Package data. We're building "custom_custom_package_root_multi_prefix_reverse_order-0.0.1-py3-none-any.whl"
121+
distribution = "example_custom_package_root_multi_prefix_reverse_order",
122+
python_tag = "py3",
123+
version = "0.0.1",
124+
deps = [
125+
":example_pkg"
126+
],
127+
strip_path_prefixes = [
128+
"experimental/examples/wheel" ,
129+
"experimental/examples/wheel/lib" # this is not effective, because the first prefix takes priority
130+
]
131+
)
132+
133+
py_test(
134+
name = "wheel_test",
135+
srcs = ["wheel_test.py"],
136+
data = [
137+
":customized",
138+
":minimal_with_py_library",
139+
":minimal_with_py_package",
140+
":custom_package_root",
141+
":custom_package_root_multi_prefix",
142+
":custom_package_root_multi_prefix_reverse_order"
143+
]
144+
)

‎experimental/examples/wheel/README.md

Copy file name to clipboard
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This is a sample description of a wheel.

‎experimental/examples/wheel/lib/BUILD

Copy file name to clipboard
+35Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Copyright 2018 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("//python:python.bzl", "py_library")
19+
20+
py_library(
21+
name = "simple_module",
22+
srcs = ["simple_module.py"],
23+
)
24+
25+
py_library(
26+
name = "module_with_data",
27+
srcs = ["module_with_data.py"],
28+
data = [":data.txt"],
29+
)
30+
31+
genrule(
32+
name = "make_data",
33+
outs = ["data.txt"],
34+
cmd = "echo foo bar baz > $@",
35+
)
+16Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Copyright 2018 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+
def function():
16+
return "foo"
+16Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Copyright 2018 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+
def function():
16+
return "bar"

‎experimental/examples/wheel/main.py

Copy file name to clipboard
+30Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Copyright 2018 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 experimental.examples.wheel.lib.module_with_data as module_with_data
16+
import experimental.examples.wheel.lib.simple_module as simple_module
17+
18+
19+
def function():
20+
return "baz"
21+
22+
23+
def main():
24+
print(function())
25+
print(module_with_data.function())
26+
print(simple_module.function())
27+
28+
29+
if __name__ == '__main__':
30+
main()

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.