File tree 2 files changed +16
-12
lines changed
2 files changed +16
-12
lines changed Original file line number Diff line number Diff line change 15
15
"""Rules for building wheels."""
16
16
17
17
def _path_inside_wheel (input_file ):
18
- # input_file.short_path is relative ("../${repository_root}/foobar")
19
- # so it can't be a valid path within a zip file. Thus strip out the root
20
- # manually instead of using short_path here.
21
- root = input_file .root .path
22
- if root != "" :
23
- # TODO: '/' is wrong on windows, but the path separator is not available in skylark.
24
- # Fix this once ctx.configuration has directory separator information.
25
- root += "/"
26
- if not input_file .path .startswith (root ):
27
- fail ("input_file.path '%s' does not start with expected root '%s'" % (input_file .path , root ))
28
- return input_file .path [len (root ):]
18
+ # input_file.short_path is sometimes relative ("../${repository_root}/foobar")
19
+ # which is not a valid path within a zip file. Fix that.
20
+ short_path = input_file .short_path
21
+ if short_path .startswith ('..' ) and len (short_path ) >= 3 :
22
+ # Path separator. '/' on linux.
23
+ separator = short_path [2 ]
24
+ # Consume '../' part.
25
+ short_path = short_path [3 :]
26
+ # Find position of next '/' and consume everything up to that character.
27
+ pos = short_path .find (separator )
28
+ short_path = short_path [pos + 1 :]
29
+ return short_path
29
30
30
31
def _input_file_to_arg (input_file ):
31
32
"""Converts a File object to string for --input_file argument to wheelmaker"""
Original file line number Diff line number Diff line change @@ -260,7 +260,10 @@ def main():
260
260
# add_wheelfile and add_metadata currently assume pure-Python.
261
261
assert arguments .platform == 'any' , "Only pure-Python wheels are supported"
262
262
263
- input_files = [i .split (';' ) for i in arguments .input_file ]
263
+ if arguments .input_file :
264
+ input_files = [i .split (';' ) for i in arguments .input_file ]
265
+ else :
266
+ input_files = []
264
267
all_files = get_files_to_package (input_files )
265
268
# Sort the files for reproducible order in the archive.
266
269
all_files = sorted (all_files .items ())
You can’t perform that action at this time.
0 commit comments