Make license-map compatible to both python2 and python3
Change-Id: I0871af54998b9a18aa71fd2d65baeb85a6c52877
This commit is contained in:
parent
9b4a79532b
commit
49fa3930ac
@ -6,8 +6,8 @@ from __future__ import print_function
|
||||
|
||||
import argparse
|
||||
from collections import defaultdict
|
||||
from shutil import copyfileobj
|
||||
from sys import stdout, stderr
|
||||
import os
|
||||
import xml.etree.ElementTree as ET
|
||||
|
||||
|
||||
@ -113,8 +113,8 @@ for n in sorted(graph.keys()):
|
||||
print()
|
||||
print("[[%s_license]]" % safename)
|
||||
print("----")
|
||||
with open(n[2:].replace(":", "/")) as fd:
|
||||
copyfileobj(fd, stdout)
|
||||
with open(n[2:].replace(":", "/"), "rb") as input:
|
||||
os.write(stdout.fileno(), input.read(-1))
|
||||
print()
|
||||
print("----")
|
||||
print()
|
||||
|
@ -25,7 +25,7 @@ def license_map(name, targets = [], opts = [], **kwargs):
|
||||
# post process the XML into our favorite format.
|
||||
native.genrule(
|
||||
name = "gen_license_txt_" + name,
|
||||
cmd = "python2 $(location //tools/bzl:license-map.py) %s %s > $@" % (" ".join(opts), " ".join(xmls)),
|
||||
cmd = "python $(location //tools/bzl:license-map.py) %s %s > $@" % (" ".join(opts), " ".join(xmls)),
|
||||
outs = [ name + ".txt" ],
|
||||
tools = tools,
|
||||
**kwargs
|
||||
|
Loading…
x
Reference in New Issue
Block a user