rpms/ipython/devel ipython-itpl-external.patch, NONE, 1.1 ipython-unbundle-external-module.patch, NONE, 1.1 ipython.spec, 1.30, 1.31

tomspur tomspur at fedoraproject.org
Sat Jun 19 19:45:59 UTC 2010


Author: tomspur

Update of /cvs/pkgs/rpms/ipython/devel
In directory cvs01.phx2.fedoraproject.org:/tmp/cvs-serv25672

Modified Files:
	ipython.spec 
Added Files:
	ipython-itpl-external.patch 
	ipython-unbundle-external-module.patch 
Log Message:
- fix license tag (#603178)
- add requires on wxpython to gui subpackage (#515570)
- start unbundling the libraries - more to come (#603937)


ipython-itpl-external.patch:
 IPython/Itpl.py                                   |  290 ----------------------
 ipython-0.10/IPython/CrashHandler.py              |    2 
 ipython-0.10/IPython/Extensions/ipy_editors.py    |    2 
 ipython-0.10/IPython/Extensions/ipy_profile_sh.py |    2 
 ipython-0.10/IPython/Extensions/ipy_render.py     |    2 
 ipython-0.10/IPython/Magic.py                     |    2 
 ipython-0.10/IPython/OInspect.py                  |    2 
 ipython-0.10/IPython/genutils.py                  |    2 
 ipython-0.10/IPython/iplib.py                     |    2 
 9 files changed, 8 insertions(+), 298 deletions(-)

--- NEW FILE ipython-itpl-external.patch ---
Index: ipython-0.10/IPython/CrashHandler.py
===================================================================
--- ipython-0.10.orig/IPython/CrashHandler.py
+++ ipython-0.10/IPython/CrashHandler.py
@@ -27,7 +27,7 @@ from pprint import pprint,pformat
 from IPython import Release
 from IPython import ultraTB
 from IPython.ColorANSI import ColorScheme,ColorSchemeTable  # too long names
-from IPython.Itpl import Itpl,itpl,printpl
+from IPython.external.Itpl import Itpl, itpl, printpl
 
 from IPython.genutils import *
 
Index: ipython-0.10/IPython/Extensions/ipy_editors.py
===================================================================
--- ipython-0.10.orig/IPython/Extensions/ipy_editors.py
+++ ipython-0.10/IPython/Extensions/ipy_editors.py
@@ -8,7 +8,7 @@ Contributions are *very* welcome.
 import IPython.ipapi
 ip = IPython.ipapi.get()
 
-from IPython.Itpl import itplns
+from IPython.external.Itpl import itplns
 import os
 
 def install_editor(run_template, wait = False):
Index: ipython-0.10/IPython/Extensions/ipy_profile_sh.py
===================================================================
--- ipython-0.10.orig/IPython/Extensions/ipy_profile_sh.py
+++ ipython-0.10/IPython/Extensions/ipy_profile_sh.py
@@ -173,7 +173,7 @@ def extend_shell_behavior(ip):
     # mark the IPSHELL with this signature
     ip.IP.user_ns['__builtins__'].__dict__['__sig__'] = ip.IP.__sig__
 
-    from IPython.Itpl import ItplNS
+    from IPython.external.Itpl import ItplNS
     from IPython.genutils import shell
     # utility to expand user variables via Itpl
     # xxx do something sensible with depth?
Index: ipython-0.10/IPython/Extensions/ipy_render.py
===================================================================
--- ipython-0.10.orig/IPython/Extensions/ipy_render.py
+++ ipython-0.10/IPython/Extensions/ipy_render.py
@@ -9,7 +9,7 @@ ip = IPython.ipapi.get()
 from string import Template
 import sys,os
 
-from IPython.Itpl import itplns
+from IPython.external.Itpl import itplns
 
 def toclip_w32(s):
     """ Places contents of s to clipboard
Index: ipython-0.10/IPython/genutils.py
===================================================================
--- ipython-0.10.orig/IPython/genutils.py
+++ ipython-0.10/IPython/genutils.py
@@ -46,7 +46,7 @@ else:
 
 # Other IPython utilities
 import IPython
-from IPython.Itpl import Itpl,itpl,printpl
+from IPython.external.Itpl import Itpl, itpl, printpl
 from IPython import DPyGetOpt, platutils
 from IPython.generics import result_display
 import IPython.ipapi
Index: ipython-0.10/IPython/iplib.py
===================================================================
--- ipython-0.10.orig/IPython/iplib.py
+++ ipython-0.10/IPython/iplib.py
@@ -55,7 +55,7 @@ from IPython import Debugger,OInspect,Py
 from IPython.ColorANSI import ColorScheme,ColorSchemeTable  # too long names
 from IPython.Extensions import pickleshare
 from IPython.FakeModule import FakeModule, init_fakemod_dict
-from IPython.Itpl import Itpl,itpl,printpl,ItplNS,itplns
+from IPython.external.Itpl import Itpl, itpl, printpl, ItplNS, itplns
 from IPython.Logger import Logger
 from IPython.Magic import Magic
 from IPython.Prompts import CachedOutput
Index: ipython-0.10/IPython/Magic.py
===================================================================
--- ipython-0.10.orig/IPython/Magic.py
+++ ipython-0.10/IPython/Magic.py
@@ -45,7 +45,7 @@ except ImportError:
 import IPython
 from IPython import Debugger, OInspect, wildcard
 from IPython.FakeModule import FakeModule
-from IPython.Itpl import Itpl, itpl, printpl,itplns
+from IPython.external.Itpl import Itpl, itpl, printpl, itplns
 from IPython.PyColorize import Parser
 from IPython.ipstruct import Struct
 from IPython.macro import Macro
Index: ipython-0.10/IPython/OInspect.py
===================================================================
--- ipython-0.10.orig/IPython/OInspect.py
+++ ipython-0.10/IPython/OInspect.py
@@ -29,7 +29,7 @@ import types
 # IPython's own
 from IPython import PyColorize
 from IPython.genutils import page,indent,Term
-from IPython.Itpl import itpl
+from IPython.external.Itpl import itpl
 from IPython.wildcard import list_namespace
 from IPython.ColorANSI import *
 
Index: ipython-0.10/IPython/Itpl.py
===================================================================
--- ipython-0.10.orig/IPython/Itpl.py
+++ /dev/null
@@ -1,290 +0,0 @@
-# -*- coding: utf-8 -*-
-"""String interpolation for Python (by Ka-Ping Yee, 14 Feb 2000).
-
-This module lets you quickly and conveniently interpolate values into
-strings (in the flavour of Perl or Tcl, but with less extraneous
-punctuation).  You get a bit more power than in the other languages,
-because this module allows subscripting, slicing, function calls,
-attribute lookup, or arbitrary expressions.  Variables and expressions
-are evaluated in the namespace of the caller.
-
-The itpl() function returns the result of interpolating a string, and
-printpl() prints out an interpolated string.  Here are some examples:
-
-    from Itpl import printpl
-    printpl("Here is a $string.")
-    printpl("Here is a $module.member.")
-    printpl("Here is an $object.member.")
-    printpl("Here is a $functioncall(with, arguments).")
-    printpl("Here is an ${arbitrary + expression}.")
-    printpl("Here is an $array[3] member.")
-    printpl("Here is a $dictionary['member'].")
-
-The filter() function filters a file object so that output through it
-is interpolated.  This lets you produce the illusion that Python knows
-how to do interpolation:
-
-    import Itpl
-    sys.stdout = Itpl.filter()
-    f = "fancy"
-    print "Is this not $f?"
-    print "Standard output has been replaced with a $sys.stdout object."
-    sys.stdout = Itpl.unfilter()
-    print "Okay, back $to $normal."
-
-Under the hood, the Itpl class represents a string that knows how to
-interpolate values.  An instance of the class parses the string once
-upon initialization; the evaluation and substitution can then be done
-each time the instance is evaluated with str(instance).  For example:
-
-    from Itpl import Itpl
-    s = Itpl("Here is $foo.")
-    foo = 5
-    print str(s)
-    foo = "bar"
-    print str(s)
-"""
-
-#*****************************************************************************
-#
-# Copyright (c) 2001 Ka-Ping Yee <ping at lfw.org>
-#
-#
-# Published under the terms of the MIT license, hereby reproduced:
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to
-# deal in the Software without restriction, including without limitation the
-# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-# sell copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-# IN THE SOFTWARE.
-#
-#*****************************************************************************
-
-__author__  = 'Ka-Ping Yee <ping at lfw.org>'
-__license__ = 'MIT'
-
-import string
-import sys
-from tokenize import tokenprog
-from types import StringType
-
-class ItplError(ValueError):
-    def __init__(self, text, pos):
-        self.text = text
-        self.pos = pos
-    def __str__(self):
-        return "unfinished expression in %s at char %d" % (
-            repr(self.text), self.pos)
-
-def matchorfail(text, pos):
-    match = tokenprog.match(text, pos)
-    if match is None:
-        raise ItplError(text, pos)
-
-    return match, match.end()
-
-try:
-    itpl_encoding = sys.stdin.encoding or 'ascii'
-except AttributeError:
-    itpl_encoding = 'ascii'
-
-    
-
-class Itpl:
-    """Class representing a string with interpolation abilities.
-    
-    Upon creation, an instance works out what parts of the format
-    string are literal and what parts need to be evaluated.  The
-    evaluation and substitution happens in the namespace of the
-    caller when str(instance) is called."""
-
-    def __init__(self, format,codec=itpl_encoding,encoding_errors='backslashreplace'):
-        """The single mandatory argument to this constructor is a format
-        string.
-
-        The format string is parsed according to the following rules:
-
-        1.  A dollar sign and a name, possibly followed by any of: 
-              - an open-paren, and anything up to the matching paren 
-              - an open-bracket, and anything up to the matching bracket 
-              - a period and a name 
-            any number of times, is evaluated as a Python expression.
-
-        2.  A dollar sign immediately followed by an open-brace, and
-            anything up to the matching close-brace, is evaluated as
-            a Python expression.
-
-        3.  Outside of the expressions described in the above two rules,
-            two dollar signs in a row give you one literal dollar sign.
-
-        Optional arguments:
-
-        - codec('utf_8'): a string containing the name of a valid Python
-        codec.
-
-        - encoding_errors('backslashreplace'): a string with a valid error handling
-        policy.  See the codecs module documentation for details.
-
-        These are used to encode the format string if a call to str() fails on
-        the expanded result."""
-
-        if not isinstance(format,basestring):
-            raise TypeError, "needs string initializer"
-        self.format = format
-        self.codec = codec
-        self.encoding_errors = encoding_errors
-        
-        namechars = "abcdefghijklmnopqrstuvwxyz" \
-            "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_";
-        chunks = []
-        pos = 0
-
-        while 1:
-            dollar = string.find(format, "$", pos)
-            if dollar < 0: break
-            nextchar = format[dollar+1]
-
-            if nextchar == "{":
-                chunks.append((0, format[pos:dollar]))
-                pos, level = dollar+2, 1
-                while level:
-                    match, pos = matchorfail(format, pos)
-                    tstart, tend = match.regs[3]
-                    token = format[tstart:tend]
-                    if token == "{": level = level+1
-                    elif token == "}": level = level-1
-                chunks.append((1, format[dollar+2:pos-1]))
-
-            elif nextchar in namechars:
-                chunks.append((0, format[pos:dollar]))
-                match, pos = matchorfail(format, dollar+1)
-                while pos < len(format):
-                    if format[pos] == "." and \
-                        pos+1 < len(format) and format[pos+1] in namechars:
-                        match, pos = matchorfail(format, pos+1)
-                    elif format[pos] in "([":
-                        pos, level = pos+1, 1
-                        while level:
-                            match, pos = matchorfail(format, pos)
-                            tstart, tend = match.regs[3]
-                            token = format[tstart:tend]
-                            if token[0] in "([": level = level+1
-                            elif token[0] in ")]": level = level-1
-                    else: break
-                chunks.append((1, format[dollar+1:pos]))
-
-            else:
-                chunks.append((0, format[pos:dollar+1]))
-                pos = dollar + 1 + (nextchar == "$")
-
-        if pos < len(format): chunks.append((0, format[pos:]))
-        self.chunks = chunks
-
-    def __repr__(self):
-        return "<Itpl %s >" % repr(self.format)
-
-    def _str(self,glob,loc):
-        """Evaluate to a string in the given globals/locals.
-
-        The final output is built by calling str(), but if this fails, the
-        result is encoded with the instance's codec and error handling policy,
-        via a call to out.encode(self.codec,self.encoding_errors)"""
-        result = []
-        app = result.append
-        for live, chunk in self.chunks:
-            if live:
-                val = eval(chunk,glob,loc)
-                try:
-                    app(str(val))
-                except UnicodeEncodeError:
-                    app(unicode(val))
-                
-            else: app(chunk)
-        out = ''.join(result)
-        try:
-            return str(out)
-        except UnicodeError:
-            return out.encode(self.codec,self.encoding_errors)
-
-    def __str__(self):
-        """Evaluate and substitute the appropriate parts of the string."""
-
-        # We need to skip enough frames to get to the actual caller outside of
-        # Itpl.
-        frame = sys._getframe(1)
-        while frame.f_globals["__name__"] == __name__: frame = frame.f_back
-        loc, glob = frame.f_locals, frame.f_globals
-
-        return self._str(glob,loc)
-    
-class ItplNS(Itpl):
-    """Class representing a string with interpolation abilities.
-
-    This inherits from Itpl, but at creation time a namespace is provided
-    where the evaluation will occur.  The interpolation becomes a bit more
-    efficient, as no traceback needs to be extracte.  It also allows the
-    caller to supply a different namespace for the interpolation to occur than
-    its own."""
-    
-    def __init__(self, format,globals,locals=None,
-                 codec='utf_8',encoding_errors='backslashreplace'):
-        """ItplNS(format,globals[,locals]) -> interpolating string instance.
-
-        This constructor, besides a format string, takes a globals dictionary
-        and optionally a locals (which defaults to globals if not provided).
-
-        For further details, see the Itpl constructor."""
-
-        if locals is None:
-            locals = globals
-        self.globals = globals
-        self.locals = locals
-        Itpl.__init__(self,format,codec,encoding_errors)
-        
-    def __str__(self):
-        """Evaluate and substitute the appropriate parts of the string."""
-        return self._str(self.globals,self.locals)
-
-    def __repr__(self):
-        return "<ItplNS %s >" % repr(self.format)
-
-# utilities for fast printing
-def itpl(text): return str(Itpl(text))
-def printpl(text): print itpl(text)
-# versions with namespace
-def itplns(text,globals,locals=None): return str(ItplNS(text,globals,locals))
-def printplns(text,globals,locals=None): print itplns(text,globals,locals)
-
-class ItplFile:
-    """A file object that filters each write() through an interpolator."""
-    def __init__(self, file): self.file = file
-    def __repr__(self): return "<interpolated " + repr(self.file) + ">"
-    def __getattr__(self, attr): return getattr(self.file, attr)
-    def write(self, text): self.file.write(str(Itpl(text)))
-
-def filter(file=sys.stdout):
-    """Return an ItplFile that filters writes to the given file object.
-    
-    'file = filter(file)' replaces 'file' with a filtered object that
-    has a write() method.  When called with no argument, this creates
-    a filter to sys.stdout."""
-    return ItplFile(file)
-
-def unfilter(ifile=None):
-    """Return the original file that corresponds to the given ItplFile.
-    
-    'file = unfilter(file)' undoes the effect of 'file = filter(file)'.
-    'sys.stdout = unfilter()' undoes the effect of 'sys.stdout = filter()'."""
-    return ifile and ifile.file or sys.stdout.file

ipython-unbundle-external-module.patch:
 IPython/external/Itpl.py                                      |  276 -
 IPython/external/argparse.py                                  | 2216 --------
 IPython/external/configobj.py                                 | 2501 ----------
 IPython/external/guid.py                                      |  170 
 IPython/external/mglob.py                                     |  229 
 IPython/external/path.py                                      |  973 ---
 IPython/external/pretty.py                                    |  705 --
 IPython/external/simplegeneric.py                             |  139 
 IPython/external/validate.py                                  | 1414 -----
 ipython-0.10/IPython/external/Itpl/_Itpl.py                   |  276 +
 ipython-0.10/IPython/external/Itpl/__init__.py                |    4 
 ipython-0.10/IPython/external/argparse/__init__.py            |   10 
 ipython-0.10/IPython/external/argparse/_argparse.py           | 2216 ++++++++
 ipython-0.10/IPython/external/configobj/__init__.py           |    4 
 ipython-0.10/IPython/external/configobj/_configobj.py         | 2501 ++++++++++
 ipython-0.10/IPython/external/guid/__init__.py                |    4 
 ipython-0.10/IPython/external/guid/_guid.py                   |  170 
 ipython-0.10/IPython/external/mglob/__init__.py               |    4 
 ipython-0.10/IPython/external/mglob/_mglob.py                 |  229 
 ipython-0.10/IPython/external/path/__init__.py                |    4 
 ipython-0.10/IPython/external/path/_path.py                   |  973 +++
 ipython-0.10/IPython/external/pretty/__init__.py              |    4 
 ipython-0.10/IPython/external/pretty/_pretty.py               |  705 ++
 ipython-0.10/IPython/external/simplegeneric/__init__.py       |    4 
 ipython-0.10/IPython/external/simplegeneric/_simplegeneric.py |  139 
 ipython-0.10/IPython/external/validate/__init__.py            |    8 
 ipython-0.10/IPython/external/validate/_validate.py           | 1414 +++++
 ipython-0.10/setupbase.py                                     |    9 
 28 files changed, 8678 insertions(+), 8623 deletions(-)

--- NEW FILE ipython-unbundle-external-module.patch ---
Index: ipython-0.10/IPython/external/argparse/_argparse.py
===================================================================
--- /dev/null
+++ ipython-0.10/IPython/external/argparse/_argparse.py
@@ -0,0 +1,2216 @@
+# -*- coding: utf-8 -*-
+
+# Copyright © 2006-2009 Steven J. Bethard <steven.bethard at gmail.com>.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy
+# of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+"""Command-line parsing library
+
+This module is an optparse-inspired command-line parsing library that:
+
+    - handles both optional and positional arguments
+    - produces highly informative usage messages
+    - supports parsers that dispatch to sub-parsers
+
+The following is a simple usage example that sums integers from the
+command-line and writes the result to a file::
+
+    parser = argparse.ArgumentParser(
+        description='sum the integers at the command line')
+    parser.add_argument(
+        'integers', metavar='int', nargs='+', type=int,
+        help='an integer to be summed')
+    parser.add_argument(
+        '--log', default=sys.stdout, type=argparse.FileType('w'),
+        help='the file where the sum should be written')
+    args = parser.parse_args()
+    args.log.write('%s' % sum(args.integers))
+    args.log.close()
+
+The module contains the following public classes:
+
+    - ArgumentParser -- The main entry point for command-line parsing. As the
+        example above shows, the add_argument() method is used to populate
+        the parser with actions for optional and positional arguments. Then
+        the parse_args() method is invoked to convert the args at the
+        command-line into an object with attributes.
+
+    - ArgumentError -- The exception raised by ArgumentParser objects when
+        there are errors with the parser's actions. Errors raised while
+        parsing the command-line are caught by ArgumentParser and emitted
+        as command-line messages.
+
+    - FileType -- A factory for defining types of files to be created. As the
+        example above shows, instances of FileType are typically passed as
+        the type= argument of add_argument() calls.
+
+    - Action -- The base class for parser actions. Typically actions are
+        selected by passing strings like 'store_true' or 'append_const' to
+        the action= argument of add_argument(). However, for greater
+        customization of ArgumentParser actions, subclasses of Action may
+        be defined and passed as the action= argument.
+
+    - HelpFormatter, RawDescriptionHelpFormatter, RawTextHelpFormatter,
+        ArgumentDefaultsHelpFormatter -- Formatter classes which
+        may be passed as the formatter_class= argument to the
+        ArgumentParser constructor. HelpFormatter is the default,
+        RawDescriptionHelpFormatter and RawTextHelpFormatter tell the parser
+        not to change the formatting for help text, and
+        ArgumentDefaultsHelpFormatter adds information about argument defaults
+        to the help.
+
+All other classes in this module are considered implementation details.
+(Also note that HelpFormatter and RawDescriptionHelpFormatter are only
+considered public as object names -- the API of the formatter objects is
+still considered an implementation detail.)
+"""
+
+__version__ = '1.0'
+__all__ = [
+    'ArgumentParser',
+    'ArgumentError',
+    'Namespace',
+    'Action',
+    'FileType',
+    'HelpFormatter',
+    'RawDescriptionHelpFormatter',
+    'RawTextHelpFormatter',
+    'ArgumentDefaultsHelpFormatter',
+]
+
+
+import copy as _copy
+import os as _os
+import re as _re
+import sys as _sys
+import textwrap as _textwrap
+
+from gettext import gettext as _
+
+try:
+    _set = set
+except NameError:
+    from sets import Set as _set
+
+try:
+    _basestring = basestring
+except NameError:
+    _basestring = str
+
+try:
+    _sorted = sorted
+except NameError:
+
+    def _sorted(iterable, reverse=False):
+        result = list(iterable)
+        result.sort()
+        if reverse:
+            result.reverse()
+        return result
+
+
+SUPPRESS = '==SUPPRESS=='
+
+OPTIONAL = '?'
+ZERO_OR_MORE = '*'
+ONE_OR_MORE = '+'
+PARSER = '==PARSER=='
+
+# =============================
+# Utility functions and classes
+# =============================
+
+class _AttributeHolder(object):
+    """Abstract base class that provides __repr__.
+
+    The __repr__ method returns a string in the format::
+        ClassName(attr=name, attr=name, ...)
+    The attributes are determined either by a class-level attribute,
+    '_kwarg_names', or by inspecting the instance __dict__.
+    """
+
+    def __repr__(self):
+        type_name = type(self).__name__
+        arg_strings = []
+        for arg in self._get_args():
+            arg_strings.append(repr(arg))
+        for name, value in self._get_kwargs():
+            arg_strings.append('%s=%r' % (name, value))
+        return '%s(%s)' % (type_name, ', '.join(arg_strings))
+
+    def _get_kwargs(self):
+        return _sorted(self.__dict__.items())
+
+    def _get_args(self):
+        return []
+
+
+def _ensure_value(namespace, name, value):
+    if getattr(namespace, name, None) is None:
+        setattr(namespace, name, value)
+    return getattr(namespace, name)
+
+
+# ===============
+# Formatting Help
+# ===============
+
+class HelpFormatter(object):
+    """Formatter for generating usage messages and argument help strings.
+
+    Only the name of this class is considered a public API. All the methods
+    provided by the class are considered an implementation detail.
+    """
+
+    def __init__(self,
+                 prog,
+                 indent_increment=2,
+                 max_help_position=24,
+                 width=None):
+
+        # default setting for width
+        if width is None:
+            try:
+                width = int(_os.environ['COLUMNS'])
+            except (KeyError, ValueError):
+                width = 80
+            width -= 2
+
+        self._prog = prog
+        self._indent_increment = indent_increment
+        self._max_help_position = max_help_position
+        self._width = width
+
+        self._current_indent = 0
[...17048 lines suppressed...]
+    
+    You specify each member as a positional argument specifying type
+    
+    Each type should be one of the following strings :
+      'integer', 'float', 'ip_addr', 'string', 'boolean'
+    
+    So you can specify a list of two strings, followed by
+    two integers as :
+    
+      mixed_list('string', 'string', 'integer', 'integer')
+    
+    The length of the list must match the number of positional
+    arguments you supply.
+    
+    >>> mix_str = "mixed_list('integer', 'float', 'ip_addr', 'string', 'boolean')"
+    >>> check_res = vtor.check(mix_str, (1, 2.0, '1.2.3.4', 'a', True))
+    >>> check_res == [1, 2.0, '1.2.3.4', 'a', True]
+    1
+    >>> check_res = vtor.check(mix_str, ('1', '2.0', '1.2.3.4', 'a', 'True'))
+    >>> check_res == [1, 2.0, '1.2.3.4', 'a', True]
+    1
+    >>> vtor.check(mix_str, ('b', 2.0, '1.2.3.4', 'a', True))
+    Traceback (most recent call last):
+    VdtTypeError: the value "b" is of the wrong type.
+    >>> vtor.check(mix_str, (1, 2.0, '1.2.3.4', 'a'))
+    Traceback (most recent call last):
+    VdtValueTooShortError: the value "(1, 2.0, '1.2.3.4', 'a')" is too short.
+    >>> vtor.check(mix_str, (1, 2.0, '1.2.3.4', 'a', 1, 'b'))
+    Traceback (most recent call last):
+    VdtValueTooLongError: the value "(1, 2.0, '1.2.3.4', 'a', 1, 'b')" is too long.
+    >>> vtor.check(mix_str, 0)
+    Traceback (most recent call last):
+    VdtTypeError: the value "0" is of the wrong type.
+    
+    This test requires an elaborate setup, because of a change in error string
+    output from the interpreter between Python 2.2 and 2.3 .
+    
+    >>> res_seq = (
+    ...     'passed an incorrect value "',
+    ...     'yoda',
+    ...     '" for parameter "mixed_list".',
+    ... )
+    >>> if INTP_VER == (2, 2):
+    ...     res_str = "".join(res_seq)
+    ... else:
+    ...     res_str = "'".join(res_seq)
+    >>> try:
+    ...     vtor.check('mixed_list("yoda")', ('a'))
+    ... except VdtParamError, err:
+    ...     str(err) == res_str
+    1
+    """
+    try:
+        length = len(value)
+    except TypeError:
+        raise VdtTypeError(value)
+    if length < len(args):
+        raise VdtValueTooShortError(value)
+    elif length > len(args):
+        raise VdtValueTooLongError(value)
+    try:
+        return [fun_dict[arg](val) for arg, val in zip(args, value)]
+    except KeyError, e:
+        raise VdtParamError('mixed_list', e)
+
+
+def is_option(value, *options):
+    """
+    This check matches the value to any of a set of options.
+    
+    >>> vtor.check('option("yoda", "jedi")', 'yoda')
+    'yoda'
+    >>> vtor.check('option("yoda", "jedi")', 'jed')
+    Traceback (most recent call last):
+    VdtValueError: the value "jed" is unacceptable.
+    >>> vtor.check('option("yoda", "jedi")', 0)
+    Traceback (most recent call last):
+    VdtTypeError: the value "0" is of the wrong type.
+    """
+    if not isinstance(value, StringTypes):
+        raise VdtTypeError(value)
+    if not value in options:
+        raise VdtValueError(value)
+    return value
+
+
+def _test(value, *args, **keywargs):
+    """
+    A function that exists for test purposes.
+    
+    >>> checks = [
+    ...     '3, 6, min=1, max=3, test=list(a, b, c)',
+    ...     '3',
+    ...     '3, 6',
+    ...     '3,',
+    ...     'min=1, test="a b c"',
+    ...     'min=5, test="a, b, c"',
+    ...     'min=1, max=3, test="a, b, c"',
+    ...     'min=-100, test=-99',
+    ...     'min=1, max=3',
+    ...     '3, 6, test="36"',
+    ...     '3, 6, test="a, b, c"',
+    ...     '3, max=3, test=list("a", "b", "c")',
+    ...     '''3, max=3, test=list("'a'", 'b', "x=(c)")''',
+    ...     "test='x=fish(3)'",
+    ...    ]
+    >>> v = Validator({'test': _test})
+    >>> for entry in checks:
+    ...     print v.check(('test(%s)' % entry), 3)
+    (3, ('3', '6'), {'test': ['a', 'b', 'c'], 'max': '3', 'min': '1'})
+    (3, ('3',), {})
+    (3, ('3', '6'), {})
+    (3, ('3',), {})
+    (3, (), {'test': 'a b c', 'min': '1'})
+    (3, (), {'test': 'a, b, c', 'min': '5'})
+    (3, (), {'test': 'a, b, c', 'max': '3', 'min': '1'})
+    (3, (), {'test': '-99', 'min': '-100'})
+    (3, (), {'max': '3', 'min': '1'})
+    (3, ('3', '6'), {'test': '36'})
+    (3, ('3', '6'), {'test': 'a, b, c'})
+    (3, ('3',), {'test': ['a', 'b', 'c'], 'max': '3'})
+    (3, ('3',), {'test': ["'a'", 'b', 'x=(c)'], 'max': '3'})
+    (3, (), {'test': 'x=fish(3)'})
+    
+    >>> v = Validator()
+    >>> v.check('integer(default=6)', '3')
+    3
+    >>> v.check('integer(default=6)', None, True)
+    6
+    >>> v.get_default_value('integer(default=6)')
+    6
+    >>> v.get_default_value('float(default=6)')
+    6.0
+    >>> v.get_default_value('pass(default=None)')
+    >>> v.get_default_value("string(default='None')")
+    'None'
+    >>> v.get_default_value('pass')
+    Traceback (most recent call last):
+    KeyError: 'Check "pass" has no default value.'
+    >>> v.get_default_value('pass(default=list(1, 2, 3, 4))')
+    ['1', '2', '3', '4']
+    
+    >>> v = Validator()
+    >>> v.check("pass(default=None)", None, True)
+    >>> v.check("pass(default='None')", None, True)
+    'None'
+    >>> v.check('pass(default="None")', None, True)
+    'None'
+    >>> v.check('pass(default=list(1, 2, 3, 4))', None, True)
+    ['1', '2', '3', '4']
+    
+    Bug test for unicode arguments
+    >>> v = Validator()
+    >>> v.check(u'string(min=4)', u'test')
+    u'test'
+    
+    >>> v = Validator()
+    >>> v.get_default_value(u'string(min=4, default="1234")')
+    u'1234'
+    >>> v.check(u'string(min=4, default="1234")', u'test')
+    u'test'
+    
+    >>> v = Validator()
+    >>> default = v.get_default_value('string(default=None)')
+    >>> default == None
+    1
+    """
+    return (value, args, keywargs)
+
+
+if __name__ == '__main__':
+    # run the code tests in doctest format
+    import doctest
+    m = sys.modules.get('__main__')
+    globs = m.__dict__.copy()
+    globs.update({
+        'INTP_VER': INTP_VER,
+        'vtor': Validator(),
+    })
+    doctest.testmod(m, globs=globs)
Index: ipython-0.10/setupbase.py
===================================================================
--- ipython-0.10.orig/setupbase.py
+++ ipython-0.10/setupbase.py
@@ -106,6 +106,15 @@ def find_packages():
     add_package(packages, 'config', tests=True)
     add_package(packages , 'Extensions')
     add_package(packages, 'external')
+    add_package(packages, 'external.argparse')
+    add_package(packages, 'external.configobj')
+    add_package(packages, 'external.guid')
+    add_package(packages, 'external.Itpl')
+    add_package(packages, 'external.mglob')
+    add_package(packages, 'external.path')
+    add_package(packages, 'external.pretty')
+    add_package(packages, 'external.simplegeneric')
+    add_package(packages, 'external.validate')
     add_package(packages, 'gui')
     add_package(packages, 'gui.wx')
     add_package(packages, 'frontend', tests=True)


Index: ipython.spec
===================================================================
RCS file: /cvs/pkgs/rpms/ipython/devel/ipython.spec,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -p -r1.30 -r1.31
--- ipython.spec	17 Apr 2010 20:06:02 -0000	1.30
+++ ipython.spec	19 Jun 2010 19:45:59 -0000	1.31
@@ -4,21 +4,33 @@
 
 Name:           ipython
 Version:        0.10
-Release:        2%{?dist}
+Release:        3%{?dist}
 Summary:        An enhanced interactive Python shell
 
 Group:          Development/Libraries
-License:        BSD
+# See bug #603178 for a quick overview for the choice of licenses
+# most files are under BSD and just a few under Python or MIT
+# There are some extensions released under GPLv2+
+License:        (BSD and MIT and Python) and GPLv2+
 URL:            http://ipython.scipy.org/
 Source0:        http://ipython.scipy.org/dist/%{name}-%{version}.tar.gz
+# move itpl.py to external - already done in upstream git
+Patch0:         %{name}-itpl-external.patch
+# unbundle all current libraries, a similar patch submitted upstream
+Patch1:         %{name}-unbundle-external-module.patch
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
 BuildArch:      noarch
 BuildRequires:  python-devel
+BuildRequires:  python-simplegeneric
 Requires:       python-foolscap
 Requires:       python-twisted-core
 Requires:       python-zope-interface
 
+#bundled libs
+Requires:       python-configobj
+Requires:       python-simplegeneric
+
 
 %description
 
@@ -60,6 +72,7 @@ This package contains the documentation 
 Summary:        Gui applications from %{name}
 Group:          Applications/Editors
 Requires:       %{name} = %{version}-%{release}
+Requires:       wxPython
 %description gui
 This package contains the gui of %{name}, which requires wxPython.
 
@@ -67,6 +80,32 @@ This package contains the gui of %{name}
 
 %prep
 %setup -q
+%patch0 -p1
+%patch1 -p1
+
+# delete bundling libs
+pushd IPython/external
+# python's own modules
+rm argparse/_argparse.py
+rm configobj/_configobj.py
+
+# other packages exist in fedora
+rm simplegeneric/_simplegeneric.py
+rm validate/_validate.py
+
+# probably from here http://code.activestate.com/recipes/163604-guid/
+# python has a own uuid module
+#rm guid/_guid.py
+
+# rejected in a PEP, probably no upstream
+#rm Itpl/_Itpl.py
+
+# available at pypi
+#rm mglob/_mglob.py
+#rm path/_path.py
+#rm pretty/_pretty.py
+
+popd
 
 
 %build
@@ -86,6 +125,11 @@ mv %{buildroot}%{_datadir}/doc/%{name} \
 rm -rf %{buildroot}
 
 
+#check
+# testing seems to be broken on upstreams side
+#PYTHONPATH=%{buildroot}%{python_sitelib} %{buildroot}%{_bindir}/iptest
+
+
 %files
 # -f notests.files
 %defattr(-,root,root,-)
@@ -153,6 +197,11 @@ rm -rf %{buildroot}
 
 
 %changelog
+* Fri Jun 11 2010 Thomas Spura <tomspur at fedoraproject.org> - 0.10-3
+- fix license tag (#603178)
+- add requires on wxpython to gui subpackage (#515570)
+- start unbundling the libraries - more to come (#603937)
+
 * Tue Apr 13 2010 Thomas Spura <tomspur at fedoraproject.org> - 0.10-2
 - move docs into a subpackage
 - subpackage wxPython



More information about the scm-commits mailing list