r378 - / python-zope.exceptions python-zope.exceptions/branches
python-zope.exceptions/branches/upstream
python-zope.exceptions/branches/upstream/current
python-zope.exceptions/branches/upstream/current/src
python-zope.exceptions/branches/upstream/current/src/zope
python-zope.exceptions/branches/upstream/current/src/zope/exceptions
python-zope.exceptions/branches/upstream/current/src/zope/exceptions/tests
python-zope.exceptions/branches/upstream/current/src/zope.exceptions.egg-info
python-zope.exceptions/branches/upstream/current/workspace
Brian Sutherland
jinty-guest at alioth.debian.org
Sun Oct 29 20:37:16 CET 2006
Author: jinty-guest
Date: 2006-10-29 20:37:08 +0100 (Sun, 29 Oct 2006)
New Revision: 378
Added:
python-zope.exceptions/
python-zope.exceptions/branches/
python-zope.exceptions/branches/upstream/
python-zope.exceptions/branches/upstream/current/
python-zope.exceptions/branches/upstream/current/CHANGES.txt
python-zope.exceptions/branches/upstream/current/INSTALL.txt
python-zope.exceptions/branches/upstream/current/MANIFEST.in
python-zope.exceptions/branches/upstream/current/PKG-INFO
python-zope.exceptions/branches/upstream/current/README.txt
python-zope.exceptions/branches/upstream/current/develop.py
python-zope.exceptions/branches/upstream/current/setup.cfg.in
python-zope.exceptions/branches/upstream/current/setup.py
python-zope.exceptions/branches/upstream/current/src/
python-zope.exceptions/branches/upstream/current/src/zope.exceptions.egg-info/
python-zope.exceptions/branches/upstream/current/src/zope.exceptions.egg-info/PKG-INFO
python-zope.exceptions/branches/upstream/current/src/zope.exceptions.egg-info/SOURCES.txt
python-zope.exceptions/branches/upstream/current/src/zope.exceptions.egg-info/namespace_packages.txt
python-zope.exceptions/branches/upstream/current/src/zope.exceptions.egg-info/not-zip-safe
python-zope.exceptions/branches/upstream/current/src/zope.exceptions.egg-info/requires.txt
python-zope.exceptions/branches/upstream/current/src/zope.exceptions.egg-info/top_level.txt
python-zope.exceptions/branches/upstream/current/src/zope/
python-zope.exceptions/branches/upstream/current/src/zope/__init__.py
python-zope.exceptions/branches/upstream/current/src/zope/exceptions/
python-zope.exceptions/branches/upstream/current/src/zope/exceptions/DEPENDENCIES.cfg
python-zope.exceptions/branches/upstream/current/src/zope/exceptions/__init__.py
python-zope.exceptions/branches/upstream/current/src/zope/exceptions/_duplicate.py
python-zope.exceptions/branches/upstream/current/src/zope/exceptions/_notfounderror.py
python-zope.exceptions/branches/upstream/current/src/zope/exceptions/exceptionformatter.py
python-zope.exceptions/branches/upstream/current/src/zope/exceptions/interfaces.py
python-zope.exceptions/branches/upstream/current/src/zope/exceptions/tests/
python-zope.exceptions/branches/upstream/current/src/zope/exceptions/tests/__init__.py
python-zope.exceptions/branches/upstream/current/src/zope/exceptions/tests/test_exceptionformatter.py
python-zope.exceptions/branches/upstream/current/test.py
python-zope.exceptions/branches/upstream/current/workspace/
python-zope.exceptions/branches/upstream/current/workspace/__init__.py
python-zope.exceptions/branches/upstream/current/workspace/develop.py
python-zope.exceptions/tags/
Log:
[svn-inject] Installing original source of python-zope.exceptions
Added: python-zope.exceptions/branches/upstream/current/CHANGES.txt
===================================================================
--- python-zope.exceptions/branches/upstream/current/CHANGES.txt 2006-10-29 19:30:51 UTC (rev 377)
+++ python-zope.exceptions/branches/upstream/current/CHANGES.txt 2006-10-29 19:37:08 UTC (rev 378)
@@ -0,0 +1,29 @@
+zope.exceptions Package Changelog
+=================================
+
+zope.exceptions version 3.2.0.1 (2006/04/15)
+--------------------------------------------
+
+- Fix packaging bug: 'package_dir' must be a *relative* path.
+
+zope.exceptions version 3.2.0.1 (2006/04/14)
+--------------------------------------------
+
+- Packaging change: suppress inclusion of 'setup.cfg' in 'sdist' builds.
+
+zope.exceptions version 3.2.0 (2006/01/05)
+------------------------------------------
+
+- Corresponds to the verison of the zope.exceptions package shipped as part of
+ the Zope 3.2.0 release.
+
+- Deprecated the 'INotFoundError' interface and the corresponding
+ 'NotFoundError' exception class, in favor of "standard" exceptions
+ (AttributeError, KeyError). The deprecated items will be removed in
+ Zope 3.3.
+
+zope.exceptions version 3.0.0 (2004/11/07)
+------------------------------------------
+
+- Corresponds to the verison of the zope.exceptions package shipped as part of
+ the Zope X3.0.0 release.
Property changes on: python-zope.exceptions/branches/upstream/current/CHANGES.txt
___________________________________________________________________
Name: svn:eol-style
+ native
Added: python-zope.exceptions/branches/upstream/current/INSTALL.txt
===================================================================
--- python-zope.exceptions/branches/upstream/current/INSTALL.txt 2006-10-29 19:30:51 UTC (rev 377)
+++ python-zope.exceptions/branches/upstream/current/INSTALL.txt 2006-10-29 19:37:08 UTC (rev 378)
@@ -0,0 +1,83 @@
+Installing This Package
+=======================
+
+Prerequisites
+-------------
+
+The installation steps below assume that you have the cool new 'setuptools'
+package installed in your Python. Here is where to get it:
+
+ $ wget http://peak.telecommunity.com/dist/ez_setup.py
+ $ /path/to/your/python ez_setup.py # req. write access to 'site-packages'
+
+
+ - Docs for EasyInstall:
+ http://peak.telecommunity.com/DevCenter/EasyInstall
+
+ - Docs for setuptools:
+ http://peak.telecommunity.com/DevCenter/setuptools
+
+ - Docs for eggs:
+ http://peak.telecommunity.com/DevCenter/PythonEggs
+
+
+Installing a Development Checkout
+---------------------------------
+
+Check out the package from subversion:
+
+ $ svn co svn+ssh://svn.zope.org/repos/main/zope.exceptions/trunk \
+ src/zope.exceptions
+ $ cd src/zope.exceptions
+
+Install it as a "devlopment egg" (which also installs its "hard"
+dependencies):
+
+ $ /path/to/your/python setup.py devel
+
+The installation of dependency eggs uses the 'setup.cfg' file in
+the checkout. You can supply '--find-links' on the command line to
+point it at a non-standard package repository.
+
+
+Running the Tests
+-----------------
+
+To test the package, you will also need the 'zope.testing' package, which
+can't (yet) be automatically installed. Eventually, you should be able to
+type:
+
+ $ /path/to/your/python setup.py test
+
+and have it install the "testing dependencies." Today, the workaround
+is to install it manually:
+
+ $ /path/to/easy_install --find-links="...." zope.testing
+
+You can then run the tests (finally) from the checkout directory:
+
+ $ /path/to/your/python test.py
+ Running:
+ .............
+ Ran 13 tests with 0 failures and 0 errors in 0.094 seconds.
+
+
+Installing a Source Distribution
+--------------------------------
+
+You can also install it from a source distribution:
+
+ $ /path/to/easy_install --find-links="...." -eb src zope.exceptions
+ $ cd src/zope.exceptions
+ $ /path/to/your/python setup.py devel
+
+
+Installing a Binary Egg
+-----------------------
+
+Install the package as a "binary egg" (which also installs its "hard"
+dependencies):
+
+ $ /path/to/easy_install --find-links="...." zope.exceptions
+
+
Property changes on: python-zope.exceptions/branches/upstream/current/INSTALL.txt
___________________________________________________________________
Name: svn:eol-style
+ native
Added: python-zope.exceptions/branches/upstream/current/MANIFEST.in
===================================================================
--- python-zope.exceptions/branches/upstream/current/MANIFEST.in 2006-10-29 19:30:51 UTC (rev 377)
+++ python-zope.exceptions/branches/upstream/current/MANIFEST.in 2006-10-29 19:37:08 UTC (rev 378)
@@ -0,0 +1 @@
+exclude setup.cfg
Added: python-zope.exceptions/branches/upstream/current/PKG-INFO
===================================================================
--- python-zope.exceptions/branches/upstream/current/PKG-INFO 2006-10-29 19:30:51 UTC (rev 377)
+++ python-zope.exceptions/branches/upstream/current/PKG-INFO 2006-10-29 19:37:08 UTC (rev 378)
@@ -0,0 +1,10 @@
+Metadata-Version: 1.0
+Name: zope.exceptions
+Version: 3.2.0.2
+Summary: exceptions
+Home-page: http://svn.zope.org/zope.exceptions
+Author: Zope Corporation and Contributors
+Author-email: zope3-dev at zope.org
+License: ZPL 2.1
+Description: This package contains exception interfaces and implementations which are so general purpose that they don't belong in a Zope application-specific package.
+Platform: UNKNOWN
Added: python-zope.exceptions/branches/upstream/current/README.txt
===================================================================
--- python-zope.exceptions/branches/upstream/current/README.txt 2006-10-29 19:30:51 UTC (rev 377)
+++ python-zope.exceptions/branches/upstream/current/README.txt 2006-10-29 19:37:08 UTC (rev 378)
@@ -0,0 +1,38 @@
+zope.exceptions Package Readme
+==============================
+
+Overview
+--------
+
+This package contains exception interfaces and implementations which are so
+general purpose that they don't belong in Zope application-specific packages.
+
+Changes
+-------
+
+See CHANGES.txt.
+
+Installation
+------------
+
+See INSTALL.txt.
+
+
+Developer Resources
+-------------------
+
+- Subversion browser:
+
+ http://svn.zope.org/zope.exceptions/
+
+- Read-only Subversion checkout:
+
+ $ svn co svn://svn.zope.org/repos/main/zope.exceptions/trunk
+
+- Writable Subversion checkout:
+
+ $ svn co svn://svn.zope.org/repos/main/zope.exceptions/trunk
+
+- Note that the 'src/zope/exceptions' package is acutally a 'svn:externals'
+ link to the corresponding package in the Zope3 trunk (or to a specific tag,
+ for released versions of the package).
Property changes on: python-zope.exceptions/branches/upstream/current/README.txt
___________________________________________________________________
Name: svn:eol-style
+ native
Added: python-zope.exceptions/branches/upstream/current/develop.py
===================================================================
--- python-zope.exceptions/branches/upstream/current/develop.py 2006-10-29 19:30:51 UTC (rev 377)
+++ python-zope.exceptions/branches/upstream/current/develop.py 2006-10-29 19:37:08 UTC (rev 378)
@@ -0,0 +1,21 @@
+##############################################################################
+#
+# Copyright (c) 2004 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""Workspace configuration wrapper script
+
+$Id$
+"""
+
+import workspace.develop
+
+workspace.develop.main()
Property changes on: python-zope.exceptions/branches/upstream/current/develop.py
___________________________________________________________________
Name: svn:eol-style
+ native
Added: python-zope.exceptions/branches/upstream/current/setup.cfg.in
===================================================================
--- python-zope.exceptions/branches/upstream/current/setup.cfg.in 2006-10-29 19:30:51 UTC (rev 377)
+++ python-zope.exceptions/branches/upstream/current/setup.cfg.in 2006-10-29 19:37:08 UTC (rev 378)
@@ -0,0 +1,2 @@
+[development]
+depends = zope.testing
Added: python-zope.exceptions/branches/upstream/current/setup.py
===================================================================
--- python-zope.exceptions/branches/upstream/current/setup.py 2006-10-29 19:30:51 UTC (rev 377)
+++ python-zope.exceptions/branches/upstream/current/setup.py 2006-10-29 19:37:08 UTC (rev 378)
@@ -0,0 +1,49 @@
+##############################################################################
+#
+# Copyright (c) 2006 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""Setup for zope.exceptions package
+
+$Id$
+"""
+
+import os
+
+try:
+ from setuptools import setup, Extension
+except ImportError, e:
+ from distutils.core import setup, Extension
+
+setup(name='zope.exceptions',
+ version='3.2.0.2',
+ url='http://svn.zope.org/zope.exceptions',
+ license='ZPL 2.1',
+ description='exceptions',
+ author='Zope Corporation and Contributors',
+ author_email='zope3-dev at zope.org',
+ long_description="This package contains exception interfaces "
+ "and implementations which are so general purpose "
+ "that they don't belong in a Zope application-specific "
+ "package.",
+
+ packages=['zope', 'zope.exceptions'],
+ package_dir = {'': 'src'},
+
+ namespace_packages=['zope',],
+ tests_require = ['zope.testing'],
+ install_requires=['zope.deprecation',
+ 'zope.interface',
+ ],
+ include_package_data = True,
+
+ zip_safe = False,
+ )
Property changes on: python-zope.exceptions/branches/upstream/current/setup.py
___________________________________________________________________
Name: svn:eol-style
+ native
Added: python-zope.exceptions/branches/upstream/current/src/zope/__init__.py
===================================================================
--- python-zope.exceptions/branches/upstream/current/src/zope/__init__.py 2006-10-29 19:30:51 UTC (rev 377)
+++ python-zope.exceptions/branches/upstream/current/src/zope/__init__.py 2006-10-29 19:37:08 UTC (rev 378)
@@ -0,0 +1,7 @@
+# namespace package boilerplate
+try:
+ __import__('pkg_resources').declare_namespace(__name__)
+except ImportError, e:
+ from pkgutil import extend_path
+ __path__ = extend_path(__path__, __name__)
+
Property changes on: python-zope.exceptions/branches/upstream/current/src/zope/__init__.py
___________________________________________________________________
Name: svn:eol-style
+ native
Added: python-zope.exceptions/branches/upstream/current/src/zope/exceptions/DEPENDENCIES.cfg
===================================================================
--- python-zope.exceptions/branches/upstream/current/src/zope/exceptions/DEPENDENCIES.cfg 2006-10-29 19:30:51 UTC (rev 377)
+++ python-zope.exceptions/branches/upstream/current/src/zope/exceptions/DEPENDENCIES.cfg 2006-10-29 19:37:08 UTC (rev 378)
@@ -0,0 +1,3 @@
+zope.interface
+zope.testing
+zope.deprecation
Added: python-zope.exceptions/branches/upstream/current/src/zope/exceptions/__init__.py
===================================================================
--- python-zope.exceptions/branches/upstream/current/src/zope/exceptions/__init__.py 2006-10-29 19:30:51 UTC (rev 377)
+++ python-zope.exceptions/branches/upstream/current/src/zope/exceptions/__init__.py 2006-10-29 19:37:08 UTC (rev 378)
@@ -0,0 +1,54 @@
+##############################################################################
+#
+# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""General exceptions that wish they were standard exceptions
+
+These exceptions are so general purpose that they don't belong in Zope
+application-specific packages.
+
+$Id: __init__.py 37531 2005-07-28 14:02:49Z anguenot $
+"""
+
+import zope.deprecation
+
+zope.deprecation.deprecated('INotFoundError',
+ 'This interface has been deprecated. '
+ 'Use standard interface instead '
+ 'The reference will be gone in 3.3')
+
+zope.deprecation.deprecated('NotFoundError',
+ 'This class has been deprecated. '
+ 'Use standard exceptions instead '
+ 'The reference will be gone in 3.3')
+
+# Turn of deprecation warning here for the above import that are here for BBB
+# The depreaction above and within the _notfounderror module will do the job.
+zope.deprecation.__show__.off()
+from zope.exceptions._notfounderror import NotFoundError, INotFoundError
+zope.deprecation.__show__.on()
+
+from zope.exceptions._duplicate import DuplicationError, IDuplicationError
+
+# Importing these interfaces from here is deprecated!
+
+# avoid depency on zope.security:
+try:
+ import zope.security
+except ImportError, v:
+ # "ImportError: No module named security"
+ if not str(v).endswith(' security'):
+ raise
+else:
+ from zope.security.interfaces import IUnauthorized, Unauthorized
+ from zope.security.interfaces import IForbidden, IForbiddenAttribute
+ from zope.security.interfaces import Forbidden, ForbiddenAttribute
Property changes on: python-zope.exceptions/branches/upstream/current/src/zope/exceptions/__init__.py
___________________________________________________________________
Name: svn:eol-style
+ native
Added: python-zope.exceptions/branches/upstream/current/src/zope/exceptions/_duplicate.py
===================================================================
--- python-zope.exceptions/branches/upstream/current/src/zope/exceptions/_duplicate.py 2006-10-29 19:30:51 UTC (rev 377)
+++ python-zope.exceptions/branches/upstream/current/src/zope/exceptions/_duplicate.py 2006-10-29 19:37:08 UTC (rev 378)
@@ -0,0 +1,25 @@
+##############################################################################
+#
+# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""Duplication Error
+
+$Id: _duplicate.py 26795 2004-07-27 15:15:58Z jim $
+"""
+from zope.interface import implements, Interface
+
+class IDuplicationError(Interface):
+ pass
+
+class DuplicationError(Exception):
+ """A duplicate registration was attempted"""
+ implements(IDuplicationError)
Property changes on: python-zope.exceptions/branches/upstream/current/src/zope/exceptions/_duplicate.py
___________________________________________________________________
Name: svn:eol-style
+ native
Added: python-zope.exceptions/branches/upstream/current/src/zope/exceptions/_notfounderror.py
===================================================================
--- python-zope.exceptions/branches/upstream/current/src/zope/exceptions/_notfounderror.py 2006-10-29 19:30:51 UTC (rev 377)
+++ python-zope.exceptions/branches/upstream/current/src/zope/exceptions/_notfounderror.py 2006-10-29 19:37:08 UTC (rev 378)
@@ -0,0 +1,48 @@
+##############################################################################
+#
+# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""Not Found Error
+
+$Id: _notfounderror.py 40520 2005-12-03 15:44:57Z benji_york $
+"""
+
+from zope.deprecation import deprecated
+
+from zope.interface.common.interfaces import IKeyError
+from zope.interface import implements
+
+deprecated('INotFoundError',
+ 'This interface has been deprecated. '
+ 'Use standard interface instead '
+ 'The reference will be gone in 3.3')
+
+deprecated('NotFoundError',
+ 'This class has been deprecated. '
+ 'Use standard exceptions instead '
+ 'The reference will be gone in 3.3')
+
+class INotFoundError(IKeyError):
+ pass
+
+class NotFoundError(KeyError, LookupError):
+ """A resource could not be found.
+
+ This exception is deprecated. It will, over time, be replaced
+ with more specific exception types.
+
+ Eventually, when this exception type is used as a base class, it
+ will become an alias for LookupError. Client code should not depend
+ on it extnding KeyError.
+
+ """
+ implements(INotFoundError)
Property changes on: python-zope.exceptions/branches/upstream/current/src/zope/exceptions/_notfounderror.py
___________________________________________________________________
Name: svn:eol-style
+ native
Added: python-zope.exceptions/branches/upstream/current/src/zope/exceptions/exceptionformatter.py
===================================================================
--- python-zope.exceptions/branches/upstream/current/src/zope/exceptions/exceptionformatter.py 2006-10-29 19:30:51 UTC (rev 377)
+++ python-zope.exceptions/branches/upstream/current/src/zope/exceptions/exceptionformatter.py 2006-10-29 19:37:08 UTC (rev 378)
@@ -0,0 +1,245 @@
+##############################################################################
+#
+# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""An exception formatter that shows traceback supplements and traceback info,
+optionally in HTML.
+
+$Id: exceptionformatter.py 26581 2004-07-16 15:44:37Z mgedmin $
+"""
+import sys
+import cgi
+import linecache
+
+DEBUG_EXCEPTION_FORMATTER = 1
+
+class TextExceptionFormatter(object):
+
+ line_sep = '\n'
+ show_revisions = 0
+
+ def __init__(self, limit=None):
+ self.limit = limit
+
+ def escape(self, s):
+ return s
+
+ def getPrefix(self):
+ return 'Traceback (innermost last):'
+
+ def getLimit(self):
+ limit = self.limit
+ if limit is None:
+ limit = getattr(sys, 'tracebacklimit', None)
+ return limit
+
+ def getRevision(self, globals):
+ if not self.show_revisions:
+ return None
+ revision = globals.get('__revision__', None)
+ if revision is None:
+ # Incorrect but commonly used spelling
+ revision = globals.get('__version__', None)
+
+ if revision is not None:
+ try:
+ revision = str(revision).strip()
+ except (ValueError, AttributeError):
+ # Just in case revisions cannot be converted to strings.
+ revision = '???'
+ return revision
+
+ def formatSupplementLine(self, line):
+ return ' - %s' % line
+
+ def formatSourceURL(self, url):
+ return [self.formatSupplementLine(url)]
+
+ def formatSupplement(self, supplement, tb):
+ result = []
+ fmtLine = self.formatSupplementLine
+
+ url = getattr(supplement, 'source_url', None)
+ if url is not None:
+ result.extend(self.formatSourceURL(url))
+
+ line = getattr(supplement, 'line', 0)
+ if line == -1:
+ line = tb.tb_lineno
+ col = getattr(supplement, 'column', -1)
+ if line:
+ if col is not None and col >= 0:
+ result.append(fmtLine('Line %s, Column %s' % (
+ line, col)))
+ else:
+ result.append(fmtLine('Line %s' % line))
+ elif col is not None and col >= 0:
+ result.append(fmtLine('Column %s' % col))
+
+ expr = getattr(supplement, 'expression', None)
+ if expr:
+ result.append(fmtLine('Expression: %s' % expr))
+
+ warnings = getattr(supplement, 'warnings', None)
+ if warnings:
+ for warning in warnings:
+ result.append(fmtLine('Warning: %s' % warning))
+
+ getInfo = getattr(supplement, 'getInfo', None)
+ if getInfo is not None:
+ try:
+ extra = getInfo()
+ if extra:
+ extra = self.escape(extra)
+ if self.line_sep != "\n":
+ extra = extra.replace(" ", " ")
+ extra = extra.replace("\n", self.line_sep)
+ result.append(extra)
+ except:
+ if DEBUG_EXCEPTION_FORMATTER:
+ import traceback
+ traceback.print_exc()
+ # else just swallow the exception.
+ return result
+
+ def formatTracebackInfo(self, tbi):
+ return self.formatSupplementLine('__traceback_info__: %s' % (tbi, ))
+
+ def formatLine(self, tb):
+ f = tb.tb_frame
+ lineno = tb.tb_lineno
+ co = f.f_code
+ filename = co.co_filename
+ name = co.co_name
+ locals = f.f_locals
+ globals = f.f_globals
+ modname = globals.get('__name__', filename)
+
+ s = ' Module %s, line %d' % (modname, lineno)
+
+ revision = self.getRevision(globals)
+ if revision:
+ s = s + ', rev. %s' % revision
+
+ s = s + ', in %s' % name
+
+ result = []
+ result.append(self.escape(s))
+
+ # Append the source line, if available
+ line = linecache.getline(filename, lineno)
+ if line:
+ result.append(" " + self.escape(line.strip()))
+
+ # Output a traceback supplement, if any.
+ if '__traceback_supplement__' in locals:
+ # Use the supplement defined in the function.
+ tbs = locals['__traceback_supplement__']
+ elif '__traceback_supplement__' in globals:
+ # Use the supplement defined in the module.
+ # This is used by Scripts (Python).
+ tbs = globals['__traceback_supplement__']
+ else:
+ tbs = None
+ if tbs is not None:
+ factory = tbs[0]
+ args = tbs[1:]
+ try:
+ supp = factory(*args)
+ result.extend(self.formatSupplement(supp, tb))
+ except:
+ if DEBUG_EXCEPTION_FORMATTER:
+ import traceback
+ traceback.print_exc()
+ # else just swallow the exception.
+
+ try:
+ tbi = locals.get('__traceback_info__', None)
+ if tbi is not None:
+ result.append(self.formatTracebackInfo(tbi))
+ except:
+ if DEBUG_EXCEPTION_FORMATTER:
+ import traceback
+ traceback.print_exc()
+ # else just swallow the exception.
+
+ return self.line_sep.join(result)
+
+ def formatExceptionOnly(self, etype, value):
+ import traceback
+ return self.line_sep.join(
+ traceback.format_exception_only(etype, value))
+
+ def formatLastLine(self, exc_line):
+ return self.escape(exc_line)
+
+ def formatException(self, etype, value, tb):
+ # The next line provides a way to detect recursion.
+ __exception_formatter__ = 1
+ result = [self.getPrefix() + '\n']
+ limit = self.getLimit()
+ n = 0
+ while tb is not None and (limit is None or n < limit):
+ if tb.tb_frame.f_locals.get('__exception_formatter__'):
+ # Stop recursion.
+ result.append('(Recursive formatException() stopped)\n')
+ break
+ line = self.formatLine(tb)
+ result.append(line + '\n')
+ tb = tb.tb_next
+ n = n + 1
+ exc_line = self.formatExceptionOnly(etype, value)
+ result.append(self.formatLastLine(exc_line))
+ return result
+
+
+class HTMLExceptionFormatter(TextExceptionFormatter):
+
+ line_sep = '<br />\r\n'
+
+ def escape(self, s):
+ return cgi.escape(s)
+
+ def getPrefix(self):
+ return '<p>Traceback (innermost last):\r\n<ul>'
+
+ def formatSupplementLine(self, line):
+ return '<b>%s</b>' % self.escape(str(line))
+
+ def formatTracebackInfo(self, tbi):
+ s = self.escape(str(tbi))
+ s = s.replace('\n', self.line_sep)
+ return '__traceback_info__: %s' % (s, )
+
+ def formatLine(self, tb):
+ line = TextExceptionFormatter.formatLine(self, tb)
+ return '<li>%s</li>' % line
+
+ def formatLastLine(self, exc_line):
+ return '</ul>%s</p>' % self.escape(exc_line)
+
+
+limit = 200
+
+if hasattr(sys, 'tracebacklimit'):
+ limit = min(limit, sys.tracebacklimit)
+
+text_formatter = TextExceptionFormatter(limit)
+html_formatter = HTMLExceptionFormatter(limit)
+
+
+def format_exception(t, v, tb, limit=None, as_html=0):
+ if as_html:
+ fmt = html_formatter
+ else:
+ fmt = text_formatter
+ return fmt.formatException(t, v, tb)
Property changes on: python-zope.exceptions/branches/upstream/current/src/zope/exceptions/exceptionformatter.py
___________________________________________________________________
Name: svn:eol-style
+ native
Added: python-zope.exceptions/branches/upstream/current/src/zope/exceptions/interfaces.py
===================================================================
--- python-zope.exceptions/branches/upstream/current/src/zope/exceptions/interfaces.py 2006-10-29 19:30:51 UTC (rev 377)
+++ python-zope.exceptions/branches/upstream/current/src/zope/exceptions/interfaces.py 2006-10-29 19:37:08 UTC (rev 378)
@@ -0,0 +1,82 @@
+##############################################################################
+#
+# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""ITracebackSupplement interface definition.
+
+$Id: interfaces.py 25177 2004-06-02 13:17:31Z jim $
+"""
+
+
+from zope.interface import Interface, Attribute
+
+class ITracebackSupplement(Interface):
+ """Provides valuable information to supplement an exception traceback.
+
+ The interface is geared toward providing meaningful feedback when
+ exceptions occur in user code written in mini-languages like
+ Zope page templates and restricted Python scripts.
+ """
+
+ source_url = Attribute(
+ 'source_url',
+ """Optional. Set to URL of the script where the exception occurred.
+
+ Normally this generates a URL in the traceback that the user
+ can visit to manage the object. Set to None if unknown or
+ not available.
+ """
+ )
+
+ line = Attribute(
+ 'line',
+ """Optional. Set to the line number (>=1) where the exception
+ occurred.
+
+ Set to 0 or None if the line number is unknown.
+ """
+ )
+
+ column = Attribute(
+ 'column',
+ """Optional. Set to the column offset (>=0) where the exception
+ occurred.
+
+ Set to None if the column number is unknown.
+ """
+ )
+
+ expression = Attribute(
+ 'expression',
+ """Optional. Set to the expression that was being evaluated.
+
+ Set to None if not available or not applicable.
+ """
+ )
+
+ warnings = Attribute(
+ 'warnings',
+ """Optional. Set to a sequence of warning messages.
+
+ Set to None if not available, not applicable, or if the exception
+ itself provides enough information.
+ """
+ )
+
+
+ def getInfo(as_html=0):
+ """Optional. Returns a string containing any other useful info.
+
+ If as_html is set, the implementation must HTML-quote the result
+ (normally using cgi.escape()). Returns None to provide no
+ extra info.
+ """
Property changes on: python-zope.exceptions/branches/upstream/current/src/zope/exceptions/interfaces.py
___________________________________________________________________
Name: svn:eol-style
+ native
Added: python-zope.exceptions/branches/upstream/current/src/zope/exceptions/tests/__init__.py
===================================================================
--- python-zope.exceptions/branches/upstream/current/src/zope/exceptions/tests/__init__.py 2006-10-29 19:30:51 UTC (rev 377)
+++ python-zope.exceptions/branches/upstream/current/src/zope/exceptions/tests/__init__.py 2006-10-29 19:37:08 UTC (rev 378)
@@ -0,0 +1,2 @@
+#
+# This file is necessary to make this directory a package.
Property changes on: python-zope.exceptions/branches/upstream/current/src/zope/exceptions/tests/__init__.py
___________________________________________________________________
Name: svn:eol-style
+ native
Added: python-zope.exceptions/branches/upstream/current/src/zope/exceptions/tests/test_exceptionformatter.py
===================================================================
--- python-zope.exceptions/branches/upstream/current/src/zope/exceptions/tests/test_exceptionformatter.py 2006-10-29 19:30:51 UTC (rev 377)
+++ python-zope.exceptions/branches/upstream/current/src/zope/exceptions/tests/test_exceptionformatter.py 2006-10-29 19:37:08 UTC (rev 378)
@@ -0,0 +1,152 @@
+##############################################################################
+#
+# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""ExceptionFormatter tests.
+
+$Id: test_exceptionformatter.py 38178 2005-08-30 21:50:19Z mj $
+"""
+import sys
+from unittest import TestCase, main, makeSuite
+
+from zope.exceptions.exceptionformatter import format_exception
+from zope.testing.cleanup import CleanUp # Base class w registry cleanup
+
+def tb(as_html=0):
+ t, v, b = sys.exc_info()
+ try:
+ return ''.join(format_exception(t, v, b, as_html=as_html))
+ finally:
+ del b
+
+
+class ExceptionForTesting (Exception):
+ pass
+
+
+
+class TestingTracebackSupplement(object):
+
+ source_url = '/somepath'
+ line = 634
+ column = 57
+ warnings = ['Repent, for the end is nigh']
+
+ def __init__(self, expression):
+ self.expression = expression
+
+
+
+class Test(CleanUp, TestCase):
+
+ def testBasicNamesText(self, as_html=0):
+ try:
+ raise ExceptionForTesting
+ except ExceptionForTesting:
+ s = tb(as_html)
+ # The traceback should include the name of this function.
+ self.assert_(s.find('testBasicNamesText') >= 0)
+ # The traceback should include the name of the exception.
+ self.assert_(s.find('ExceptionForTesting') >= 0)
+ else:
+ self.fail('no exception occurred')
+
+ def testBasicNamesHTML(self):
+ self.testBasicNamesText(1)
+
+ def testSupplement(self, as_html=0):
+ try:
+ __traceback_supplement__ = (TestingTracebackSupplement,
+ "You're one in a million")
+ raise ExceptionForTesting
+ except ExceptionForTesting:
+ s = tb(as_html)
+ # The source URL
+ self.assert_(s.find('/somepath') >= 0, s)
+ # The line number
+ self.assert_(s.find('634') >= 0, s)
+ # The column number
+ self.assert_(s.find('57') >= 0, s)
+ # The expression
+ self.assert_(s.find("You're one in a million") >= 0, s)
+ # The warning
+ self.assert_(s.find("Repent, for the end is nigh") >= 0, s)
+ else:
+ self.fail('no exception occurred')
+
+ def testSupplementHTML(self):
+ self.testSupplement(1)
+
+ def testTracebackInfo(self, as_html=0):
+ try:
+ __traceback_info__ = "Adam & Eve"
+ raise ExceptionForTesting
+ except ExceptionForTesting:
+ s = tb(as_html)
+ if as_html:
+ # Be sure quoting is happening.
+ self.assert_(s.find('Adam & Eve') >= 0, s)
+ else:
+ self.assert_(s.find('Adam & Eve') >= 0, s)
+ else:
+ self.fail('no exception occurred')
+
+ def testTracebackInfoHTML(self):
+ self.testTracebackInfo(1)
+
+ def testTracebackInfoTuple(self):
+ try:
+ __traceback_info__ = ("Adam", "Eve")
+ raise ExceptionForTesting
+ except ExceptionForTesting:
+ s = tb()
+ self.assert_(s.find('Adam') >= 0, s)
+ self.assert_(s.find('Eve') >= 0, s)
+ else:
+ self.fail('no exception occurred')
+
+ def testMultipleLevels(self):
+ # Makes sure many levels are shown in a traceback.
+ def f(n):
+ """Produces a (n + 1)-level traceback."""
+ __traceback_info__ = 'level%d' % n
+ if n > 0:
+ f(n - 1)
+ else:
+ raise ExceptionForTesting
+
+ try:
+ f(10)
+ except ExceptionForTesting:
+ s = tb()
+ for n in range(11):
+ self.assert_(s.find('level%d' % n) >= 0, s)
+ else:
+ self.fail('no exception occurred')
+
+ def testQuoteLastLine(self):
+ class C(object): pass
+ try: raise TypeError(C())
+ except:
+ s = tb(1)
+ else:
+ self.fail('no exception occurred')
+ self.assert_(s.find('<') >= 0, s)
+ self.assert_(s.find('>') >= 0, s)
+
+
+
+def test_suite():
+ return makeSuite(Test)
+
+if __name__=='__main__':
+ main(defaultTest='test_suite')
Property changes on: python-zope.exceptions/branches/upstream/current/src/zope/exceptions/tests/test_exceptionformatter.py
___________________________________________________________________
Name: svn:eol-style
+ native
Added: python-zope.exceptions/branches/upstream/current/src/zope.exceptions.egg-info/PKG-INFO
===================================================================
--- python-zope.exceptions/branches/upstream/current/src/zope.exceptions.egg-info/PKG-INFO 2006-10-29 19:30:51 UTC (rev 377)
+++ python-zope.exceptions/branches/upstream/current/src/zope.exceptions.egg-info/PKG-INFO 2006-10-29 19:37:08 UTC (rev 378)
@@ -0,0 +1,10 @@
+Metadata-Version: 1.0
+Name: zope.exceptions
+Version: 3.2.0.2
+Summary: exceptions
+Home-page: http://svn.zope.org/zope.exceptions
+Author: Zope Corporation and Contributors
+Author-email: zope3-dev at zope.org
+License: ZPL 2.1
+Description: This package contains exception interfaces and implementations which are so general purpose that they don't belong in a Zope application-specific package.
+Platform: UNKNOWN
Added: python-zope.exceptions/branches/upstream/current/src/zope.exceptions.egg-info/SOURCES.txt
===================================================================
--- python-zope.exceptions/branches/upstream/current/src/zope.exceptions.egg-info/SOURCES.txt 2006-10-29 19:30:51 UTC (rev 377)
+++ python-zope.exceptions/branches/upstream/current/src/zope.exceptions.egg-info/SOURCES.txt 2006-10-29 19:37:08 UTC (rev 378)
@@ -0,0 +1,25 @@
+CHANGES.txt
+INSTALL.txt
+MANIFEST.in
+README.txt
+develop.py
+setup.cfg.in
+setup.py
+test.py
+src/zope/__init__.py
+src/zope.exceptions.egg-info/PKG-INFO
+src/zope.exceptions.egg-info/SOURCES.txt
+src/zope.exceptions.egg-info/namespace_packages.txt
+src/zope.exceptions.egg-info/not-zip-safe
+src/zope.exceptions.egg-info/requires.txt
+src/zope.exceptions.egg-info/top_level.txt
+src/zope/exceptions/DEPENDENCIES.cfg
+src/zope/exceptions/__init__.py
+src/zope/exceptions/_duplicate.py
+src/zope/exceptions/_notfounderror.py
+src/zope/exceptions/exceptionformatter.py
+src/zope/exceptions/interfaces.py
+src/zope/exceptions/tests/__init__.py
+src/zope/exceptions/tests/test_exceptionformatter.py
+workspace/__init__.py
+workspace/develop.py
Property changes on: python-zope.exceptions/branches/upstream/current/src/zope.exceptions.egg-info/SOURCES.txt
___________________________________________________________________
Name: svn:eol-style
+ native
Added: python-zope.exceptions/branches/upstream/current/src/zope.exceptions.egg-info/namespace_packages.txt
===================================================================
--- python-zope.exceptions/branches/upstream/current/src/zope.exceptions.egg-info/namespace_packages.txt 2006-10-29 19:30:51 UTC (rev 377)
+++ python-zope.exceptions/branches/upstream/current/src/zope.exceptions.egg-info/namespace_packages.txt 2006-10-29 19:37:08 UTC (rev 378)
@@ -0,0 +1 @@
+zope
Property changes on: python-zope.exceptions/branches/upstream/current/src/zope.exceptions.egg-info/namespace_packages.txt
___________________________________________________________________
Name: svn:eol-style
+ native
Added: python-zope.exceptions/branches/upstream/current/src/zope.exceptions.egg-info/not-zip-safe
===================================================================
Added: python-zope.exceptions/branches/upstream/current/src/zope.exceptions.egg-info/requires.txt
===================================================================
--- python-zope.exceptions/branches/upstream/current/src/zope.exceptions.egg-info/requires.txt 2006-10-29 19:30:51 UTC (rev 377)
+++ python-zope.exceptions/branches/upstream/current/src/zope.exceptions.egg-info/requires.txt 2006-10-29 19:37:08 UTC (rev 378)
@@ -0,0 +1,2 @@
+zope.deprecation
+zope.interface
\ No newline at end of file
Property changes on: python-zope.exceptions/branches/upstream/current/src/zope.exceptions.egg-info/requires.txt
___________________________________________________________________
Name: svn:eol-style
+ native
Added: python-zope.exceptions/branches/upstream/current/src/zope.exceptions.egg-info/top_level.txt
===================================================================
--- python-zope.exceptions/branches/upstream/current/src/zope.exceptions.egg-info/top_level.txt 2006-10-29 19:30:51 UTC (rev 377)
+++ python-zope.exceptions/branches/upstream/current/src/zope.exceptions.egg-info/top_level.txt 2006-10-29 19:37:08 UTC (rev 378)
@@ -0,0 +1 @@
+zope
Property changes on: python-zope.exceptions/branches/upstream/current/src/zope.exceptions.egg-info/top_level.txt
___________________________________________________________________
Name: svn:eol-style
+ native
Added: python-zope.exceptions/branches/upstream/current/test.py
===================================================================
--- python-zope.exceptions/branches/upstream/current/test.py 2006-10-29 19:30:51 UTC (rev 377)
+++ python-zope.exceptions/branches/upstream/current/test.py 2006-10-29 19:37:08 UTC (rev 378)
@@ -0,0 +1,36 @@
+#!/usr/bin/env python
+##############################################################################
+#
+# Copyright (c) 2004 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""Sample test script using zope.testing.testrunner
+
+see zope.testing testrunner.txt
+
+$Id$
+"""
+
+import os, sys
+
+src = os.path.join(os.path.split(sys.argv[0])[0], 'src')
+sys.path.insert(0, src) # put at beginning to avoid one in site_packages
+
+from zope.testing import testrunner
+
+defaults = [
+ '--path', src,
+ '--package', 'zope.exceptions',
+ '--tests-pattern', '^tests$',
+ ]
+
+sys.exit(testrunner.run(defaults))
+
Property changes on: python-zope.exceptions/branches/upstream/current/test.py
___________________________________________________________________
Name: svn:eol-style
+ native
Added: python-zope.exceptions/branches/upstream/current/workspace/__init__.py
===================================================================
Property changes on: python-zope.exceptions/branches/upstream/current/workspace/__init__.py
___________________________________________________________________
Name: svn:eol-style
+ native
Added: python-zope.exceptions/branches/upstream/current/workspace/develop.py
===================================================================
--- python-zope.exceptions/branches/upstream/current/workspace/develop.py 2006-10-29 19:30:51 UTC (rev 377)
+++ python-zope.exceptions/branches/upstream/current/workspace/develop.py 2006-10-29 19:37:08 UTC (rev 378)
@@ -0,0 +1,177 @@
+##############################################################################
+#
+# Copyright (c) 2006 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""Project checkout setup script
+
+$Id$
+"""
+
+import os
+import sys
+import shutil
+import optparse
+import ConfigParser
+import urllib2
+
+DEV_SECTION = 'development'
+DEV_DEPENDS = 'depends'
+
+def bootstrap(libdir, bindir):
+ """Bootstrap our setuptools installation in the target directory."""
+
+ # make sure ez_setup is available
+ try:
+ # check if we have ez_setup available
+ import ez_setup
+
+ except ImportError, e:
+ # retrieve ez_setup.py from the interweb
+ EZ_URL = "http://peak.telecommunity.com/dist/ez_setup.py"
+
+ ez_filename = os.path.join(os.path.dirname(__file__), 'ez_setup.py')
+ file(ez_filename, 'w').write(
+ urllib2.urlopen(EZ_URL).read()
+ )
+
+ import ez_setup
+
+ os.environ['PYTHONPATH'] = (os.environ.setdefault('PYTHONPATH', '')
+ + ":" + libdir)
+ ez_setup.main(['--install-dir', libdir,
+ '--script-dir', bindir,
+ '-U', 'setuptools'])
+
+def initSetupCfg(setup_file, template_file='setup.cfg.in'):
+ """Check if the setup_file (setup.cfg) exists; if it doesn't, and
+ setup.cfg.in does, copy setup.cfg.in to setup.cfg to serve as a
+ template."""
+
+ if not(os.path.exists(setup_file)) and os.path.exists(template_file):
+ shutil.copyfile(template_file, setup_file)
+
+def updateSetupCfg(setup_file, opts):
+ """Update or create a setup.cfg (setup_file) for working on this
+ project."""
+
+ # initialize the setup file if necessary
+ initSetupCfg(setup_file)
+
+ # load the existing version
+ setup_cfg = ConfigParser.ConfigParser()
+ setup_cfg.read(setup_file)
+
+ # make sure the sections we want exist
+ if not(setup_cfg.has_section('easy_install')):
+ setup_cfg.add_section('easy_install')
+
+ if not(setup_cfg.has_section('egg_info')):
+ setup_cfg.add_section('egg_info')
+
+ # update lib dir
+ if opts.libdir is None:
+ # no libdir specified; check for one in setup.cfg
+ if setup_cfg.has_option('easy_install', 'install-dir'):
+ opts.libdir = setup_cfg.get('easy_install', 'install-dir')
+ else:
+ opts.libdir = os.path.abspath('./lib')
+
+ setup_cfg.set('easy_install', 'install-dir', opts.libdir)
+
+ # update bin dir
+ if opts.bindir is None:
+ # no bindir specified; check for one in setup.cfg
+ if setup_cfg.has_option('easy_install', 'script-dir'):
+ opts.bindir = setup_cfg.get('easy_install', 'script-dir')
+ else:
+ opts.bindir = os.path.abspath('./bin')
+
+ setup_cfg.set('easy_install', 'script-dir', opts.bindir)
+
+ # update site-dirs
+ setup_cfg.set('easy_install', 'site-dirs', opts.libdir)
+
+ # update find-links
+ setup_cfg.set('easy_install', 'find-links', opts.finddirs)
+
+ # update egg_info for development version
+ if not setup_cfg.has_option('egg_info', 'tag_build'):
+ setup_cfg.set('egg_info', 'tag_build', '.dev')
+
+ if not setup_cfg.has_option('egg_info', 'tag_svn_revision'):
+ setup_cfg.set('egg_info', 'tag_svn_revision', '1')
+
+ # store the updated version
+ setup_cfg.write(file(setup_file, 'w'))
+
+def load_dev_deps(setup_file):
+ global DEV_SECTION
+ global DEV_DEPENDS
+
+ # load the existing version
+ setup_cfg = ConfigParser.ConfigParser()
+ setup_cfg.read(setup_file)
+
+ if not(setup_cfg.has_option(DEV_SECTION, DEV_DEPENDS)):
+ return []
+ else:
+ return [n.strip() for n in
+ setup_cfg.get(DEV_SECTION, DEV_DEPENDS).strip().split()]
+
+def check_dirs(*dirs):
+ """Check that our target directories all exist."""
+
+ for d in dirs:
+ if not(os.path.exists(os.path.abspath(d))):
+ os.makedirs(os.path.abspath(d))
+
+def cmdline_parser():
+ """Create an option parser and populate our available options."""
+
+ parser = optparse.OptionParser()
+ parser.add_option("-s", "--file", dest="setup_cfg",
+ help="File to read setup configuration from." )
+ parser.add_option("-l", "--libdir", dest="libdir",
+ help="Location of Python libraries.")
+ parser.add_option("-b", "--bindir", dest="bindir",
+ help="Location of Python scripts.")
+ parser.add_option("-f", "--find-dirs", dest="finddirs",
+ help="Location to examine for package links.")
+
+ parser.set_defaults(setup_cfg="setup.cfg",
+ libdir=None,
+ bindir=None,
+ finddirs="http://download.zope.org/distribution/")
+
+ return parser
+
+def main():
+ (options, args) = cmdline_parser().parse_args()
+
+ # update setup.cfg with the lib dir, bin dir, etc
+ updateSetupCfg(options.setup_cfg, options)
+
+ # make sure that the lib directory structure of our prefix exists
+ check_dirs(options.bindir, options.libdir)
+ sys.path.insert(0, options.libdir)
+
+ # bootstrap setuptools into our libdir
+ bootstrap(options.libdir, options.bindir)
+
+ # install the development dependencies
+ from setuptools.command.easy_install import main as einstall
+ deps = load_dev_deps(options.setup_cfg)
+ if deps and len(deps) > 0:
+ einstall(deps)
+
+if __name__ == '__main__':
+ main()
Property changes on: python-zope.exceptions/branches/upstream/current/workspace/develop.py
___________________________________________________________________
Name: svn:eol-style
+ native
More information about the pkg-zope-commits
mailing list