8000 Merge branch 'master' into kku-python-interpreter-path · kku1993/rules_python@465bc02 · GitHub
[go: up one dir, main page]

Skip to content

Commit 465bc02

Browse files
authored
Merge branch 'master' into kku-python-interpreter-path
2 parents 54d397f + e251c60 commit 465bc02

File tree

5 files changed

+27
-5
lines changed

5 files changed

+27
-5
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,9 @@ directly and call its initialization methods as follows:
8181
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
8282
http_archive(
8383
name = "rules_python",
84-
url = "https://github.com/bazelbuild/rules_python/releases/download/0.0.1/rules_python-0.0.1.tar.gz",
85-
sha256 = "aa96a691d3a8177f3215b14b0edc9641787abaaa30363a080165d06ab65e1161",
84+
url = "https://github.com/bazelbuild/rules_python/releases/download/0.0.2/rules_python-0.0.2.tar.gz",
85+
strip_prefix = "rules_python-0.0.2",
86+
sha256 = "b5668cde8bb6e3515057ef465a35ad712214962f0b3a314e551204266c7be90c",
8687
)
8788
load("@rules_python//python:repositories.bzl", "py_repositories")
8889
py_repositories()

examples/extras/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
google-cloud-language==0.27.0
2+
googleapis-common-protos==1.51.0

experimental/python/wheel.bzl

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def _py_package_impl(ctx):
4040
[dep[DefaultInfo].default_runfiles.files for dep in ctx.attr.deps],
4141
)
4242

43-
# TODO: '/' is wrong on windows, but the path separator is not available in skylark.
43+
# TODO: '/' is wrong on windows, but the path separator is not available in starlark.
4444
# Fix this once ctx.configuration has directory separator information.
4545
packages = [p.replace(".", "/") for p in ctx.attr.packages]
4646
if not packages:
@@ -98,6 +98,14 @@ def _py_wheel_impl(ctx):
9898
# Currently this is only the description file (if used).
9999
other_inputs = []
100100

101+
# Wrap the inputs into a file to reduce command line length.
102+
packageinputfile = ctx.actions.declare_file(ctx.attr.name + '_target_wrapped_inputs.txt')
103+
content = ''
104+
for input_file in inputs_to_package.to_list():
105+
content += _input_file_to_arg(input_file) + '\n'
106+
ctx.actions.write(output = packageinputfile, content=content)
107+
other_inputs.append(packageinputfile)
108+
101109
args = ctx.actions.args()
102110
args.add("--name", ctx.attr.distribution)
103111
args.add("--version", ctx.attr.version)
@@ -107,7 +115,7 @@ def _py_wheel_impl(ctx):
107115
args.add("--out", outfile.path)
108116
args.add_all(ctx.attr.strip_path_prefixes, format_each = "--strip_path_prefix=%s")
109117

110-
args.add_all(inputs_to_package, format_each = "--input_file=%s", map_each = _input_file_to_arg)
118+
args.add("--input_file_list", packageinputfile)
111119

112120
extra_headers = []
113121
if ctx.attr.author:

experimental/rules_python/wheelmaker.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,10 @@ def main():
242242
help="'package_path;real_path' pairs listing "
243243
"files to be included in the wheel. "
244244
"Can be supplied multiple times.")
245+
contents_group.add_argument(
246+
'--input_file_list', action='append',
247+
help='A file that has all the input files defined as a list to avoid the long command'
248+
)
245249
contents_group.add_argument(
246250
'--console_script', action='append',
247251
help="Defines a 'console_script' entry point. "
@@ -264,6 +268,14 @@ def main():
264268
input_files = [i.split(';') for i in arguments.input_file]
265269
else:
266270
input_files = []
271+
272+
if arguments.input_file_list:
273+
for input_file in arguments.input_file_list:
274+
with open(input_file) as _file:
275+
input_file_list = _file.read().splitlines()
276+
for _input_file in input_file_list:
277+
input_files.append(_input_file.split(';'))
278+
267279
all_files = get_files_to_package(input_files)
268280
# Sort the files for reproducible order in the archive.
269281
all_files = sorted(all_files.items())

version.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# limitations under the License.
1414
"""The version of rules_python."""
1515

16-
version = "0.0.1"
16+
version = "0.0.2"

0 commit comments

Comments
 (0)
0