Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: packager.py

Issue 29825555: Issue 6291 - add ManifoldJS packaging for Edge (Closed) Base URL: https://hg.adblockplus.org/buildtools/file/9a56d76cd951
Patch Set: Created July 9, 2018, 7:52 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « package.json ('k') | packagerEdge.py » ('j') | packagerEdge.py » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: packager.py
diff --git a/packager.py b/packager.py
index ab9557148de8834951ea1ea93e83c55a0be18cf9..ecf110886a34281e46d0f48f77c21f48456b3f26 100644
--- a/packager.py
+++ b/packager.py
@@ -9,6 +9,7 @@ import sys
import os
import re
import subprocess
+import tempfile
import json
import zipfile
from StringIO import StringIO
@@ -167,6 +168,25 @@ class Files(dict):
for name in sorted(self, key=sortKey):
zf.writestr(name, self[name])
+ def to_tmp_folder(self, subfolder=None):
Sebastian Noack 2018/07/09 12:35:19 See the devenv() function in the "build" module. T
tlucas 2018/07/09 13:23:56 Done.
+ tmp_dir = tempfile.mkdtemp('adblockplus_package')
+ if subfolder:
+ cwtd = os.path.join(tmp_dir, subfolder)
+ os.makedirs(cwtd)
+ else:
+ cwtd = tmp_dir
+
+ for name in sorted(self):
+ dest = os.path.join(cwtd, name)
+ try:
+ os.makedirs(os.path.dirname(dest))
+ except OSError:
+ pass
+
+ with open(dest, 'w') as fp:
+ fp.write(self[name])
+ return tmp_dir
+
def zipToString(self, sortKey=None):
buffer = StringIO()
self.zip(buffer, sortKey=sortKey)
« no previous file with comments | « package.json ('k') | packagerEdge.py » ('j') | packagerEdge.py » ('J')

Powered by Google App Engine
This is Rietveld