aboutsummaryrefslogtreecommitdiff
path: root/devtools
diff options
context:
space:
mode:
authorThierry Crozat2016-09-06 00:43:25 +0100
committerThierry Crozat2016-09-06 00:43:25 +0100
commitfa5a5bf865e86f02257f3b1bec84ba74e71319b1 (patch)
tree65fe939a958c8d9d588a9b7a0ed4895b8f3fb6c4 /devtools
parentb8948c332643da2be296cf3df4daa1fa6eeb1f08 (diff)
downloadscummvm-rg350-fa5a5bf865e86f02257f3b1bec84ba74e71319b1.tar.gz
scummvm-rg350-fa5a5bf865e86f02257f3b1bec84ba74e71319b1.tar.bz2
scummvm-rg350-fa5a5bf865e86f02257f3b1bec84ba74e71319b1.zip
CLOUD: Move wwwroot archive to dists and script to devtools
Both the data used to generate the archive and the archive itself were moved to dists/ instead of being in backends/. The script was also improved to optionally take a path as a command line argument to indicate where the wwwroot data are instead of assuming they are in the working directory. Finally a 'wwwroot' make target was also added to invoke the python script and generate the archive. with the expected path to
Diffstat (limited to 'devtools')
-rwxr-xr-xdevtools/make-www-archive.py48
-rw-r--r--devtools/module.mk5
2 files changed, 53 insertions, 0 deletions
diff --git a/devtools/make-www-archive.py b/devtools/make-www-archive.py
new file mode 100755
index 0000000000..95aeb1533f
--- /dev/null
+++ b/devtools/make-www-archive.py
@@ -0,0 +1,48 @@
+#!/usr/bin/env python
+# encoding: utf-8
+import sys
+import re
+import os
+import zipfile
+import argparse
+
+ARCHIVE_FILE_EXTENSIONS = ('.html', '.css', '.js', '.ico', '.png')
+
+def buildArchive(archiveName):
+ if not os.path.isdir(archiveName):
+ print ("Invalid archive name: " + archiveName)
+ return
+
+ zf = zipfile.ZipFile(archiveName + ".zip", 'w')
+
+ print ("Building '" + archiveName + "' archive:")
+ os.chdir(archiveName)
+
+ directories = ['.', './icons']
+ for d in directories:
+ filenames = os.listdir(d)
+ filenames.sort()
+ for filename in filenames:
+ if os.path.isfile(d + '/' + filename) and filename.endswith(ARCHIVE_FILE_EXTENSIONS):
+ zf.write(d + '/' + filename, d + '/' + filename)
+ print (" Adding file: " + d + '/' + filename)
+
+ os.chdir('../')
+
+ zf.close()
+
+def main():
+ parser = argparse.ArgumentParser(description='Generates wwwroot archive')
+ parser.add_argument('path', nargs='?', help='path where the wwwroot source data can be found')
+ args = parser.parse_args()
+ if args.path != None:
+ if not os.path.isdir(args.path):
+ print ("Directory '" + args.path + "' does not exist!")
+ return
+ else:
+ os.chdir(args.path)
+
+ buildArchive("wwwroot")
+
+if __name__ == "__main__":
+ sys.exit(main())
diff --git a/devtools/module.mk b/devtools/module.mk
index 1d682cdf05..0f2d19176a 100644
--- a/devtools/module.mk
+++ b/devtools/module.mk
@@ -44,6 +44,11 @@ devtools/make-scumm-fontdata$(EXEEXT): $(srcdir)/devtools/make-scumm-fontdata.c
$(QUIET)$(MKDIR) devtools/$(DEPDIR)
$(QUIET_LINK)$(LD) $(CFLAGS) -Wall -o $@ $<
+# Rule to explicitly rebuild the wwwroot archive
+wwwroot:
+ $(srcdir)/devtools/make-www-archive.py $(srcdir)/dists/networking/
+
+
#
# Rules to explicitly rebuild the credits / MD5 tables.
# The rules for the files in the "web" resp. "docs" modules