Merge branch 'stable-2.15'
* stable-2.15: Set version to 2.15.1-SNAPSHOT Fix removal of email/password on external ID update PG: Make convert_for_template_tests.py compatible with Python 3 Change-Id: I123406081e5f4c0b45950978b468a507149e51af
This commit is contained in:
@@ -10,26 +10,32 @@ fnCompiledRegex = re.compile(removeSelfInvokeRegex, re.DOTALL)
|
||||
regexBehavior = r"<script>(.+)<\/script>"
|
||||
behaviorCompiledRegex = re.compile(regexBehavior, re.DOTALL)
|
||||
|
||||
def _open(filename, mode="r"):
|
||||
try:
|
||||
return open(filename, mode, encoding="utf-8")
|
||||
except TypeError:
|
||||
return open(filename, mode)
|
||||
|
||||
def replaceBehaviorLikeHTML (fileIn, fileOut):
|
||||
with open(fileIn) as f:
|
||||
with _open(fileIn) as f:
|
||||
file_str = f.read()
|
||||
match = behaviorCompiledRegex.search(file_str)
|
||||
if (match):
|
||||
with open("polygerrit-ui/temp/behaviors/" + fileOut.replace("html", "js") , "w+") as f:
|
||||
with _open("polygerrit-ui/temp/behaviors/" + fileOut.replace("html", "js") , "w+") as f:
|
||||
f.write(match.group(1))
|
||||
|
||||
def replaceBehaviorLikeJS (fileIn, fileOut):
|
||||
with open(fileIn) as f:
|
||||
with _open(fileIn) as f:
|
||||
file_str = f.read()
|
||||
with open("polygerrit-ui/temp/behaviors/" + fileOut , "w+") as f:
|
||||
with _open("polygerrit-ui/temp/behaviors/" + fileOut , "w+") as f:
|
||||
f.write(file_str)
|
||||
|
||||
def generateStubBehavior(behaviorName):
|
||||
with open("polygerrit-ui/temp/behaviors/" + behaviorName + ".js", "w+") as f:
|
||||
with _open("polygerrit-ui/temp/behaviors/" + behaviorName + ".js", "w+") as f:
|
||||
f.write("/** @polymerBehavior **/\n" + behaviorName + "= {};")
|
||||
|
||||
def replacePolymerElement (fileIn, fileOut, root):
|
||||
with open(fileIn) as f:
|
||||
with _open(fileIn) as f:
|
||||
key = fileOut.split('.')[0]
|
||||
# Removed self invoked function
|
||||
file_str = f.read()
|
||||
@@ -38,7 +44,7 @@ def replacePolymerElement (fileIn, fileOut, root):
|
||||
if file_str_no_fn:
|
||||
package = root.replace("/", ".") + "." + fileOut
|
||||
|
||||
with open("polygerrit-ui/temp/" + fileOut, "w+") as f:
|
||||
with _open("polygerrit-ui/temp/" + fileOut, "w+") as f:
|
||||
mainFileContents = re.sub(polymerCompiledRegex, "exports = Polymer({", file_str_no_fn.group(1)).replace("'use strict';", "")
|
||||
f.write("/** \n" \
|
||||
"* @fileoverview \n" \
|
||||
@@ -95,7 +101,7 @@ if __name__ == "__main__":
|
||||
|
||||
#TODO figure out something to do with iron-overlay-behavior. it is hard-coded reformatted.
|
||||
|
||||
with open("polygerrit-ui/temp/map.json", "w+") as f:
|
||||
with _open("polygerrit-ui/temp/map.json", "w+") as f:
|
||||
f.write(json.dumps(elements))
|
||||
|
||||
for root, dirs, files in os.walk("polygerrit-ui/app/behaviors"):
|
||||
@@ -103,4 +109,4 @@ if __name__ == "__main__":
|
||||
if file.endswith("behavior.html"):
|
||||
replaceBehaviorLikeHTML(os.path.join(root, file), file)
|
||||
elif file.endswith("behavior.js"):
|
||||
replaceBehaviorLikeJS(os.path.join(root, file), file)
|
||||
replaceBehaviorLikeJS(os.path.join(root, file), file)
|
||||
|
Reference in New Issue
Block a user