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