Hi Richard, yes, I needed in a version of stackless since I'm working on a project that needs this in 2.7.5 slp, but probably pushed to the wrong remote repos.
cheers - chris On 24.10.13 22:28, Richard Tew wrote:
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)
-- Christian Tismer :^) <mailto:[email protected]> Software Consulting : Have a break! Take a ride on Python's Karl-Liebknecht-Str. 121 : *Starship* http://starship.python.net/ 14482 Potsdam : PGP key -> http://pgp.uni-mainz.de phone +49 173 24 18 776 fax +49 (30) 700143-0023 PGP 0x57F3BF04 9064 F4E1 D754 C2FF 1619 305B C09C 5A3B 57F3 BF04 whom do you want to sponsor today? http://www.stackless.com/ _______________________________________________ Stackless mailing list [email protected] http://www.stackless.com/mailman/listinfo/stackless
