Index: remoting/webapp/build-webapp.py |
diff --git a/remoting/webapp/build-webapp.py b/remoting/webapp/build-webapp.py |
index e6f5ab27a6092f56dcd5dff0174bbe1e4116312d..4d5e35a64843a2c7bcfc4d8a5a604103fc2a99fe 100755 |
--- a/remoting/webapp/build-webapp.py |
+++ b/remoting/webapp/build-webapp.py |
@@ -56,7 +56,7 @@ def createZip(zip_path, directory): |
def buildWebApp(buildtype, version, mimetype, destination, zip_path, plugin, |
- files, locales): |
+ patchfile, files, locales): |
"""Does the main work of building the webapp directory and zipfile. |
Args: |
@@ -159,6 +159,14 @@ def buildWebApp(buildtype, version, mimetype, destination, zip_path, plugin, |
if ((platform.system() == 'Linux') and (buildtype == 'Official')): |
subprocess.call(["strip", newPluginPath]) |
+ # Patch the files, if necessary. Do this before updating any placeholders |
+ # in case any of the diff contexts refer to the placeholders. |
+ if (patchfile != ''): |
+ patchfile = os.path.join(os.getcwd(), patchfile) |
+ if subprocess.call(['patch', '-d', destination, '-i', patchfile, |
+ '-p1']) != 0: |
+ return 1 |
+ |
# Set the version number in the manifest version. |
findAndReplace(os.path.join(destination, 'manifest.json'), |
'FULL_APP_VERSION', |
@@ -202,18 +210,20 @@ def buildWebApp(buildtype, version, mimetype, destination, zip_path, plugin, |
# Make the zipfile. |
createZip(zip_path, destination) |
+ return 0 |
+ |
def main(): |
if len(sys.argv) < 7: |
print ('Usage: build-webapp.py ' |
'<build-type> <version> <mime-type> <dst> <zip-path> <plugin> ' |
- '<other files...> --locales <locales...>') |
+ '<patch> <other files...> --locales <locales...>') |
Wez
2013/01/15 02:24:31
nit: Would be cleaner to add --patches akin to --l
Jamie
2013/01/15 21:57:01
Much cleaner, thanks. Done.
|
return 1 |
reading_locales = False |
files = [] |
locales = [] |
- for arg in sys.argv[7:]: |
+ for arg in sys.argv[8:]: |
if arg == "--locales": |
reading_locales = True; |
elif reading_locales: |
@@ -221,9 +231,8 @@ def main(): |
else: |
files.append(arg) |
- buildWebApp(sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4], sys.argv[5], |
- sys.argv[6], files, locales) |
- return 0 |
+ return buildWebApp(sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4], |
+ sys.argv[5], sys.argv[6], sys.argv[7], files, locales) |
if __name__ == '__main__': |