File tree Expand file tree Collapse file tree 2 files changed +16
-12
lines changed
Expand file tree Collapse file tree 2 files changed +16
-12
lines changed Original file line number Diff line number Diff line change 1515"""Rules for building wheels."""
1616
1717def _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
2930
3031def _input_file_to_arg (input_file ):
3132 """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():
260260 # add_wheelfile and add_metadata currently assume pure-Python.
261261 assert arguments .platform == 'any' , "Only pure-Python wheels are supported"
262262
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 = []
264267 all_files = get_files_to_package (input_files )
265268 # Sort the files for reproducible order in the archive.
266269 all_files = sorted (all_files .items ())
You can’t perform that action at this time.
0 commit comments