zope.deprecation-4.1.2/ 0000775 0001750 0001750 00000000000 12455234662 016146 5 ustar tseaver tseaver 0000000 0000000 zope.deprecation-4.1.2/setup.cfg 0000664 0001750 0001750 00000000417 12455234662 017771 0 ustar tseaver tseaver 0000000 0000000 [nosetests]
nocapture = 1
cover-package = zope.deprecation
cover-erase = 1
with-doctest = 0
where = src
[aliases]
dev = develop easy_install zope.deprecation[testing]
docs = easy_install zope.deprecation[docs]
[egg_info]
tag_build =
tag_date = 0
tag_svn_revision = 0
zope.deprecation-4.1.2/buildout.cfg 0000664 0001750 0001750 00000000144 12072655562 020456 0 ustar tseaver tseaver 0000000 0000000 [buildout]
parts = test
develop = .
[test]
recipe = zc.recipe.testrunner
eggs = zope.deprecation
zope.deprecation-4.1.2/PKG-INFO 0000664 0001750 0001750 00000010216 12455234662 017243 0 ustar tseaver tseaver 0000000 0000000 Metadata-Version: 1.1
Name: zope.deprecation
Version: 4.1.2
Summary: Zope Deprecation Infrastructure
Home-page: http://pypi.python.org/pypi/zope.deprecation
Author: Zope Corporation and Contributors
Author-email: zope-dev@zope.org
License: ZPL 2.1
Description: ``zope.deprecation``
====================
.. image:: https://travis-ci.org/zopefoundation/zope.deprecation.png?branch=master
:target: https://travis-ci.org/zopefoundation/zope.deprecation
This package provides a simple function called ``deprecated(names, reason)``
to mark deprecated modules, classes, functions, methods and properties.
Please see http://docs.zope.org/zope.deprecation/ for the documentation.
``zope.deprecation`` Changelog
==============================
4.1.2 (2015-01-13)
------------------
- Do not require a ``self`` parameter for deprecated functions. See:
https://github.com/zopefoundation/zope.deprecation/pull/1
4.1.1 (2014-03-19)
------------------
- Added explicit support for Python 3.4.
4.1.0 (2013-12-20)
------------------
- Added a ``Suppressor`` context manager, allowing scoped suppression of
deprecation warnings.
- Updated ``boostrap.py`` to version 2.2.
4.0.2 (2012-12-31)
------------------
- Fleshed out PyPI Trove classifiers.
4.0.1 (2012-11-21)
------------------
- Added support for Python 3.3.
4.0.0 (2012-05-16)
------------------
- Automated build of Sphinx HTML docs and running doctest snippets via tox.
- Added Sphinx documentation:
- API docs moved from package-data README into ``docs/api.rst``.
- Snippets can be tested by running 'make doctest'.
- Updated support for continuous integration using ``tox`` and ``jenkins``.
- 100% unit test coverage.
- Added ``setup.py dev`` alias (runs ``setup.py develop`` plus installs
``nose`` and ``coverage``).
- Added ``setup.py docs`` alias (installs ``Sphinx`` and dependencies).
- Removed spurious dependency on ``zope.testing``.
- Dropped explicit support for Python 2.4 / 2.5 / 3.1.
3.5.1 (2012-03-15)
------------------
- Revert a move of `README.txt` to unbreak ``zope.app.apidoc``.
3.5.0 (2011-09-05)
------------------
- Replaced doctesting with unit testing.
- Python 3 compatibility.
3.4.1 (2011-06-07)
------------------
- Removed import cycle for ``__show__`` by defining it in the
``zope.deprecation.deprecation`` module.
- Added support to bootstrap on Jython.
- Fix ``zope.deprecation.warn()`` to make the signature identical to
``warnings.warn()`` and to check for .pyc and .pyo files.
3.4.0 (2007-07-19)
------------------
- Release 3.4 final, corresponding to Zope 3.4.
3.3.0 (2007-02-18)
------------------
- Corresponds to the version of the ``zope.deprecation`` package shipped as
part of the Zope 3.3.0 release.
Platform: UNKNOWN
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.6
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.2
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Framework :: Zope3
zope.deprecation-4.1.2/tox.ini 0000664 0001750 0001750 00000001726 12455234515 017464 0 ustar tseaver tseaver 0000000 0000000 [tox]
envlist =
# Jython support pending 2.7 support, due 2012-07-15 or so. See:
# http://fwierzbicki.blogspot.com/2012/03/adconion-to-fund-jython-27.html
# py26,py27,py32,jython,pypy,coverage
py26,py27,py32,py33,py34,pypy,pypy3,coverage,docs
[testenv]
commands =
python setup.py test -q
[testenv:jython]
commands =
jython setup.py test -q
[testenv:coverage]
basepython =
python2.6
commands =
# The installed version messes up nose's test discovery / coverage reporting
# So, we uninstall that from the environment, and then install the editable
# version, before running nosetests.
pip uninstall -y zope.deprecation
pip install -e .
nosetests --with-xunit --with-xcoverage
deps =
nose
coverage
nosexcover
[testenv:docs]
basepython =
python2.6
commands =
sphinx-build -b html -d docs/_build/doctrees docs docs/_build/html
sphinx-build -b doctest -d docs/_build/doctrees docs docs/_build/doctest
deps =
Sphinx
zope.deprecation-4.1.2/.gitignore 0000664 0001750 0001750 00000000177 12167127737 020147 0 ustar tseaver tseaver 0000000 0000000 *.pyc
*.egg-info
__pycache__
_build
docs/_build
.tox
.coverage
nosetests.xml
coverage.xml
.installed.cfg
bin
develop-eggs
eggs
zope.deprecation-4.1.2/setup.py 0000664 0001750 0001750 00000004660 12455234652 017665 0 ustar tseaver tseaver 0000000 0000000 ##############################################################################
#
# Copyright (c) 2006 Zope Foundation 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.
#
##############################################################################
# This package is developed by the Zope Toolkit project, documented here:
# http://docs.zope.org/zopetoolkit
# When developing and releasing this package, please follow the documented
# Zope Toolkit policies as described by this documentation.
##############################################################################
"""Setup for zope.deprecation package
"""
import os
from setuptools import setup, find_packages
def read(*rnames):
return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
setup(
name='zope.deprecation',
version='4.1.2',
url='http://pypi.python.org/pypi/zope.deprecation',
license='ZPL 2.1',
description='Zope Deprecation Infrastructure',
author='Zope Corporation and Contributors',
author_email='zope-dev@zope.org',
long_description=(
read('README.rst')
+ '\n\n' +
read('CHANGES.rst')
),
classifiers=[
"Intended Audience :: Developers",
"Programming Language :: Python",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 2.6",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.2",
"Programming Language :: Python :: 3.3",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Framework :: Zope3",
],
package_dir = {'': 'src'},
packages=find_packages('src'),
namespace_packages=['zope',],
install_requires = 'setuptools',
include_package_data = True,
zip_safe = False,
test_suite='zope.deprecation',
extras_require={
'docs': ['Sphinx'],
'testing': ['nose', 'coverage'],
},
)
zope.deprecation-4.1.2/bootstrap.py 0000664 0001750 0001750 00000014545 12455232531 020537 0 ustar tseaver tseaver 0000000 0000000 ##############################################################################
#
# Copyright (c) 2006 Zope Foundation 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.
#
##############################################################################
"""Bootstrap a buildout-based project
Simply run this script in a directory containing a buildout.cfg.
The script accepts buildout command-line options, so you can
use the -c option to specify an alternate configuration file.
"""
import os
import shutil
import sys
import tempfile
from optparse import OptionParser
tmpeggs = tempfile.mkdtemp()
usage = '''\
[DESIRED PYTHON FOR BUILDOUT] bootstrap.py [options]
Bootstraps a buildout-based project.
Simply run this script in a directory containing a buildout.cfg, using the
Python that you want bin/buildout to use.
Note that by using --find-links to point to local resources, you can keep
this script from going over the network.
'''
parser = OptionParser(usage=usage)
parser.add_option("-v", "--version", help="use a specific zc.buildout version")
parser.add_option("-t", "--accept-buildout-test-releases",
dest='accept_buildout_test_releases',
action="store_true", default=False,
help=("Normally, if you do not specify a --version, the "
"bootstrap script and buildout gets the newest "
"*final* versions of zc.buildout and its recipes and "
"extensions for you. If you use this flag, "
"bootstrap and buildout will get the newest releases "
"even if they are alphas or betas."))
parser.add_option("-c", "--config-file",
help=("Specify the path to the buildout configuration "
"file to be used."))
parser.add_option("-f", "--find-links",
help=("Specify a URL to search for buildout releases"))
parser.add_option("--allow-site-packages",
action="store_true", default=False,
help=("Let bootstrap.py use existing site packages"))
parser.add_option("--setuptools-version",
help="use a specific setuptools version")
options, args = parser.parse_args()
######################################################################
# load/install setuptools
try:
if options.allow_site_packages:
import setuptools
import pkg_resources
from urllib.request import urlopen
except ImportError:
from urllib2 import urlopen
ez = {}
exec(urlopen('https://bootstrap.pypa.io/ez_setup.py').read(), ez)
if not options.allow_site_packages:
# ez_setup imports site, which adds site packages
# this will remove them from the path to ensure that incompatible versions
# of setuptools are not in the path
import site
# inside a virtualenv, there is no 'getsitepackages'.
# We can't remove these reliably
if hasattr(site, 'getsitepackages'):
for sitepackage_path in site.getsitepackages():
sys.path[:] = [x for x in sys.path if sitepackage_path not in x]
setup_args = dict(to_dir=tmpeggs, download_delay=0)
if options.setuptools_version is not None:
setup_args['version'] = options.setuptools_version
ez['use_setuptools'](**setup_args)
import setuptools
import pkg_resources
# This does not (always?) update the default working set. We will
# do it.
for path in sys.path:
if path not in pkg_resources.working_set.entries:
pkg_resources.working_set.add_entry(path)
######################################################################
# Install buildout
ws = pkg_resources.working_set
cmd = [sys.executable, '-c',
'from setuptools.command.easy_install import main; main()',
'-mZqNxd', tmpeggs]
find_links = os.environ.get(
'bootstrap-testing-find-links',
options.find_links or
('http://downloads.buildout.org/'
if options.accept_buildout_test_releases else None)
)
if find_links:
cmd.extend(['-f', find_links])
setuptools_path = ws.find(
pkg_resources.Requirement.parse('setuptools')).location
requirement = 'zc.buildout'
version = options.version
if version is None and not options.accept_buildout_test_releases:
# Figure out the most recent final version of zc.buildout.
import setuptools.package_index
_final_parts = '*final-', '*final'
def _final_version(parsed_version):
try:
return not parsed_version.is_prerelease
except AttributeError:
# Older setuptools
for part in parsed_version:
if (part[:1] == '*') and (part not in _final_parts):
return False
return True
index = setuptools.package_index.PackageIndex(
search_path=[setuptools_path])
if find_links:
index.add_find_links((find_links,))
req = pkg_resources.Requirement.parse(requirement)
if index.obtain(req) is not None:
best = []
bestv = None
for dist in index[req.project_name]:
distv = dist.parsed_version
if _final_version(distv):
if bestv is None or distv > bestv:
best = [dist]
bestv = distv
elif distv == bestv:
best.append(dist)
if best:
best.sort()
version = best[-1].version
if version:
requirement = '=='.join((requirement, version))
cmd.append(requirement)
import subprocess
if subprocess.call(cmd, env=dict(os.environ, PYTHONPATH=setuptools_path)) != 0:
raise Exception(
"Failed to execute command:\n%s" % repr(cmd)[1:-1])
######################################################################
# Import and run buildout
ws.add_entry(tmpeggs)
ws.require(requirement)
import zc.buildout.buildout
if not [a for a in args if '=' not in a]:
args.append('bootstrap')
# if -c was provided, we push it back into args for buildout' main function
if options.config_file is not None:
args[0:0] = ['-c', options.config_file]
zc.buildout.buildout.main(args)
shutil.rmtree(tmpeggs)
zope.deprecation-4.1.2/.bzrignore 0000664 0001750 0001750 00000000110 12072655562 020141 0 ustar tseaver tseaver 0000000 0000000 .coverage
*.egg-info
__pycache__
.tox
nosetests.xml
coverage.xml
_build
zope.deprecation-4.1.2/.travis.yml 0000664 0001750 0001750 00000000321 12455234502 020244 0 ustar tseaver tseaver 0000000 0000000 language: python
sudo: false
python:
- 2.6
- 2.7
- 3.2
- 3.3
- 3.4
- pypy
- pypy3
install:
- pip install .
script:
- python setup.py test -q
notifications:
email: false
zope.deprecation-4.1.2/src/ 0000775 0001750 0001750 00000000000 12455234662 016735 5 ustar tseaver tseaver 0000000 0000000 zope.deprecation-4.1.2/src/zope.deprecation.egg-info/ 0000775 0001750 0001750 00000000000 12455234662 023700 5 ustar tseaver tseaver 0000000 0000000 zope.deprecation-4.1.2/src/zope.deprecation.egg-info/top_level.txt 0000664 0001750 0001750 00000000005 12455234660 026423 0 ustar tseaver tseaver 0000000 0000000 zope
zope.deprecation-4.1.2/src/zope.deprecation.egg-info/SOURCES.txt 0000664 0001750 0001750 00000003702 12455234662 025566 0 ustar tseaver tseaver 0000000 0000000 .bzrignore
.gitignore
.travis.yml
CHANGES.rst
COPYRIGHT.txt
LICENSE.txt
MANIFEST.in
README.rst
bootstrap.py
buildout.cfg
setup.cfg
setup.py
tox.ini
docs/Makefile
docs/api.rst
docs/conf.py
docs/hacking.rst
docs/index.rst
docs/make.bat
docs/_build/doctest/output.txt
docs/_build/doctrees/api.doctree
docs/_build/doctrees/environment.pickle
docs/_build/doctrees/hacking.doctree
docs/_build/doctrees/index.doctree
docs/_build/html/.buildinfo
docs/_build/html/api.html
docs/_build/html/genindex.html
docs/_build/html/hacking.html
docs/_build/html/index.html
docs/_build/html/objects.inv
docs/_build/html/search.html
docs/_build/html/searchindex.js
docs/_build/html/_sources/api.txt
docs/_build/html/_sources/hacking.txt
docs/_build/html/_sources/index.txt
docs/_build/html/_static/ajax-loader.gif
docs/_build/html/_static/basic.css
docs/_build/html/_static/comment-bright.png
docs/_build/html/_static/comment-close.png
docs/_build/html/_static/comment.png
docs/_build/html/_static/default.css
docs/_build/html/_static/doctools.js
docs/_build/html/_static/down-pressed.png
docs/_build/html/_static/down.png
docs/_build/html/_static/file.png
docs/_build/html/_static/jquery.js
docs/_build/html/_static/minus.png
docs/_build/html/_static/plus.png
docs/_build/html/_static/pygments.css
docs/_build/html/_static/searchtools.js
docs/_build/html/_static/sidebar.js
docs/_build/html/_static/underscore.js
docs/_build/html/_static/up-pressed.png
docs/_build/html/_static/up.png
docs/_build/html/_static/websupport.js
src/coverage.xml
src/zope/__init__.py
src/zope.deprecation.egg-info/PKG-INFO
src/zope.deprecation.egg-info/SOURCES.txt
src/zope.deprecation.egg-info/dependency_links.txt
src/zope.deprecation.egg-info/namespace_packages.txt
src/zope.deprecation.egg-info/not-zip-safe
src/zope.deprecation.egg-info/requires.txt
src/zope.deprecation.egg-info/top_level.txt
src/zope/deprecation/__init__.py
src/zope/deprecation/deprecation.py
src/zope/deprecation/fixture.py
src/zope/deprecation/tests.py zope.deprecation-4.1.2/src/zope.deprecation.egg-info/PKG-INFO 0000664 0001750 0001750 00000010216 12455234660 024773 0 ustar tseaver tseaver 0000000 0000000 Metadata-Version: 1.1
Name: zope.deprecation
Version: 4.1.2
Summary: Zope Deprecation Infrastructure
Home-page: http://pypi.python.org/pypi/zope.deprecation
Author: Zope Corporation and Contributors
Author-email: zope-dev@zope.org
License: ZPL 2.1
Description: ``zope.deprecation``
====================
.. image:: https://travis-ci.org/zopefoundation/zope.deprecation.png?branch=master
:target: https://travis-ci.org/zopefoundation/zope.deprecation
This package provides a simple function called ``deprecated(names, reason)``
to mark deprecated modules, classes, functions, methods and properties.
Please see http://docs.zope.org/zope.deprecation/ for the documentation.
``zope.deprecation`` Changelog
==============================
4.1.2 (2015-01-13)
------------------
- Do not require a ``self`` parameter for deprecated functions. See:
https://github.com/zopefoundation/zope.deprecation/pull/1
4.1.1 (2014-03-19)
------------------
- Added explicit support for Python 3.4.
4.1.0 (2013-12-20)
------------------
- Added a ``Suppressor`` context manager, allowing scoped suppression of
deprecation warnings.
- Updated ``boostrap.py`` to version 2.2.
4.0.2 (2012-12-31)
------------------
- Fleshed out PyPI Trove classifiers.
4.0.1 (2012-11-21)
------------------
- Added support for Python 3.3.
4.0.0 (2012-05-16)
------------------
- Automated build of Sphinx HTML docs and running doctest snippets via tox.
- Added Sphinx documentation:
- API docs moved from package-data README into ``docs/api.rst``.
- Snippets can be tested by running 'make doctest'.
- Updated support for continuous integration using ``tox`` and ``jenkins``.
- 100% unit test coverage.
- Added ``setup.py dev`` alias (runs ``setup.py develop`` plus installs
``nose`` and ``coverage``).
- Added ``setup.py docs`` alias (installs ``Sphinx`` and dependencies).
- Removed spurious dependency on ``zope.testing``.
- Dropped explicit support for Python 2.4 / 2.5 / 3.1.
3.5.1 (2012-03-15)
------------------
- Revert a move of `README.txt` to unbreak ``zope.app.apidoc``.
3.5.0 (2011-09-05)
------------------
- Replaced doctesting with unit testing.
- Python 3 compatibility.
3.4.1 (2011-06-07)
------------------
- Removed import cycle for ``__show__`` by defining it in the
``zope.deprecation.deprecation`` module.
- Added support to bootstrap on Jython.
- Fix ``zope.deprecation.warn()`` to make the signature identical to
``warnings.warn()`` and to check for .pyc and .pyo files.
3.4.0 (2007-07-19)
------------------
- Release 3.4 final, corresponding to Zope 3.4.
3.3.0 (2007-02-18)
------------------
- Corresponds to the version of the ``zope.deprecation`` package shipped as
part of the Zope 3.3.0 release.
Platform: UNKNOWN
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.6
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.2
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Framework :: Zope3
zope.deprecation-4.1.2/src/zope.deprecation.egg-info/dependency_links.txt 0000664 0001750 0001750 00000000001 12455234660 027744 0 ustar tseaver tseaver 0000000 0000000
zope.deprecation-4.1.2/src/zope.deprecation.egg-info/not-zip-safe 0000664 0001750 0001750 00000000001 12072656510 026121 0 ustar tseaver tseaver 0000000 0000000
zope.deprecation-4.1.2/src/zope.deprecation.egg-info/namespace_packages.txt 0000664 0001750 0001750 00000000005 12455234660 030224 0 ustar tseaver tseaver 0000000 0000000 zope
zope.deprecation-4.1.2/src/zope.deprecation.egg-info/requires.txt 0000664 0001750 0001750 00000000063 12455234660 026275 0 ustar tseaver tseaver 0000000 0000000 setuptools
[docs]
Sphinx
[testing]
nose
coverage
zope.deprecation-4.1.2/src/coverage.xml 0000664 0001750 0001750 00000013574 12255113771 021257 0 ustar tseaver tseaver 0000000 0000000
zope.deprecation-4.1.2/src/zope/ 0000775 0001750 0001750 00000000000 12455234662 017712 5 ustar tseaver tseaver 0000000 0000000 zope.deprecation-4.1.2/src/zope/__init__.py 0000664 0001750 0001750 00000000070 12072655562 022021 0 ustar tseaver tseaver 0000000 0000000 __import__('pkg_resources').declare_namespace(__name__)
zope.deprecation-4.1.2/src/zope/deprecation/ 0000775 0001750 0001750 00000000000 12455234662 022207 5 ustar tseaver tseaver 0000000 0000000 zope.deprecation-4.1.2/src/zope/deprecation/__init__.py 0000664 0001750 0001750 00000001766 12255113704 024321 0 ustar tseaver tseaver 0000000 0000000 ##############################################################################
#
# Copyright (c) 2005 Zope Foundation 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.
#
##############################################################################
"""Deprecation of modules / APIs.
"""
__docformat__ = "reStructuredText"
from zope.deprecation.deprecation import deprecated
from zope.deprecation.deprecation import deprecate
from zope.deprecation.deprecation import moved
from zope.deprecation.deprecation import ShowSwitch
from zope.deprecation.deprecation import __show__
from zope.deprecation.deprecation import Suppressor
zope.deprecation-4.1.2/src/zope/deprecation/fixture.py 0000664 0001750 0001750 00000000032 12072655562 024243 0 ustar tseaver tseaver 0000000 0000000 # used by tests
abc = 1
zope.deprecation-4.1.2/src/zope/deprecation/tests.py 0000664 0001750 0001750 00000041556 12444603107 023726 0 ustar tseaver tseaver 0000000 0000000 import sys
import types
import unittest
class TestShowSwitch(unittest.TestCase):
def _makeOne(self):
from zope.deprecation import ShowSwitch
return ShowSwitch()
def test_on(self):
switch = self._makeOne()
switch.stack.append(False)
switch.on()
self.assertEqual(switch.stack, [])
def test_off(self):
switch = self._makeOne()
switch.off()
self.assertEqual(switch.stack, [False])
def test_reset(self):
switch = self._makeOne()
switch.stack.append(False)
switch.reset()
self.assertEqual(switch.stack, [])
def test_call_true(self):
switch = self._makeOne()
self.assertEqual(switch(), True)
def test_call_false(self):
switch = self._makeOne()
switch.stack.append(False)
self.assertEqual(switch(), False)
def test_repr_on(self):
switch = self._makeOne()
self.assertEqual(repr(switch), '')
def test_repr_off(self):
switch = self._makeOne()
switch.stack.append(False)
self.assertEqual(repr(switch), '')
def test___show__global(self):
from zope.deprecation import __show__
self.assertEqual(self._makeOne().__class__, __show__.__class__)
class TestSuppressor(unittest.TestCase):
def _makeOne(self):
from zope.deprecation import Suppressor
return Suppressor()
def test_it(self):
from zope.deprecation import __show__
self.assertEqual(__show__.stack, [])
with self._makeOne():
self.assertEqual(__show__.stack, [False])
self.assertEqual(__show__.stack, [])
class WarningsSetupBase(object):
def setUp(self):
from zope.deprecation import deprecation
self.oldwarnings = deprecation.warnings
self.oldshow = deprecation.__show__
self.warnings = DummyWarningsModule()
self.show = DummyShow()
deprecation.warnings = self.warnings
deprecation.__show__ = self.show
def tearDown(self):
from zope.deprecation import deprecation
deprecation.warnings = self.oldwarnings
deprecation.__show__ = self.oldshow
class TestDeprecationProxy(WarningsSetupBase, unittest.TestCase):
def _getTargetClass(self):
from zope.deprecation.deprecation import DeprecationProxy
return DeprecationProxy
def _makeOne(self, module):
cls = self._getTargetClass()
return cls(module)
def test_deprecate_and__getattribute__string(self):
tests = _getTestsModule()
proxy = self._makeOne(tests)
proxy.deprecate('ClassFixture', 'hello')
self.assertEqual(proxy.ClassFixture, ClassFixture)
self.assertEqual(
self.warnings.w,
[('ClassFixture: hello', DeprecationWarning, 2)])
def test_deprecate_and__getattribute__sequence(self):
tests = _getTestsModule()
proxy = self._makeOne(tests)
proxy.deprecate(('ClassFixture', 'ClassFixture2'), 'hello')
self.assertEqual(proxy.ClassFixture, ClassFixture)
self.assertEqual(proxy.ClassFixture2, ClassFixture2)
self.assertEqual(
self.warnings.w,
[('ClassFixture: hello', DeprecationWarning, 2),
('ClassFixture2: hello', DeprecationWarning, 2)]
)
def test_deprecate_and__getattribute__noshow(self):
tests = _getTestsModule()
proxy = self._makeOne(tests)
proxy.deprecate('ClassFixture', 'hello')
self.show.on = False
self.assertEqual(proxy.ClassFixture, ClassFixture)
self.assertEqual(
self.warnings.w, [])
def test___getattribute____class__(self):
tests = _getTestsModule()
proxy = self._makeOne(tests)
self.assertEqual(proxy.__class__, types.ModuleType)
def test___getattribute___deprecate(self):
tests = _getTestsModule()
proxy = self._makeOne(tests)
self.assertEqual(type(proxy.deprecate), types.MethodType)
def test___getattribute__missing(self):
tests = _getTestsModule()
proxy = self._makeOne(tests)
self.assertRaises(AttributeError, getattr, proxy, 'wontbethere')
def test___setattr__owned(self):
tests = _getTestsModule()
proxy = self._makeOne(tests)
proxy._DeprecationProxy__deprecated = {'foo':'bar'}
self.assertEqual(proxy._DeprecationProxy__deprecated, {'foo':'bar'})
def test___setattr__notowned(self):
tests = _getTestsModule()
proxy = self._makeOne(tests)
try:
proxy.foo = 'bar'
self.assertEqual(tests.foo, 'bar')
finally:
del tests.foo
def test___delattr__owned(self):
tests = _getTestsModule()
proxy = self._makeOne(tests)
del proxy._DeprecationProxy__deprecated
self.assertRaises(AttributeError, getattr, proxy,
'_DeprecationProxy__deprecated')
def test___delattr__notowned(self):
tests = _getTestsModule()
proxy = self._makeOne(tests)
tests.foo = 'bar'
del proxy.foo
self.assertRaises(AttributeError, getattr, tests, 'foo')
class TestDeprecatedModule(WarningsSetupBase, unittest.TestCase):
def _getTargetClass(self):
from zope.deprecation.deprecation import DeprecatedModule
return DeprecatedModule
def _makeOne(self, module, msg):
cls = self._getTargetClass()
return cls(module, msg)
def test___getattribute____class__(self):
tests = _getTestsModule()
proxy = self._makeOne(tests, 'hello')
self.assertEqual(proxy.__class__, types.ModuleType)
def test___getattribute____owned__(self):
tests = _getTestsModule()
proxy = self._makeOne(tests, 'hello')
self.assertEqual(proxy._DeprecatedModule__msg, 'hello')
def test___getattribute___deprecated(self):
tests = _getTestsModule()
proxy = self._makeOne(tests, 'hello')
self.assertEqual(proxy.ClassFixture, ClassFixture)
self.assertEqual(
self.warnings.w,
[('hello', DeprecationWarning, 2)]
)
def test___getattribute__missing(self):
tests = _getTestsModule()
proxy = self._makeOne(tests, 'hello')
self.assertRaises(AttributeError, getattr, proxy, 'wontbethere')
self.assertEqual(
self.warnings.w,
[('hello', DeprecationWarning, 2)]
)
def test___getattribute___noshow(self):
tests = _getTestsModule()
self.show.on = False
proxy = self._makeOne(tests, 'hello')
self.assertEqual(proxy.ClassFixture, ClassFixture)
self.assertEqual(
self.warnings.w, [])
def test___setattr__owned(self):
tests = _getTestsModule()
proxy = self._makeOne(tests, 'hello')
proxy._DeprecatedModule__msg = 'foo'
self.assertEqual(proxy._DeprecatedModule__msg, 'foo')
def test___setattr__notowned(self):
tests = _getTestsModule()
proxy = self._makeOne(tests, 'hello')
try:
proxy.foo = 'bar'
self.assertEqual(tests.foo, 'bar')
finally:
del tests.foo
def test___delattr__owned(self):
tests = _getTestsModule()
proxy = self._makeOne(tests, 'hello')
del proxy._DeprecatedModule__msg
self.assertRaises(AttributeError, getattr, proxy,
'_DeprecatedModule__msg')
def test___delattr__notowned(self):
tests = _getTestsModule()
proxy = self._makeOne(tests, 'hello')
tests.foo = 'bar'
del proxy.foo
self.assertRaises(AttributeError, getattr, tests, 'foo')
class TestDeprecatedGetProperty(WarningsSetupBase, unittest.TestCase):
def _getTargetClass(self):
from zope.deprecation.deprecation import DeprecatedGetProperty
return DeprecatedGetProperty
def _makeOne(self, prop, msg):
cls = self._getTargetClass()
return cls(prop, msg)
def test___get__(self):
prop = DummyProperty()
proxy = self._makeOne(prop, 'hello')
self.assertEqual(proxy.__get__('inst', 'cls'), None)
self.assertEqual(prop.inst, 'inst')
self.assertEqual(prop.cls, 'cls')
self.assertEqual(
self.warnings.w,
[('hello', DeprecationWarning, 2)]
)
def test___get__noshow(self):
prop = DummyProperty()
self.show.on = False
proxy = self._makeOne(prop, 'hello')
self.assertEqual(proxy.__get__('inst', 'cls'), None)
self.assertEqual(prop.inst, 'inst')
self.assertEqual(prop.cls, 'cls')
self.assertEqual(self.warnings.w, [])
class TestDeprecatedGetSetProperty(TestDeprecatedGetProperty):
def _getTargetClass(self):
from zope.deprecation.deprecation import DeprecatedGetSetProperty
return DeprecatedGetSetProperty
def test___set__(self):
prop = DummyProperty()
proxy = self._makeOne(prop, 'hello')
self.assertEqual(proxy.__set__('inst', 'prop'), None)
self.assertEqual(prop.inst, 'inst')
self.assertEqual(prop.prop, 'prop')
self.assertEqual(
self.warnings.w,
[('hello', DeprecationWarning, 2)]
)
def test___set__noshow(self):
prop = DummyProperty()
self.show.on = False
proxy = self._makeOne(prop, 'hello')
self.assertEqual(proxy.__set__('inst', 'prop'), None)
self.assertEqual(prop.inst, 'inst')
self.assertEqual(prop.prop, 'prop')
self.assertEqual(self.warnings.w, [])
class TestDeprecatedSetGetDeleteProperty(TestDeprecatedGetSetProperty):
def _getTargetClass(self):
from zope.deprecation.deprecation import DeprecatedGetSetDeleteProperty
return DeprecatedGetSetDeleteProperty
def test___delete__(self):
prop = DummyProperty()
proxy = self._makeOne(prop, 'hello')
self.assertEqual(proxy.__delete__('inst'), None)
self.assertEqual(prop.inst, 'inst')
self.assertEqual(
self.warnings.w,
[('hello', DeprecationWarning, 2)]
)
def test___delete__noshow(self):
prop = DummyProperty()
proxy = self._makeOne(prop, 'hello')
self.assertEqual(proxy.__delete__('inst'), None)
self.assertEqual(prop.inst, 'inst')
self.assertEqual(
self.warnings.w,
[('hello', DeprecationWarning, 2)]
)
class TestDeprecatedMethod(WarningsSetupBase, unittest.TestCase):
def _callFUT(self, method, message):
from zope.deprecation.deprecation import DeprecatedMethod
return DeprecatedMethod(method, message)
def fixture(self, a, b, c=1):
return 'fixture'
def test_it(self):
result = self._callFUT(self.fixture, 'hello')
self.assertEqual(result('a', 'b', c=2), 'fixture')
self.assertEqual(
self.warnings.w,
[('hello', DeprecationWarning, 2)]
)
def test_it_noshow(self):
result = self._callFUT(self.fixture, 'hello')
self.show.on = False
self.assertEqual(result('a', 'b', c=2), 'fixture')
self.assertEqual(self.warnings.w, [])
class Test_deprecated(WarningsSetupBase, unittest.TestCase):
def setUp(self):
super(Test_deprecated, self).setUp()
self.mod = _getTestsModule()
def tearDown(self):
super(Test_deprecated, self).tearDown()
sys.modules['zope.deprecation.tests'] = self.mod
def _callFUT(self, spec, message):
from zope.deprecation.deprecation import deprecated
return deprecated(spec, message)
def test_string_specifier(self):
self._callFUT('ClassFixture', 'hello')
mod = _getTestsModule()
self.assertNotEqual(mod, self.mod)
self.assertEqual(mod.ClassFixture, ClassFixture)
self.assertEqual(
self.warnings.w,
[('ClassFixture: hello', DeprecationWarning, 2)])
def test_string_specifier_sys_modules_already_mutated(self):
from zope.deprecation.deprecation import DeprecationProxy
mod = _getTestsModule()
new = sys.modules['zope.deprecation.tests'] = DeprecationProxy(mod)
self._callFUT('ClassFixture', 'hello')
self.assertEqual(new.ClassFixture, ClassFixture)
self.assertEqual(
self.warnings.w,
[('ClassFixture: hello', DeprecationWarning, 2)])
def test_function_specifier(self):
result = self._callFUT(functionfixture, 'hello')
self.assertNotEqual(result, functionfixture)
self.assertEqual(self.warnings.w, [])
result()
self.assertEqual(
self.warnings.w,
[('hello', DeprecationWarning, 2)])
def test_module_specifier(self):
mod = _getTestsModule()
result = self._callFUT(mod, 'hello')
self.assertEqual(self.warnings.w, [])
self.assertEqual(result.ClassFixture, ClassFixture)
self.assertEqual(
self.warnings.w,
[('hello', DeprecationWarning, 2)])
def test_getproperty_specifier(self):
prop = DummyGetProperty()
result = self._callFUT(prop, 'hello')
self.assertEqual(self.warnings.w, [])
self.assertEqual(result.__get__('inst', 'cls'), None)
self.assertEqual(
self.warnings.w,
[('hello', DeprecationWarning, 2)])
def test_getsetproperty_specifier(self):
prop = DummyGetSetProperty()
result = self._callFUT(prop, 'hello')
self.assertEqual(self.warnings.w, [])
self.assertEqual(result.__set__('inst', 'prop'), None)
self.assertEqual(
self.warnings.w,
[('hello', DeprecationWarning, 2)])
def test_getsetdeleteproperty_specifier(self):
prop = DummyGetSetDeleteProperty()
result = self._callFUT(prop, 'hello')
self.assertEqual(self.warnings.w, [])
self.assertEqual(result.__delete__('inst'), None)
self.assertEqual(
self.warnings.w,
[('hello', DeprecationWarning, 2)])
class Test_deprecate(WarningsSetupBase, unittest.TestCase):
def _getTargetClass(self):
from zope.deprecation.deprecation import deprecate
return deprecate
def _makeOne(self, msg):
cls = self._getTargetClass()
return cls(msg)
def fixture(self):
return 'fixture'
def test___call__(self):
proxy = self._makeOne('hello')
result = proxy(functionfixture)
self.assertEqual(result(), None)
self.assertEqual(
self.warnings.w,
[('hello', DeprecationWarning, 2)])
class Test_moved(WarningsSetupBase, unittest.TestCase):
def setUp(self):
super(Test_moved, self).setUp()
def tearDown(self):
super(Test_moved, self).tearDown()
del _getTestsModule().__dict__['abc']
def _callFUT(self, to_location, unsupported_in):
from zope.deprecation.deprecation import moved
return moved(to_location, unsupported_in)
def test_unsupported_None(self):
self._callFUT('zope.deprecation.fixture', None)
self.assertEqual(
self.warnings.w,
[('zope.deprecation.tests has moved to zope.deprecation.fixture.',
DeprecationWarning, 3)])
def test_unsupported_not_None(self):
self._callFUT('zope.deprecation.fixture', '1.3')
self.assertEqual(
self.warnings.w,
[('zope.deprecation.tests has moved to zope.deprecation.fixture. '
'Import of zope.deprecation.tests will become unsupported in 1.3',
DeprecationWarning, 3)])
class Test_import_aliases(unittest.TestCase):
def test_it(self):
for name in ('deprecated', 'deprecate', 'moved', 'ShowSwitch',
'__show__'):
real = getattr(sys.modules['zope.deprecation.deprecation'], name)
alias = getattr(sys.modules['zope.deprecation'], name)
self.assertEqual(real, alias, (real, alias))
class DummyWarningsModule(object):
def __init__(self):
self.w = []
def warn(self, msg, type, stacklevel):
self.w.append((msg, type, stacklevel))
class DummyGetProperty(object):
def __get__(self, inst, cls):
self.inst = inst
self.cls = cls
class DummyGetSetProperty(DummyGetProperty):
def __set__(self, inst, prop):
self.inst = inst
self.prop = prop
class DummyGetSetDeleteProperty(DummyGetSetProperty):
def __delete__(self, inst):
self.inst = inst
DummyProperty = DummyGetSetDeleteProperty
def _getTestsModule():
__import__('zope.deprecation.tests')
return sys.modules['zope.deprecation.tests']
class DummyShow(object):
def __init__(self):
self.on = True
def __call__(self):
if self.on:
return True
return False
class ClassFixture(object): pass
class ClassFixture2(object): pass
def functionfixture(): pass
zope.deprecation-4.1.2/src/zope/deprecation/deprecation.py 0000664 0001750 0001750 00000015677 12444603107 025066 0 ustar tseaver tseaver 0000000 0000000 ##############################################################################
#
# Copyright (c) 2005 Zope Foundation 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.
#
##############################################################################
"""Deprecation Support
This module provides utilities to ease the development of backward-compatible
code.
"""
__docformat__ = "reStructuredText"
import sys
import types
import warnings
PY3 = sys.version_info[0] == 3
if PY3: #pragma NO COVER
str_and_sequence_types = (str, list, tuple)
else: #pragma NO COVER
str_and_sequence_types = (basestring, list, tuple)
class ShowSwitch(object):
"""Simple stack-based switch."""
def __init__(self):
self.stack = []
def on(self):
self.stack.pop()
def off(self):
self.stack.append(False)
def reset(self):
self.stack = []
def __call__(self):
return self.stack == []
def __repr__(self):
return '' %(self() and 'on' or 'off')
# This attribute can be used to temporarly deactivate deprecation
# warnings, so that backward-compatibility code can import other
# backward-compatiblity components without warnings being produced.
__show__ = ShowSwitch()
class Suppressor(object):
def __enter__(self):
__show__.off()
def __exit__(self, *ignored):
__show__.on()
ogetattr = object.__getattribute__
class DeprecationProxy(object):
def __init__(self, module):
self.__original_module = module
self.__deprecated = {}
def deprecate(self, names, message):
"""Deprecate the given names."""
if not isinstance(names, (tuple, list)):
names = (names,)
for name in names:
self.__deprecated[name] = message
def __getattribute__(self, name):
if name == 'deprecate' or name.startswith('_DeprecationProxy__'):
return ogetattr(self, name)
if name == '__class__':
return types.ModuleType
if name in ogetattr(self, '_DeprecationProxy__deprecated'):
if __show__():
warnings.warn(
name + ': ' + self.__deprecated[name],
DeprecationWarning, 2)
return getattr(ogetattr(self, '_DeprecationProxy__original_module'),
name)
def __setattr__(self, name, value):
if name.startswith('_DeprecationProxy__'):
return object.__setattr__(self, name, value)
setattr(self.__original_module, name, value)
def __delattr__(self, name):
if name.startswith('_DeprecationProxy__'):
return object.__delattr__(self, name)
delattr(self.__original_module, name)
class DeprecatedModule(object):
def __init__(self, module, msg):
self.__original_module = module
self.__msg = msg
def __getattribute__(self, name):
if name.startswith('_DeprecatedModule__'):
return ogetattr(self, name)
if name == '__class__':
return types.ModuleType
if __show__():
warnings.warn(self.__msg, DeprecationWarning, 2)
return getattr(ogetattr(self, '_DeprecatedModule__original_module'),
name)
def __setattr__(self, name, value):
if name.startswith('_DeprecatedModule__'):
return object.__setattr__(self, name, value)
setattr(self.__original_module, name, value)
def __delattr__(self, name):
if name.startswith('_DeprecatedModule__'):
return object.__delattr__(self, name)
delattr(self.__original_module, name)
class DeprecatedGetProperty(object):
def __init__(self, prop, message):
self.message = message
self.prop = prop
def __get__(self, inst, klass):
if __show__():
warnings.warn(self.message, DeprecationWarning, 2)
return self.prop.__get__(inst, klass)
class DeprecatedGetSetProperty(DeprecatedGetProperty):
def __set__(self, inst, prop):
if __show__():
warnings.warn(self.message, DeprecationWarning, 2)
self.prop.__set__(inst, prop)
class DeprecatedGetSetDeleteProperty(DeprecatedGetSetProperty):
def __delete__(self, inst):
if __show__():
warnings.warn(self.message, DeprecationWarning, 2)
self.prop.__delete__(inst)
def DeprecatedMethod(method, message):
def deprecated_method(*args, **kw):
if __show__():
warnings.warn(message, DeprecationWarning, 2)
return method(*args, **kw)
return deprecated_method
def deprecated(specifier, message):
"""Deprecate the given names."""
# A string specifier (or list of strings) means we're called
# top-level in a module and are to deprecate things inside this
# module
if isinstance(specifier, str_and_sequence_types):
globals = sys._getframe(1).f_globals
modname = globals['__name__']
if not isinstance(sys.modules[modname], DeprecationProxy):
sys.modules[modname] = DeprecationProxy(sys.modules[modname])
sys.modules[modname].deprecate(specifier, message)
# Anything else can mean the specifier is a function/method,
# module, or just an attribute of a class
elif isinstance(specifier, types.FunctionType):
return DeprecatedMethod(specifier, message)
elif isinstance(specifier, types.ModuleType):
return DeprecatedModule(specifier, message)
else:
prop = specifier
if hasattr(prop, '__get__') and hasattr(prop, '__set__') and \
hasattr(prop, '__delete__'):
return DeprecatedGetSetDeleteProperty(prop, message)
elif hasattr(prop, '__get__') and hasattr(prop, '__set__'):
return DeprecatedGetSetProperty(prop, message)
elif hasattr(prop, '__get__'):
return DeprecatedGetProperty(prop, message)
class deprecate(object):
"""Deprecation decorator"""
def __init__(self, msg):
self.msg = msg
def __call__(self, func):
return DeprecatedMethod(func, self.msg)
def moved(to_location, unsupported_in=None):
old = sys._getframe(1).f_globals['__name__']
message = '%s has moved to %s.' % (old, to_location)
if unsupported_in:
message += " Import of %s will become unsupported in %s" % (
old, unsupported_in)
warnings.warn(message, DeprecationWarning, 3)
__import__(to_location)
fromdict = sys.modules[to_location].__dict__
tomod = sys.modules[old]
tomod.__doc__ = message
for name, v in fromdict.items():
if name not in tomod.__dict__:
setattr(tomod, name, v)
zope.deprecation-4.1.2/COPYRIGHT.txt 0000664 0001750 0001750 00000000040 12072655562 020252 0 ustar tseaver tseaver 0000000 0000000 Zope Foundation and Contributors zope.deprecation-4.1.2/CHANGES.rst 0000664 0001750 0001750 00000004031 12455234652 017745 0 ustar tseaver tseaver 0000000 0000000 ``zope.deprecation`` Changelog
==============================
4.1.2 (2015-01-13)
------------------
- Do not require a ``self`` parameter for deprecated functions. See:
https://github.com/zopefoundation/zope.deprecation/pull/1
4.1.1 (2014-03-19)
------------------
- Added explicit support for Python 3.4.
4.1.0 (2013-12-20)
------------------
- Added a ``Suppressor`` context manager, allowing scoped suppression of
deprecation warnings.
- Updated ``boostrap.py`` to version 2.2.
4.0.2 (2012-12-31)
------------------
- Fleshed out PyPI Trove classifiers.
4.0.1 (2012-11-21)
------------------
- Added support for Python 3.3.
4.0.0 (2012-05-16)
------------------
- Automated build of Sphinx HTML docs and running doctest snippets via tox.
- Added Sphinx documentation:
- API docs moved from package-data README into ``docs/api.rst``.
- Snippets can be tested by running 'make doctest'.
- Updated support for continuous integration using ``tox`` and ``jenkins``.
- 100% unit test coverage.
- Added ``setup.py dev`` alias (runs ``setup.py develop`` plus installs
``nose`` and ``coverage``).
- Added ``setup.py docs`` alias (installs ``Sphinx`` and dependencies).
- Removed spurious dependency on ``zope.testing``.
- Dropped explicit support for Python 2.4 / 2.5 / 3.1.
3.5.1 (2012-03-15)
------------------
- Revert a move of `README.txt` to unbreak ``zope.app.apidoc``.
3.5.0 (2011-09-05)
------------------
- Replaced doctesting with unit testing.
- Python 3 compatibility.
3.4.1 (2011-06-07)
------------------
- Removed import cycle for ``__show__`` by defining it in the
``zope.deprecation.deprecation`` module.
- Added support to bootstrap on Jython.
- Fix ``zope.deprecation.warn()`` to make the signature identical to
``warnings.warn()`` and to check for .pyc and .pyo files.
3.4.0 (2007-07-19)
------------------
- Release 3.4 final, corresponding to Zope 3.4.
3.3.0 (2007-02-18)
------------------
- Corresponds to the version of the ``zope.deprecation`` package shipped as
part of the Zope 3.3.0 release.
zope.deprecation-4.1.2/LICENSE.txt 0000664 0001750 0001750 00000004026 12072655562 017774 0 ustar tseaver tseaver 0000000 0000000 Zope Public License (ZPL) Version 2.1
A copyright notice accompanies this license document that identifies the
copyright holders.
This license has been certified as open source. It has also been designated as
GPL compatible by the Free Software Foundation (FSF).
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions in source code must retain the accompanying copyright
notice, this list of conditions, and the following disclaimer.
2. Redistributions in binary form must reproduce the accompanying copyright
notice, this list of conditions, and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Names of the copyright holders must not be used to endorse or promote
products derived from this software without prior written permission from the
copyright holders.
4. The right to distribute this software or to use it for any purpose does not
give you the right to use Servicemarks (sm) or Trademarks (tm) of the
copyright
holders. Use of them is covered by separate agreement with the copyright
holders.
5. If any files are modified, you must cause the modified files to carry
prominent notices stating that you changed the files and the date of any
change.
Disclaimer
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY EXPRESSED
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
zope.deprecation-4.1.2/README.rst 0000664 0001750 0001750 00000000646 12455232531 017634 0 ustar tseaver tseaver 0000000 0000000 ``zope.deprecation``
====================
.. image:: https://travis-ci.org/zopefoundation/zope.deprecation.png?branch=master
:target: https://travis-ci.org/zopefoundation/zope.deprecation
This package provides a simple function called ``deprecated(names, reason)``
to mark deprecated modules, classes, functions, methods and properties.
Please see http://docs.zope.org/zope.deprecation/ for the documentation.
zope.deprecation-4.1.2/docs/ 0000775 0001750 0001750 00000000000 12455234662 017076 5 ustar tseaver tseaver 0000000 0000000 zope.deprecation-4.1.2/docs/api.rst 0000664 0001750 0001750 00000032552 12255115214 020375 0 ustar tseaver tseaver 0000000 0000000 :mod:`zope.deprecation` API
===========================
Deprecating objects inside a module
-----------------------------------
Let's start with a demonstration of deprecating any name inside a module. To
demonstrate the functionality, First, let's set up an example module containing
fixtures we will use:
.. doctest::
>>> import os
>>> import tempfile
>>> import zope.deprecation
>>> tmp_d = tempfile.mkdtemp('deprecation')
>>> zope.deprecation.__path__.append(tmp_d)
>>> doctest_ex = '''\
... from . import deprecated
...
... def demo1(): #pragma NO COVER (used only in doctests)
... return 1
... deprecated('demo1', 'demo1 is no more.')
...
... def demo2(): #pragma NO COVER (used only in doctests)
... return 2
... deprecated('demo2', 'demo2 is no more.')
...
... def demo3(): #pragma NO COVER (used only in doctests)
... return 3
... deprecated('demo3', 'demo3 is no more.')
...
... def demo4(): #pragma NO COVER (used only in doctests)
... return 4
... def deprecatedemo4(): #pragma NO COVER (used only in doctests)
... """Demonstrate that deprecated() also works in a local scope."""
... deprecated('demo4', 'demo4 is no more.')
... '''
>>> with open(os.path.join(tmp_d, 'doctest_ex.py'), 'w') as f:
... f.write(doctest_ex)
The first argument to the ``deprecated()`` function is a list of names that
should be declared deprecated. If the first argument is a string, it is
interpreted as one name. The second argument is the reason the particular name
has been deprecated. It is good practice to also list the version in which the
name will be removed completely.
Let's now see how the deprecation warnings are displayed.
.. doctest::
>>> import warnings
>>> from zope.deprecation import doctest_ex
>>> with warnings.catch_warnings(record=True) as log:
... del warnings.filters[:]
... doctest_ex.demo1()
1
>>> print log[0].category.__name__
DeprecationWarning
>>> print log[0].message
demo1: demo1 is no more.
>>> import zope.deprecation.doctest_ex
>>> with warnings.catch_warnings(record=True) as log:
... del warnings.filters[:]
... zope.deprecation.doctest_ex.demo2()
2
>>> print log[0].message
demo2: demo2 is no more.
You can see that merely importing the affected module or one of its parents
does not cause a deprecation warning. Only when we try to access the name in
the module, we get a deprecation warning. On the other hand, if we import the
name directly, the deprecation warning will be raised immediately.
.. doctest::
>>> with warnings.catch_warnings(record=True) as log:
... del warnings.filters[:]
... from zope.deprecation.doctest_ex import demo3
>>> print log[0].message
demo3: demo3 is no more.
Deprecation can also happen inside a function. When we first access
``demo4``, it can be accessed without problems, then we call a
function that sets the deprecation message and we get the message upon
the next access:
.. doctest::
>>> with warnings.catch_warnings(record=True) as log:
... del warnings.filters[:]
... doctest_ex.demo4()
4
>>> len(log)
0
>>> doctest_ex.deprecatedemo4()
>>> with warnings.catch_warnings(record=True) as log:
... del warnings.filters[:]
... doctest_ex.demo4()
4
>>> print log[0].message.message #XXX oddball case: why nested?
demo4: demo4 is no more.
Deprecating methods and properties
----------------------------------
New let's see how properties and methods can be deprecated. We are going to
use the same function as before, except that this time, we do not pass in names
as first argument, but the method or attribute itself. The function then
returns a wrapper that sends out a deprecation warning when the attribute or
method is accessed.
.. doctest::
>>> from zope.deprecation import deprecation
>>> class MyComponent(object):
... foo = property(lambda self: 1)
... foo = deprecation.deprecated(foo, 'foo is no more.')
...
... bar = 2
...
... def blah(self):
... return 3
... blah = deprecation.deprecated(blah, 'blah() is no more.')
...
... def splat(self):
... return 4
...
... @deprecation.deprecate("clap() is no more.")
... def clap(self):
... return 5
And here is the result:
.. doctest::
>>> my = MyComponent()
>>> with warnings.catch_warnings(record=True) as log:
... del warnings.filters[:]
... my.foo
1
>>> print log[0].message.message # XXX see above
foo is no more.
>>> with warnings.catch_warnings(record=True) as log:
... del warnings.filters[:]
... my.bar
2
>>> len(log)
0
>>> with warnings.catch_warnings(record=True) as log:
... del warnings.filters[:]
... my.blah()
3
>>> print log[0].message.message # XXX see above
blah() is no more.
>>> with warnings.catch_warnings(record=True) as log:
... del warnings.filters[:]
... my.splat()
4
>>> len(log)
0
>>> with warnings.catch_warnings(record=True) as log:
... del warnings.filters[:]
... my.clap()
5
>>> print log[0].message.message # XXX see above
clap() is no more.
Deprecating modules
-------------------
It is also possible to deprecate whole modules. This is useful when
creating module aliases for backward compatibility. Let's imagine,
the ``zope.deprecation`` module used to be called ``zope.wanda`` and
we'd like to retain backward compatibility:
.. doctest::
>>> import sys
>>> sys.modules['zope.wanda'] = deprecation.deprecated(
... zope.deprecation, 'A module called Wanda is now zope.deprecation.')
Now we can import ``wanda``, but when accessing things from it, we get
our deprecation message as expected:
.. doctest::
>>> with warnings.catch_warnings(record=True) as log:
... del warnings.filters[:]
... from zope.wanda import deprecated
>>> print log[0].message.message # XXX see above
A module called Wanda is now zope.deprecation.
Before we move on, we should clean up:
.. doctest::
>>> del deprecated
>>> del sys.modules['zope.wanda']
Moving modules
--------------
When a module is moved, you often want to support importing from the
old location for a while, generating a deprecation warning when
someone uses the old location. This can be done using the moved
function.
To see how this works, we'll use a helper function to create two fake
modules in the zope.deprecation package. First will create a module
in the "old" location that used the moved function to indicate the a
module on the new location should be used:
.. doctest::
>>> import os
>>> created_modules = []
>>> def create_module(modules=(), **kw): #** highlightfail
... modules = dict(modules)
... modules.update(kw)
... for name, src in modules.iteritems():
... pname = name.split('.')
... if pname[-1] == '__init__':
... os.mkdir(os.path.join(tmp_d, *pname[:-1])) #* highlightfail
... name = '.'.join(pname[:-1])
... open(os.path.join(tmp_d, *pname)+'.py', 'w').write(src) #* hf
... created_modules.append(name)
>>> create_module(old_location=
... '''
... import zope.deprecation
... zope.deprecation.moved('zope.deprecation.new_location', 'version 2')
... ''')
and we define the module in the new location:
.. doctest::
>>> create_module(new_location=
... '''\
... print "new module imported"
... x = 42
... ''')
Now, if we import the old location, we'll see the output of importing
the old location:
.. doctest::
>>> with warnings.catch_warnings(record=True) as log:
... del warnings.filters[:]
... import zope.deprecation.old_location
new module imported
>>> print log[0].message.message
... # doctest: +NORMALIZE_WHITESPACE
zope.deprecation.old_location has moved to zope.deprecation.new_location.
Import of zope.deprecation.old_location will become unsupported
in version 2
>>> zope.deprecation.old_location.x
42
Moving packages
---------------
When moving packages, you need to leave placeholders for each
module. Let's look at an example:
.. doctest::
>>> create_module({
... 'new_package.__init__': '''\
... print __name__, 'imported'
... x=0
... ''',
... 'new_package.m1': '''\
... print __name__, 'imported'
... x=1
... ''',
... 'new_package.m2': '''\
... print __name__, 'imported'
... def x():
... pass
... ''',
... 'new_package.m3': '''\
... print __name__, 'imported'
... x=3
... ''',
... 'old_package.__init__': '''\
... import zope.deprecation
... zope.deprecation.moved('zope.deprecation.new_package', 'version 2')
... ''',
... 'old_package.m1': '''\
... import zope.deprecation
... zope.deprecation.moved('zope.deprecation.new_package.m1', 'version 2')
... ''',
... 'old_package.m2': '''\
... import zope.deprecation
... zope.deprecation.moved('zope.deprecation.new_package.m2', 'version 2')
... ''',
... })
Now, if we import the old modules, we'll get warnings:
.. doctest::
>>> with warnings.catch_warnings(record=True) as log:
... del warnings.filters[:]
... import zope.deprecation.old_package
zope.deprecation.new_package imported
>>> print log[0].message
... # doctest: +NORMALIZE_WHITESPACE
zope.deprecation.old_package has moved to zope.deprecation.new_package.
Import of zope.deprecation.old_package will become unsupported in version 2
>>> zope.deprecation.old_package.x
0
>>> with warnings.catch_warnings(record=True) as log:
... del warnings.filters[:]
... import zope.deprecation.old_package.m1
zope.deprecation.new_package.m1 imported
>>> print log[0].message
... # doctest: +NORMALIZE_WHITESPACE
zope.deprecation.old_package.m1 has moved to zope.deprecation.new_package.m1.
Import of zope.deprecation.old_package.m1 will become unsupported in
version 2
>>> zope.deprecation.old_package.m1.x
1
>>> with warnings.catch_warnings(record=True) as log:
... del warnings.filters[:]
... import zope.deprecation.old_package.m2
zope.deprecation.new_package.m2 imported
>>> print log[0].message
... # doctest: +NORMALIZE_WHITESPACE
zope.deprecation.old_package.m2 has moved to zope.deprecation.new_package.m2.
Import of zope.deprecation.old_package.m2 will become unsupported in
version 2
>>> zope.deprecation.old_package.m2.x is zope.deprecation.new_package.m2.x
True
>>> (zope.deprecation.old_package.m2.x.func_globals
... is zope.deprecation.new_package.m2.__dict__)
True
>>> zope.deprecation.old_package.m2.x.__module__
'zope.deprecation.new_package.m2'
We'll get an error if we try to import m3, because we didn't create a
placeholder for it:
.. doctest::
>>> import zope.deprecation.old_package.m3
Traceback (most recent call last):
...
ImportError: No module named m3
Before we move on, let's clean up the temporary modules / packages:
.. doctest::
>>> zope.deprecation.__path__.remove(tmp_d)
>>> import shutil
>>> shutil.rmtree(tmp_d)
Temporarily turning off deprecation warnings
--------------------------------------------
In some cases it is desireable to turn off the deprecation warnings for a
short time.
To support such a feature, the ``zope.deprecation`` package
provides a :term:`context manager` class, :class:`zope.deprecation.Suppressor`.
Code running inside the scope of a ``Suppressor`` will not emit deprecation
warnings.
.. doctest::
>>> from zope.deprecation import Suppressor
>>> class Foo(object):
... bar = property(lambda self: 1)
... bar = deprecation.deprecated(bar, 'bar is no more.')
... blah = property(lambda self: 1)
... blah = deprecation.deprecated(blah, 'blah is no more.')
>>> foo = Foo()
>>> with Suppressor():
... foo.blah
1
Note that no warning is emitted when ``foo.blah`` is accessed inside
the suppressor's scope.:
The suppressor is implemented in terms of a ``__show__`` object.
One can ask for its status by calling it:
.. doctest::
>>> from zope.deprecation import __show__
>>> __show__()
True
Inside a suppressor's scope, that status is always false:
.. doctest::
>>> with Suppressor():
... __show__()
False
.. doctest::
>>> with warnings.catch_warnings(record=True) as log:
... del warnings.filters[:]
... foo.bar
1
>>> print log[0].message
bar is no more.
If needed, your code can manage the depraction warnings manually using
the ``on()`` and ``off()`` methods of the ``__show__`` object:
.. doctest::
>>> __show__.off()
>>> __show__()
False
>>> foo.blah
1
Now, you can also nest several turn-offs, so that calling ``off()`` multiple
times is meaningful:
.. doctest::
>>> __show__.stack
[False]
>>> __show__.off()
>>> __show__.stack
[False, False]
>>> __show__.on()
>>> __show__.stack
[False]
>>> __show__()
False
>>> __show__.on()
>>> __show__.stack
[]
>>> __show__()
True
You can also reset ``__show__`` to ``True``:
.. doctest::
>>> __show__.off()
>>> __show__.off()
>>> __show__()
False
>>> __show__.reset()
>>> __show__()
True
Finally, you cannot call ``on()`` without having called ``off()`` before:
.. doctest::
>>> __show__.on()
Traceback (most recent call last):
...
IndexError: pop from empty list
zope.deprecation-4.1.2/docs/make.bat 0000664 0001750 0001750 00000011772 12072655562 020514 0 ustar tseaver tseaver 0000000 0000000 @ECHO OFF
REM Command file for Sphinx documentation
if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set BUILDDIR=_build
set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% .
set I18NSPHINXOPTS=%SPHINXOPTS% .
if NOT "%PAPER%" == "" (
set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS%
set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS%
)
if "%1" == "" goto help
if "%1" == "help" (
:help
echo.Please use `make ^` where ^ is one of
echo. html to make standalone HTML files
echo. dirhtml to make HTML files named index.html in directories
echo. singlehtml to make a single large HTML file
echo. pickle to make pickle files
echo. json to make JSON files
echo. htmlhelp to make HTML files and a HTML help project
echo. qthelp to make HTML files and a qthelp project
echo. devhelp to make HTML files and a Devhelp project
echo. epub to make an epub
echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter
echo. text to make text files
echo. man to make manual pages
echo. texinfo to make Texinfo files
echo. gettext to make PO message catalogs
echo. changes to make an overview over all changed/added/deprecated items
echo. linkcheck to check all external links for integrity
echo. doctest to run all doctests embedded in the documentation if enabled
goto end
)
if "%1" == "clean" (
for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i
del /q /s %BUILDDIR%\*
goto end
)
if "%1" == "html" (
%SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The HTML pages are in %BUILDDIR%/html.
goto end
)
if "%1" == "dirhtml" (
%SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml.
goto end
)
if "%1" == "singlehtml" (
%SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml.
goto end
)
if "%1" == "pickle" (
%SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle
if errorlevel 1 exit /b 1
echo.
echo.Build finished; now you can process the pickle files.
goto end
)
if "%1" == "json" (
%SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json
if errorlevel 1 exit /b 1
echo.
echo.Build finished; now you can process the JSON files.
goto end
)
if "%1" == "htmlhelp" (
%SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp
if errorlevel 1 exit /b 1
echo.
echo.Build finished; now you can run HTML Help Workshop with the ^
.hhp project file in %BUILDDIR%/htmlhelp.
goto end
)
if "%1" == "qthelp" (
%SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp
if errorlevel 1 exit /b 1
echo.
echo.Build finished; now you can run "qcollectiongenerator" with the ^
.qhcp project file in %BUILDDIR%/qthelp, like this:
echo.^> qcollectiongenerator %BUILDDIR%\qthelp\zopedeprecation.qhcp
echo.To view the help file:
echo.^> assistant -collectionFile %BUILDDIR%\qthelp\zopedeprecation.ghc
goto end
)
if "%1" == "devhelp" (
%SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp
if errorlevel 1 exit /b 1
echo.
echo.Build finished.
goto end
)
if "%1" == "epub" (
%SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The epub file is in %BUILDDIR%/epub.
goto end
)
if "%1" == "latex" (
%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
if errorlevel 1 exit /b 1
echo.
echo.Build finished; the LaTeX files are in %BUILDDIR%/latex.
goto end
)
if "%1" == "text" (
%SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The text files are in %BUILDDIR%/text.
goto end
)
if "%1" == "man" (
%SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The manual pages are in %BUILDDIR%/man.
goto end
)
if "%1" == "texinfo" (
%SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo.
goto end
)
if "%1" == "gettext" (
%SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The message catalogs are in %BUILDDIR%/locale.
goto end
)
if "%1" == "changes" (
%SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes
if errorlevel 1 exit /b 1
echo.
echo.The overview file is in %BUILDDIR%/changes.
goto end
)
if "%1" == "linkcheck" (
%SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck
if errorlevel 1 exit /b 1
echo.
echo.Link check complete; look for any errors in the above output ^
or in %BUILDDIR%/linkcheck/output.txt.
goto end
)
if "%1" == "doctest" (
%SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest
if errorlevel 1 exit /b 1
echo.
echo.Testing of doctests in the sources finished, look at the ^
results in %BUILDDIR%/doctest/output.txt.
goto end
)
:end
zope.deprecation-4.1.2/docs/Makefile 0000664 0001750 0001750 00000012740 12072655562 020543 0 ustar tseaver tseaver 0000000 0000000 # Makefile for Sphinx documentation
#
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
PAPER =
BUILDDIR = _build
# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
# the i18n builder cannot share the environment and doctrees with the others
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext
help:
@echo "Please use \`make ' where is one of"
@echo " html to make standalone HTML files"
@echo " dirhtml to make HTML files named index.html in directories"
@echo " singlehtml to make a single large HTML file"
@echo " pickle to make pickle files"
@echo " json to make JSON files"
@echo " htmlhelp to make HTML files and a HTML help project"
@echo " qthelp to make HTML files and a qthelp project"
@echo " devhelp to make HTML files and a Devhelp project"
@echo " epub to make an epub"
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
@echo " latexpdf to make LaTeX files and run them through pdflatex"
@echo " text to make text files"
@echo " man to make manual pages"
@echo " texinfo to make Texinfo files"
@echo " info to make Texinfo files and run them through makeinfo"
@echo " gettext to make PO message catalogs"
@echo " changes to make an overview of all changed/added/deprecated items"
@echo " linkcheck to check all external links for integrity"
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
clean:
-rm -rf $(BUILDDIR)/*
html:
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
dirhtml:
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
singlehtml:
$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
@echo
@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
pickle:
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
@echo
@echo "Build finished; now you can process the pickle files."
json:
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
@echo
@echo "Build finished; now you can process the JSON files."
htmlhelp:
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
@echo
@echo "Build finished; now you can run HTML Help Workshop with the" \
".hhp project file in $(BUILDDIR)/htmlhelp."
qthelp:
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
@echo
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/zopedeprecation.qhcp"
@echo "To view the help file:"
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/zopedeprecation.qhc"
devhelp:
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
@echo
@echo "Build finished."
@echo "To view the help file:"
@echo "# mkdir -p $$HOME/.local/share/devhelp/zopedeprecation"
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/zopedeprecation"
@echo "# devhelp"
epub:
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
@echo
@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
latex:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
@echo "Run \`make' in that directory to run these through (pdf)latex" \
"(use \`make latexpdf' here to do that automatically)."
latexpdf:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo "Running LaTeX files through pdflatex..."
$(MAKE) -C $(BUILDDIR)/latex all-pdf
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
text:
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
@echo
@echo "Build finished. The text files are in $(BUILDDIR)/text."
man:
$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
@echo
@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
texinfo:
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
@echo
@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
@echo "Run \`make' in that directory to run these through makeinfo" \
"(use \`make info' here to do that automatically)."
info:
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
@echo "Running Texinfo files through makeinfo..."
make -C $(BUILDDIR)/texinfo info
@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
gettext:
$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
@echo
@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
changes:
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
@echo
@echo "The overview file is in $(BUILDDIR)/changes."
linkcheck:
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
@echo
@echo "Link check complete; look for any errors in the above output " \
"or in $(BUILDDIR)/linkcheck/output.txt."
doctest:
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
@echo "Testing of doctests in the sources finished, look at the " \
"results in $(BUILDDIR)/doctest/output.txt."
zope.deprecation-4.1.2/docs/conf.py 0000664 0001750 0001750 00000017400 12072655562 020400 0 ustar tseaver tseaver 0000000 0000000 # -*- coding: utf-8 -*-
#
# zope.deprecation documentation build configuration file, created by
# sphinx-quickstart on Thu Apr 19 16:41:59 2012.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.
import sys, os
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#sys.path.insert(0, os.path.abspath('.'))
# -- General configuration -----------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
#needs_sphinx = '1.0'
# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.doctest', 'sphinx.ext.viewcode']
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# The suffix of source filenames.
source_suffix = '.rst'
# The encoding of source files.
#source_encoding = 'utf-8-sig'
# The master toctree document.
master_doc = 'index'
# General information about the project.
project = u'zope.deprecation'
copyright = u'2012, Zope Foundation Contributors'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = '4.0'
# The full version, including alpha/beta/rc tags.
release = '4.0'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#language = None
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
#today = ''
# Else, today_fmt is used as the format for a strftime call.
#today_fmt = '%B %d, %Y'
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns = ['_build']
# The reST default role (used for this markup: `text`) to use for all documents.
#default_role = None
# If true, '()' will be appended to :func: etc. cross-reference text.
#add_function_parentheses = True
# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
#add_module_names = True
# If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
#show_authors = False
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
# A list of ignored prefixes for module index sorting.
#modindex_common_prefix = []
# -- Options for HTML output ---------------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
html_theme = 'default'
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#html_theme_options = {}
# Add any paths that contain custom themes here, relative to this directory.
#html_theme_path = []
# The name for this set of Sphinx documents. If None, it defaults to
# " v documentation".
#html_title = None
# A shorter title for the navigation bar. Default is the same as html_title.
#html_short_title = None
# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
#html_logo = None
# The name of an image file (within the static path) to use as favicon of the
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
#html_favicon = None
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
#html_last_updated_fmt = '%b %d, %Y'
# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
#html_use_smartypants = True
# Custom sidebar templates, maps document names to template names.
#html_sidebars = {}
# Additional templates that should be rendered to pages, maps page names to
# template names.
#html_additional_pages = {}
# If false, no module index is generated.
#html_domain_indices = True
# If false, no index is generated.
#html_use_index = True
# If true, the index is split into individual pages for each letter.
#html_split_index = False
# If true, links to the reST sources are added to the pages.
#html_show_sourcelink = True
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
#html_show_sphinx = True
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
#html_show_copyright = True
# If true, an OpenSearch description file will be output, and all pages will
# contain a tag referring to it. The value of this option must be the
# base URL from which the finished HTML is served.
#html_use_opensearch = ''
# This is the file name suffix for HTML files (e.g. ".xhtml").
#html_file_suffix = None
# Output file base name for HTML help builder.
htmlhelp_basename = 'zopedeprecationdoc'
# -- Options for LaTeX output --------------------------------------------------
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
#'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
#'preamble': '',
}
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [
('index', 'zopedeprecation.tex', u'zope.deprecation Documentation',
u'Zope Foundation Contributors', 'manual'),
]
# The name of an image file (relative to this directory) to place at the top of
# the title page.
#latex_logo = None
# For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters.
#latex_use_parts = False
# If true, show page references after internal links.
#latex_show_pagerefs = False
# If true, show URL addresses after external links.
#latex_show_urls = False
# Documents to append as an appendix to all manuals.
#latex_appendices = []
# If false, no module index is generated.
#latex_domain_indices = True
# -- Options for manual page output --------------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
('index', 'zopedeprecation', u'zope.deprecation Documentation',
[u'Zope Foundation Contributors'], 1)
]
# If true, show URL addresses after external links.
#man_show_urls = False
# -- Options for Texinfo output ------------------------------------------------
# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
('index', 'zopedeprecation', u'zope.deprecation Documentation',
u'Zope Foundation Contributors', 'zopedeprecation', 'One line description of project.',
'Miscellaneous'),
]
# Documents to append as an appendix to all manuals.
#texinfo_appendices = []
# If false, no module index is generated.
#texinfo_domain_indices = True
# How to display URL addresses: 'footnote', 'no', or 'inline'.
#texinfo_show_urls = 'footnote'
zope.deprecation-4.1.2/docs/index.rst 0000664 0001750 0001750 00000000346 12072655562 020743 0 ustar tseaver tseaver 0000000 0000000 :mod:`zope.deprecation` Documentation
=====================================
Contents:
.. toctree::
:maxdepth: 2
api
hacking
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
zope.deprecation-4.1.2/docs/_build/ 0000775 0001750 0001750 00000000000 12455234662 020334 5 ustar tseaver tseaver 0000000 0000000 zope.deprecation-4.1.2/docs/_build/doctest/ 0000775 0001750 0001750 00000000000 12455234662 022001 5 ustar tseaver tseaver 0000000 0000000 zope.deprecation-4.1.2/docs/_build/doctest/output.txt 0000664 0001750 0001750 00000000564 12255115222 024073 0 ustar tseaver tseaver 0000000 0000000 Results of doctest builder run on 2013-12-20 14:29:22
=====================================================
Document: api
-------------
1 items passed all tests:
92 tests in default
92 tests in 1 items.
92 passed and 0 failed.
Test passed.
Doctest summary
===============
92 tests
0 failures in tests
0 failures in setup code
0 failures in cleanup code
zope.deprecation-4.1.2/docs/_build/doctrees/ 0000775 0001750 0001750 00000000000 12455234662 022144 5 ustar tseaver tseaver 0000000 0000000 zope.deprecation-4.1.2/docs/_build/doctrees/index.doctree 0000664 0001750 0001750 00000013613 12255113001 024603 0 ustar tseaver tseaver 0000000 0000000 cdocutils.nodes
document
q)q}q(U nametypesq}q(X zope.deprecation documentationqNX indices and tablesqNuUsubstitution_defsq}q Uparse_messagesq
]qUcurrent_sourceqNU
decorationq
NUautofootnote_startqKUnameidsq}q(hUzope-deprecation-documentationqhUindices-and-tablesquUchildrenq]q(cdocutils.nodes
section
q)q}q(U rawsourceqU UparentqhUsourceqcdocutils.nodes
reprunicode
qX> /home/tseaver/projects/Zope/Z3/zope.deprecation/docs/index.rstqq}qbUtagnameqUsectionq U
attributesq!}q"(Udupnamesq#]q$Uclassesq%]q&Ubackrefsq']q(Uidsq)]q*haUnamesq+]q,hauUlineq-KUdocumentq.hh]q/(cdocutils.nodes
title
q0)q1}q2(hX% :mod:`zope.deprecation` Documentationq3hhhhhUtitleq4h!}q5(h#]q6h%]q7h']q8h)]q9h+]q:uh-Kh.hh]q;(csphinx.addnodes
pending_xref
q<)q=}q>(hX :mod:`zope.deprecation`q?hh1hhhUpending_xrefq@h!}qA(UreftypeqBX modqCUrefwarnqDU reftargetqEX zope.deprecationqFU refdomainqGX pyqHh)]qIh']qJUrefexplicitqKh#]qLh%]qMh+]qNUrefdocqOX indexqPUpy:classqQNU py:moduleqRNuh-Kh]qScdocutils.nodes
literal
qT)qU}qV(hh?h!}qW(h#]qXh%]qY(UxrefqZhHX py-modq[eh']q\h)]q]h+]q^uhh=h]q_cdocutils.nodes
Text
q`X zope.deprecationqaqb}qc(hU hhUubahUliteralqdubaubh`X Documentationqeqf}qg(hX Documentationqhhh1ubeubcdocutils.nodes
paragraph
qi)qj}qk(hX Contents:qlhhhhhU paragraphqmh!}qn(h#]qoh%]qph']qqh)]qrh+]qsuh-Kh.hh]qth`X Contents:quqv}qw(hhlhhjubaubcdocutils.nodes
compound
qx)qy}qz(hU hhhhhUcompoundq{h!}q|(h#]q}h%]q~Utoctree-wrapperqah']qh)]qh+]quh-Nh.hh]qcsphinx.addnodes
toctree
q)q}q(hU hhyhhhUtoctreeqh!}q(UnumberedqK U
includehiddenqhhPU
titlesonlyqUglobqh)]qh']qh#]qh%]qh+]qUentriesq]q(NX apiqqNX hackingqqeUhiddenqUincludefilesq]q(hheUmaxdepthqKuh-Kh]qubaubeubh)q}q(hU hhhhhh h!}q(h#]qh%]qh']qh)]qhah+]qhauh-Kh.hh]q(h0)q}q(hX Indices and tablesqhhhhhh4h!}q(h#]qh%]qh']qh)]qh+]quh-Kh.hh]qh`X Indices and tablesqq}q(hhhhubaubcdocutils.nodes
bullet_list
q)q}q(hU hhhhhUbullet_listqh!}q(UbulletqX *h)]qh']qh#]qh%]qh+]quh-Kh.hh]q(cdocutils.nodes
list_item
q)q}q(hX :ref:`genindex`qhhhhhU list_itemqh!}q(h#]qh%]qh']qh)]qh+]quh-Nh.hh]qhi)q}q(hhhhhhhhmh!}q(h#]qh%]qh']qh)]qh+]quh-Kh]qh<)q}q(hhhhhhhh@h!}q(UreftypeqX refqhDhEX genindexqU refdomainqX stdqh)]qh']qUrefexplicitqމh#]qh%]qh+]qhOhPuh-Kh]qcdocutils.nodes
emphasis
q)q}q(hhh!}q(h#]qh%]q(hZhX std-refqeh']qh)]qh+]quhhh]qh`X genindexqq}q(hU hhubahUemphasisqubaubaubaubh)q}q(hX :ref:`modindex`qhhhhhhh!}q(h#]qh%]qh']qh)]qh+]quh-Nh.hh]qhi)q}q(hhhhhhhhmh!}q(h#]qh%]r h']r h)]r h+]r uh-Kh]r h<)r }r (hhhhhhhh@h!}r (Ureftyper X refr hDhEX modindexr
U refdomainr X stdr h)]r
h']r Urefexplicitr h#]r h%]r h+]r hOhPuh-Kh]r h)r }r (hhh!}r (h#]r h%]r (hZj X std-refr eh']r h)]r h+]r uhj h]r h`X modindexr r }r (hU hj ubahhubaubaubaubh)r! }r" (hX :ref:`search`
r# hhhhhhh!}r$ (h#]r% h%]r& h']r' h)]r( h+]r) uh-Nh.hh]r* hi)r+ }r, (hX
:ref:`search`r- hj! hhhhmh!}r. (h#]r/ h%]r0 h']r1 h)]r2 h+]r3 uh-Kh]r4 h<)r5 }r6 (hj- hj+ hhhh@h!}r7 (Ureftyper8 X refr9 hDhEX searchr: U refdomainr; X stdr< h)]r= h']r> Urefexplicitr? h#]r@ h%]rA h+]rB hOhPuh-Kh]rC h)rD }rE (hj- h!}rF (h#]rG h%]rH (hZj< X std-refrI eh']rJ h)]rK h+]rL uhj5 h]rM h`X searchrN rO }rP (hU hjD ubahhubaubaubaubeubeubehU UtransformerrQ NU
footnote_refsrR }rS UrefnamesrT }rU Usymbol_footnotesrV ]rW Uautofootnote_refsrX ]rY Usymbol_footnote_refsrZ ]r[ U citationsr\ ]r] h.hUcurrent_liner^ NUtransform_messagesr_ ]r` Ureporterra NUid_startrb KU
autofootnotesrc ]rd U
citation_refsre }rf Uindirect_targetsrg ]rh Usettingsri (cdocutils.frontend
Values
rj ork }rl (Ufootnote_backlinksrm KUrecord_dependenciesrn NUrfc_base_urlro Uhttp://tools.ietf.org/html/rp U tracebackrq Upep_referencesrr NUstrip_commentsrs NU
toc_backlinksrt Uentryru U
language_coderv Uenrw U datestamprx NUreport_levelry KU_destinationrz NU
halt_levelr{ KU
strip_classesr| Nh4NUerror_encoding_error_handlerr} Ubackslashreplacer~ Udebugr NUembed_stylesheetr Uoutput_encoding_error_handlerr Ustrictr U
sectnum_xformr KUdump_transformsr NU
docinfo_xformr KUwarning_streamr NUpep_file_url_templater Upep-%04dr Uexit_status_levelr KUconfigr NUstrict_visitorr NUcloak_email_addressesr Utrim_footnote_reference_spacer Uenvr NUdump_pseudo_xmlr NUexpose_internalsr NUsectsubtitle_xformr Usource_linkr NUrfc_referencesr NUoutput_encodingr Uutf-8r U
source_urlr NUinput_encodingr U utf-8-sigr U_disable_configr NU id_prefixr U U tab_widthr KUerror_encodingr UUTF-8r U_sourcer U>/home/tseaver/projects/Zope/Z3/zope.deprecation/docs/index.rstr Ugettext_compactr U generatorr NUdump_internalsr NUsmart_quotesr Upep_base_urlr Uhttp://www.python.org/dev/peps/r Usyntax_highlightr Ulongr Uinput_encoding_error_handlerr j Uauto_id_prefixr Uidr Udoctitle_xformr Ustrip_elements_with_classesr NU
_config_filesr ]r Ufile_insertion_enabledr Uraw_enabledr KU
dump_settingsr NubUsymbol_footnote_startr K Uidsr }r (hhhhuUsubstitution_namesr }r hh.h!}r (h#]r h)]r h']r Usourcer hh%]r h+]r uU footnotesr ]r Urefidsr }r ub. zope.deprecation-4.1.2/docs/_build/doctrees/hacking.doctree 0000664 0001750 0001750 00000146234 12255113001 025106 0 ustar tseaver tseaver 0000000 0000000 cdocutils.nodes
document
q)q}q(U nametypesq}q(X toxqX getting the codeqNX submitting a bug reportqNX1 running tests on multiple python versions via toxq NX, building the documentation using zc.buildoutq
NX sharing your changesqNX hacking on zope.deprecationqNX* building the documentation in a virtualenvq
NX! running the tests in a virtualenvqNX# running the tests using zc.buildoutqNuUsubstitution_defsq}qUparse_messagesq]qUcurrent_sourceqNU
decorationqNUautofootnote_startqKUnameidsq}q(hUtoxqhUgetting-the-codeqhUsubmitting-a-bug-reportqh U1running-tests-on-multiple-python-versions-via-toxqh
U,building-the-documentation-using-zc-buildoutqhUsharing-your-changesqhUhacking-on-zope-deprecationqh
U*building-the-documentation-in-a-virtualenvq hU!running-the-tests-in-a-virtualenvq!hU#running-the-tests-using-zc-buildoutq"uUchildrenq#]q$cdocutils.nodes
section
q%)q&}q'(U rawsourceq(U Uparentq)hUsourceq*cdocutils.nodes
reprunicode
q+X@ /home/tseaver/projects/Zope/Z3/zope.deprecation/docs/hacking.rstq,q-}q.bUtagnameq/Usectionq0U
attributesq1}q2(Udupnamesq3]q4Uclassesq5]q6Ubackrefsq7]q8Uidsq9]q:haUnamesq;]qhh#]q?(cdocutils.nodes
title
q@)qA}qB(h(X" Hacking on :mod:`zope.deprecation`qCh)h&h*h-h/UtitleqDh1}qE(h3]qFh5]qGh7]qHh9]qIh;]qJuh=Kh>hh#]qK(cdocutils.nodes
Text
qLX Hacking on qMqN}qO(h(X Hacking on qPh)hAubcsphinx.addnodes
pending_xref
qQ)qR}qS(h(X :mod:`zope.deprecation`qTh)hAh*h-h/Upending_xrefqUh1}qV(UreftypeqWX modqXUrefwarnqYU reftargetqZX zope.deprecationq[U refdomainq\X pyq]h9]q^h7]q_Urefexplicitq`h3]qah5]qbh;]qcUrefdocqdX hackingqeUpy:classqfNU py:moduleqgNuh=Kh#]qhcdocutils.nodes
literal
qi)qj}qk(h(hTh1}ql(h3]qmh5]qn(Uxrefqoh]X py-modqpeh7]qqh9]qrh;]qsuh)hRh#]qthLX zope.deprecationquqv}qw(h(U h)hjubah/Uliteralqxubaubeubh%)qy}qz(h(U h)h&h*h-h/h0h1}q{(h3]q|h5]q}h7]q~h9]qhah;]qhauh=Kh>hh#]q(h@)q}q(h(X Getting the Codeqh)hyh*h-h/hDh1}q(h3]qh5]qh7]qh9]qh;]quh=Kh>hh#]qhLX Getting the Codeqq}q(h(hh)hubaubcdocutils.nodes
paragraph
q)q}q(h(XU The main repository for :mod:`zope.deprecation` is in the Zope Subversion
repository:qh)hyh*h-h/U paragraphqh1}q(h3]qh5]qh7]qh9]qh;]quh=Kh>hh#]q(hLX The main repository for qq}q(h(X The main repository for qh)hubhQ)q}q(h(X :mod:`zope.deprecation`qh)hh*h-h/hUh1}q(UreftypeqX modqhYhZX zope.deprecationqU refdomainqX pyqh9]qh7]qUrefexplicitqh3]qh5]qh;]qhdhehfNhgNuh=Kh#]qhi)q}q(h(hh1}q(h3]qh5]q(hohX py-modqeh7]qh9]qh;]quh)hh#]qhLX zope.deprecationqq}q(h(U h)hubah/hxubaubhLX&