Christian, Does this really need to be checked into the Stackless repository?
I think up til now, the general rule has been to not check in fixes to mainline which are not related to Stackless directly and are not checked in mainline. Does this qualify? Cheers, Richard. ---------- Forwarded message ---------- From: "christian.tismer" <[email protected]> Date: Wed, 16 Oct 2013 22:00:12 +0200 (CEST) Subject: [Stackless-checkins] stackless (2.7-slp): add a filter function to zipfile.PyZipFile. To: [email protected] http://hg.python.org/stackless/rev/22523a1bd01e changeset: 82915:22523a1bd01e branch: 2.7-slp user: Christian Tismer <[email protected]> date: Wed Oct 16 21:58:28 2013 +0200 summary: add a filter function to zipfile.PyZipFile. Reason: When creating an archive of the python lib, we don't want the tests. Especially the test file "badsyntax_future3.py" does not compile. files: Lib/zipfile.py | 11 +++++++++-- 1 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Lib/zipfile.py b/Lib/zipfile.py --- a/Lib/zipfile.py +++ b/Lib/zipfile.py @@ -1353,7 +1353,7 @@ class PyZipFile(ZipFile): """Class to create ZIP archives with Python library files and packages.""" - def writepy(self, pathname, basename = ""): + def writepy(self, pathname, basename = "", filterfunc=None): """Add all files from "pathname" to the ZIP archive. If pathname is a package directory, search the directory and @@ -1364,7 +1364,13 @@ archive. Added modules are always module.pyo or module.pyc. This method will compile the module.py into module.pyc if necessary. + If filterfunc(pathname) is given, it is called with every argument. + When it is False, the file or directory is skipped. """ + if filterfunc and not filterfunc(pathname): + if self.debug: + print 'pathname "%s" skipped by filterfunc' % pathname + return dir, name = os.path.split(pathname) if os.path.isdir(pathname): initname = os.path.join(pathname, "__init__.py") @@ -1389,7 +1395,8 @@ if os.path.isdir(path): if os.path.isfile(os.path.join(path, "__init__.py")): # This is a package directory, add it - self.writepy(path, basename) # Recursive call + self.writepy(path, basename, + filterfunc=filterfunc) # Recursive call elif ext == ".py": fname, arcname = self._get_codename(path[0:-3], basename) -- Repository URL: http://hg.python.org/stackless _______________________________________________ Stackless mailing list [email protected] http://www.stackless.com/mailman/listinfo/stackless
