zope.fixers-1.0/0000755000175000017500000000000011252677752015270 5ustar lregebrolregebro00000000000000zope.fixers-1.0/docs/0000755000175000017500000000000011252677752016220 5ustar lregebrolregebro00000000000000zope.fixers-1.0/docs/HISTORY.txt0000644000175000017500000000011311252677624020113 0ustar lregebrolregebro00000000000000Changelog ========= 1.0 - Unreleased ---------------- * Initial release zope.fixers-1.0/zope/0000755000175000017500000000000011252677752016245 5ustar lregebrolregebro00000000000000zope.fixers-1.0/zope/fixers/0000755000175000017500000000000011252677752017545 5ustar lregebrolregebro00000000000000zope.fixers-1.0/zope/fixers/base.py0000644000175000017500000001745011252677625021037 0ustar lregebrolregebro00000000000000############################################################################## # # Copyright (c) 2009 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. # ############################################################################## """Fixer for class interface declarations to class decorators $Id$ """ # Local imports from lib2to3.fixer_base import BaseFix from lib2to3.patcomp import PatternCompiler from lib2to3.fixer_util import syms, Name from lib2to3.fixer_util import Node, Leaf class Function2DecoratorBase(BaseFix): IMPORT_PATTERN = """ import_from< 'from' dotted_name< 'zope' '.' 'interface' > 'import' import_as_names< any* (name='%(function_name)s') any* > > | import_from< 'from' dotted_name< 'zope' '.' 'interface' > 'import' name='%(function_name)s' any* > | import_from< 'from' dotted_name< 'zope' > 'import' name='interface' any* > | import_from< 'from' dotted_name< 'zope' '.' 'interface' > 'import' import_as_name< name='%(function_name)s' 'as' rename=(any) any*> > | import_from< 'from' dotted_name< 'zope' > 'import' import_as_name< name='interface' 'as' rename=(any) any*> > | import_from< 'from' 'zope' 'import' import_as_name< 'interface' 'as' interface_rename=(any) > > """ CLASS_PATTERN = """ decorated< decorator classdef< 'class' any* ':' suite< any* simple_stmt< power< statement=(%(match)s) trailer < '(' interface=any ')' > any* > any* > any* > > > | classdef< 'class' any* ':' suite< any* simple_stmt< power< statement=(%(match)s) trailer < '(' interface=any ')' > any* > any* > any* > > """ FUNCTION_PATTERN = """ simple_stmt< power< old_statement=(%s) trailer < '(' any* ')' > > any* > """ def should_skip(self, node): module = str(node) return not ('zope' in module and 'interface' in module) def compile_pattern(self): # Compile the import pattern. self.named_import_pattern = PatternCompiler().compile_pattern( self.IMPORT_PATTERN % {'function_name': self.FUNCTION_NAME}) def start_tree(self, tree, filename): # Compile the basic class/function matches. This is done per tree, # as further matches (based on what imports there are) also are done # per tree. self.class_patterns = [] self.function_patterns = [] self.fixups = [] self._add_pattern("'%s'" % self.FUNCTION_NAME) self._add_pattern("'interface' trailer< '.' '%s' >" % self.FUNCTION_NAME) self._add_pattern("'zope' trailer< '.' 'interface' > trailer< '.' '%s' >" % self.FUNCTION_NAME) def _add_pattern(self, match): self.class_patterns.append(PatternCompiler().compile_pattern( self.CLASS_PATTERN % {'match': match})) self.function_patterns.append(PatternCompiler().compile_pattern( self.FUNCTION_PATTERN % match)) def match(self, node): # Matches up the imports results = {"node": node} if self.named_import_pattern.match(node, results): return results # Now match classes on all import variants found: for pattern in self.class_patterns: if pattern.match(node, results): return results def transform(self, node, results): if 'name' in results: # This matched an import statement. Fix that up: name = results["name"] name.replace(Name(self.DECORATOR_NAME, prefix=name.prefix)) if 'rename' in results: # The import statement use import as self._add_pattern("'%s'" % results['rename'].value) if 'interface_rename' in results: self._add_pattern("'%s' trailer< '.' '%s' > " % ( results['interface_rename'].value, self.FUNCTION_NAME)) if 'statement' in results: # This matched a class that has an (IFoo) statement. # We must convert that statement to a class decorator # and put it before the class definition. statement = results['statement'] if not isinstance(statement, list): statement = [statement] # Make a copy for insertion before the class: statement = [x.clone() for x in statement] # Get rid of leading whitespace: statement[0].prefix = '' # Rename function to decorator: if statement[-1].children: func = statement[-1].children[-1] else: func = statement[-1] if func.value == self.FUNCTION_NAME: func.value = self.DECORATOR_NAME interface = results['interface'] if not isinstance(interface, list): interface = [interface] interface = [x.clone() for x in interface] # Create the decorator: decorator = Node(syms.decorator, [Leaf(50, '@'),] + statement + [Leaf(7, '(')] + interface + [Leaf(8, ')')]) # Take the current class constructor prefix, and stick it into # the decorator, to set the decorators indentation. nodeprefix = node.prefix decorator.prefix = nodeprefix # Preserve only the indent: if '\n' in nodeprefix: nodeprefix = nodeprefix[nodeprefix.rfind('\n')+1:] # Then find the last line of the previous node and use that as # indentation, and add that to the class constructors prefix. previous = node.prev_sibling if previous is None: prefix = '' else: prefix = str(previous) if '\n' in prefix: prefix = prefix[prefix.rfind('\n')+1:] prefix = prefix + nodeprefix if not prefix or prefix[0] != '\n': prefix = '\n' + prefix node.prefix = prefix new_node = Node(syms.decorated, [decorator, node.clone()]) # Look for the actual function calls in the new node and remove it. for node in new_node.post_order(): for pattern in self.function_patterns: if pattern.match(node, results): parent = node.parent previous = node.prev_sibling # Remove the node node.remove() if not str(parent).strip(): # This is an empty class. Stick in a pass if (len(parent.children) < 3 or ' ' in parent.children[2].value): # This class had no body whitespace. parent.insert_child(2, Leaf(0, ' pass')) else: # This class had body whitespace already. parent.insert_child(2, Leaf(0, 'pass')) parent.insert_child(3, Leaf(0, '\n')) elif (prefix and isinstance(previous, Leaf) and '\n' not in previous.value and previous.value.strip() == ''): # This is just whitespace, remove it: previous.remove() return new_node zope.fixers-1.0/zope/fixers/fix_implements_only.py0000644000175000017500000000154111252677625024203 0ustar lregebrolregebro00000000000000############################################################################## # # Copyright (c) 2009 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. # ############################################################################## """Fixer for implements(IX) -> @implementer(IX). $Id$ """ from .base import Function2DecoratorBase class FixImplementsOnly(Function2DecoratorBase): FUNCTION_NAME = 'implementsOnly' DECORATOR_NAME = 'implementer_only' zope.fixers-1.0/zope/fixers/fix_implements.py0000644000175000017500000000152411252677625023143 0ustar lregebrolregebro00000000000000############################################################################## # # Copyright (c) 2009 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. # ############################################################################## """Fixer for implements(IX) -> @implementer(IX). $Id$ """ from .base import Function2DecoratorBase class FixImplements(Function2DecoratorBase): FUNCTION_NAME = 'implements' DECORATOR_NAME = 'implementer' zope.fixers-1.0/zope/fixers/tests.py0000644000175000017500000002135311252677625021264 0ustar lregebrolregebro00000000000000import unittest from lib2to3.refactor import RefactoringTool # Check that various import syntaxes get renamed properly. imports_source = """ from zope.interface import Interface, implements, providedBy from zope.interface import providedBy, implements, Interface from zope.interface import providedBy, implements from zope.interface import implements, Interface from zope.interface import implements from zope.interface import implements as renamed """ imports_target = """ from zope.interface import Interface, implementer, providedBy from zope.interface import providedBy, implementer, Interface from zope.interface import providedBy, implementer from zope.interface import implementer, Interface from zope.interface import implementer from zope.interface import implementer as renamed """ # Test a simple case. simple_source = """ from zope.interface import implements class IFoo(Interface): pass class Foo: "An IFoo class" implements(IFoo) """ simple_target = """ from zope.interface import implementer class IFoo(Interface): pass @implementer(IFoo) class Foo: "An IFoo class" """ # Multiple interfaces: multi_source = """ from zope.interface import implements class IFoo(Interface): pass class IBar(Interface): pass class Foo: "An IFoo class" implements(IFoo, IBar) """ multi_target = """ from zope.interface import implementer class IFoo(Interface): pass class IBar(Interface): pass @implementer(IFoo, IBar) class Foo: "An IFoo class" """ # Make sure it works even if implements gets renamed. renamed_source = """ from zope.interface import implements as renamed class IBar(Interface): pass class Bar: "An IBar class" renamed(IBar) """ renamed_target = """ from zope.interface import implementer as renamed class IBar(Interface): pass @renamed(IBar) class Bar: "An IBar class" """ # Often only the module gets imported. module_import_source = """ from zope import interface class IFoo(Interface): pass class Foo: "An IFoo class" interface.implements(IFoo) """ module_import_target = """ from zope import interface class IFoo(Interface): pass @interface.implementer(IFoo) class Foo: "An IFoo class" """ # Interface can get renamed. It's unusual, but should be supported. module_renamed_source = """ from zope import interface as zopeinterface class IFoo(Interface): pass class Foo: "An IFoo class" zopeinterface.implements(IFoo) """ module_renamed_target = """ from zope import interface as zopeinterface class IFoo(Interface): pass @zopeinterface.implementer(IFoo) class Foo: "An IFoo class" """ # Many always uses the full module name. full_import_source = """ import zope.interface class IFoo(Interface): pass class Foo: "An IFoo class" zope.interface.implements(IFoo) """ full_import_target = """ import zope.interface class IFoo(Interface): pass @zope.interface.implementer(IFoo) class Foo: "An IFoo class" """ # Empty classes: empty_class_source = """ import zope.interface class IFoo(Interface): pass class Foo: zope.interface.implements(IFoo) """ empty_class_target = """ import zope.interface class IFoo(Interface): pass @zope.interface.implementer(IFoo) class Foo: pass """ # Classes with indentation: indented_class_source = """ import zope.interface class IFoo(Interface): pass def forceindent(): class Foo: zope.interface.implements(IFoo) class Bar: zope.interface.implements(IFoo) """ indented_class_target = """ import zope.interface class IFoo(Interface): pass def forceindent(): @zope.interface.implementer(IFoo) class Foo: pass @zope.interface.implementer(IFoo) class Bar: pass """ # Edge cases I've encountered. edge_cases_source = """ class Test(unittest.TestCase): # Note that most of the tests are in the doc strings of the # declarations module. def test_builtins(self): # Setup intspec = implementedBy(int) olddeclared = intspec.declared classImplements(int, I1) class myint(int): implements(I2) def test_implementedBy(self): class I2(I1): pass class C1(Odd): implements(I2) class C2(C1): implements(I3) """ edge_cases_target = """ class Test(unittest.TestCase): # Note that most of the tests are in the doc strings of the # declarations module. def test_builtins(self): # Setup intspec = implementedBy(int) olddeclared = intspec.declared classImplements(int, I1) @implementer(I2) class myint(int): pass def test_implementedBy(self): class I2(I1): pass @implementer(I2) class C1(Odd): pass @implementer(I3) class C2(C1): pass """ class FixerTest(unittest.TestCase): def _test(self, source, target): refactored = str(self.refactor(source, 'zope.fixer.test')) if refactored != target: match = '' for i in range(min(len(refactored), len(target))): if refactored[i] == target[i]: match += refactored[i] else: break msg = "\nResult:\n" + refactored msg += "\nFailed:\n" + refactored[i:] msg += "\nTarget:\n" + target[i:] # Make spaces and tabs visible: msg = msg.replace(' ', '°') msg = msg.replace('\t', '------->') msg = ("Test failed at character %i" % i) + msg self.fail(msg) class ImplementsFixerTest(FixerTest): def setUp(self): self.refactor = RefactoringTool(['zope.fixers.fix_implements']).refactor_string def test_imports(self): self._test(imports_source, imports_target) def test_simple(self): self._test(simple_source, simple_target) def test_multi(self): self._test(multi_source, multi_target) def test_renamed(self): self._test(renamed_source, renamed_target) def test_module_import(self): self._test(module_import_source, module_import_target) def test_module_renamed(self): self._test(module_renamed_source, module_renamed_target) def test_full_import(self): self._test(full_import_source, full_import_target) def test_empty_class(self): self._test(empty_class_source, empty_class_target) def test_indented_class(self): self._test(indented_class_source, indented_class_target) def test_edge_cases(self): self._test(edge_cases_source, edge_cases_target) implements_only_source = """ from zope.interface import implementsOnly class IFoo(Interface): pass class Foo: "An IFoo class" implementsOnly(IFoo) """ implements_only_target = """ from zope.interface import implementer_only class IFoo(Interface): pass @implementer_only(IFoo) class Foo: "An IFoo class" """ class ImplementsOnlyFixerTest(FixerTest): def setUp(self): self.refactor = RefactoringTool(['zope.fixers.fix_implements_only']).refactor_string def test_implements_only(self): self._test(implements_only_source, implements_only_target) doctest_source = """ >>> class A(object): ... implements(I1) >>> class B(object): ... implements(I2) >>> class Foo(object): ... implements(IFoo) ... x = 1 ... def __init__(self): ... self.y = 2 """ doctest_target = """ >>> @implementer(I1) ... class A(object): ... pass >>> @implementer(I2) ... class B(object): ... pass >>> @implementer(IFoo) ... class Foo(object): ... x = 1 ... def __init__(self): ... self.y = 2 """ class DoctestFixerTest(FixerTest): def setUp(self): self.refactor = RefactoringTool(['zope.fixers.fix_implements']).refactor_docstring def test_doctest(self): self._test(doctest_source, doctest_target) dual_fixes_source = """ >>> class C(object): ... implements(IFoo) ... classProvides(IFooFactory) """ dual_fixes_target = """ >>> @provider(IFooFactory) ... @implementer(IFoo) ... class C(object): ... pass """ class DualFixersTest(FixerTest): def setUp(self): self.refactor = RefactoringTool(['zope.fixers.fix_implements', 'zope.fixers.fix_class_provides'] ).refactor_docstring def test_dualfixers(self): self._test(dual_fixes_source, dual_fixes_target) zope.fixers-1.0/zope/fixers/__init__.py0000644000175000017500000000000011252677625021643 0ustar lregebrolregebro00000000000000zope.fixers-1.0/zope/fixers/fix_class_provides.py0000644000175000017500000000152711252677625024011 0ustar lregebrolregebro00000000000000############################################################################## # # Copyright (c) 2009 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. # ############################################################################## """Fixer for implements(IX) -> @implementer(IX). $Id$ """ from .base import Function2DecoratorBase class FixClassProvides(Function2DecoratorBase): FUNCTION_NAME = 'classProvides' DECORATOR_NAME = 'provider' zope.fixers-1.0/zope/__init__.py0000644000175000017500000000036411252677625020360 0ustar lregebrolregebro00000000000000# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages try: __import__('pkg_resources').declare_namespace(__name__) except ImportError: from pkgutil import extend_path __path__ = extend_path(__path__, __name__) zope.fixers-1.0/CHANGES.txt0000644000175000017500000000031211252677625017074 0ustar lregebrolregebro00000000000000CHANGES ******* ================== 1.0.0 (unreleased) ================== Initial release. Includes the implements fix to change implements(IFoo) class body call to @implementer(IFoo) class decorator.zope.fixers-1.0/setup.cfg0000644000175000017500000000007311252677752017111 0ustar lregebrolregebro00000000000000[egg_info] tag_build = tag_date = 0 tag_svn_revision = 0 zope.fixers-1.0/ZPL.txt0000644000175000017500000000413611252677625016501 0ustar lregebrolregebro00000000000000Zope 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.fixers-1.0/README.txt0000644000175000017500000000172211252677625016767 0ustar lregebrolregebro00000000000000Introduction ============ Fixers for Zope Component Architecture and the frameworks built with it. Currently, there is only one fixer, fix_implements. This fixer will change all uses of implements(IFoo) in a class body to the class decorator @implementer(IFoo), which is the most likely Python 3 syntax for zope.interfaces implements statements. zope.fixers requires Python 3.1. Usage ----- To use this you typically want all teh fixers from lib2to3, and add the fixers from zope.fixers to it. Like so: >>> from lib2to3.refactor import RefactoringTool, get_fixers_from_package >>> fixers = get_fixers_from_package('lib2to3.fixes') + \ ... get_fixers_from_package('zope.fixers') And the run the fixing with the fixers: >>> tool = RefactoringTool(fixers) >>> tool.refactor(files, write=True) For an example usage within setuptools, look at: http://svn.zope.org/zope.interface/branches/regebro-python3/build_ext_3.py?rev=98993&view=markup zope.fixers-1.0/zope.fixers.egg-info/0000755000175000017500000000000011252677752021236 5ustar lregebrolregebro00000000000000zope.fixers-1.0/zope.fixers.egg-info/not-zip-safe0000644000175000017500000000000111252677651023462 0ustar lregebrolregebro00000000000000 zope.fixers-1.0/zope.fixers.egg-info/requires.txt0000644000175000017500000000001211252677752023627 0ustar lregebrolregebro00000000000000setuptoolszope.fixers-1.0/zope.fixers.egg-info/namespace_packages.txt0000644000175000017500000000000511252677752025564 0ustar lregebrolregebro00000000000000zope zope.fixers-1.0/zope.fixers.egg-info/top_level.txt0000644000175000017500000000000511252677752023763 0ustar lregebrolregebro00000000000000zope zope.fixers-1.0/zope.fixers.egg-info/entry_points.txt0000644000175000017500000000004511252677752024533 0ustar lregebrolregebro00000000000000 # -*- Entry points: -*- zope.fixers-1.0/zope.fixers.egg-info/SOURCES.txt0000644000175000017500000000101711252677752023121 0ustar lregebrolregebro00000000000000CHANGES.txt README.txt ZPL.txt setup.py docs/HISTORY.txt zope/__init__.py zope.fixers.egg-info/PKG-INFO zope.fixers.egg-info/SOURCES.txt zope.fixers.egg-info/dependency_links.txt zope.fixers.egg-info/entry_points.txt zope.fixers.egg-info/namespace_packages.txt zope.fixers.egg-info/not-zip-safe zope.fixers.egg-info/requires.txt zope.fixers.egg-info/top_level.txt zope/fixers/__init__.py zope/fixers/base.py zope/fixers/fix_class_provides.py zope/fixers/fix_implements.py zope/fixers/fix_implements_only.py zope/fixers/tests.pyzope.fixers-1.0/zope.fixers.egg-info/dependency_links.txt0000644000175000017500000000000111252677752025304 0ustar lregebrolregebro00000000000000 zope.fixers-1.0/zope.fixers.egg-info/PKG-INFO0000644000175000017500000000330511252677752022334 0ustar lregebrolregebro00000000000000Metadata-Version: 1.0 Name: zope.fixers Version: 1.0 Summary: 2to3 fixers for Zope Home-page: http://svn.zope.org/zope.fixers/ Author: Lennart Regebro Author-email: regebro@gmail.com License: ZPL Description: Introduction ============ Fixers for Zope Component Architecture and the frameworks built with it. Currently, there is only one fixer, fix_implements. This fixer will change all uses of implements(IFoo) in a class body to the class decorator @implementer(IFoo), which is the most likely Python 3 syntax for zope.interfaces implements statements. zope.fixers requires Python 3.1. Usage ----- To use this you typically want all teh fixers from lib2to3, and add the fixers from zope.fixers to it. Like so: >>> from lib2to3.refactor import RefactoringTool, get_fixers_from_package >>> fixers = get_fixers_from_package('lib2to3.fixes') + \ ... get_fixers_from_package('zope.fixers') And the run the fixing with the fixers: >>> tool = RefactoringTool(fixers) >>> tool.refactor(files, write=True) For an example usage within setuptools, look at: http://svn.zope.org/zope.interface/branches/regebro-python3/build_ext_3.py?rev=98993&view=markup Changelog ========= 1.0 - Unreleased ---------------- * Initial release Keywords: 2to3 python3 zope Platform: UNKNOWN Classifier: Programming Language :: Python Classifier: Topic :: Software Development :: Libraries :: Python Modules zope.fixers-1.0/setup.py0000644000175000017500000000323311252677625017002 0ustar lregebrolregebro00000000000000############################################################################## # # Copyright (c) 2009 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.fixers package $Id$ """ from setuptools import setup, find_packages import os version = '1.0' setup(name='zope.fixers', version=version, description="2to3 fixers for Zope", long_description=open("README.txt").read() + "\n" + open(os.path.join("docs", "HISTORY.txt")).read(), # Get more strings from http://www.python.org/pypi?%3Aaction=list_classifiers classifiers=[ "Programming Language :: Python", "Topic :: Software Development :: Libraries :: Python Modules", ], keywords='2to3 python3 zope', author='Lennart Regebro', author_email='regebro@gmail.com', url='http://svn.zope.org/zope.fixers/', license='ZPL', packages=find_packages(exclude=['ez_setup']), namespace_packages=['zope'], include_package_data=True, zip_safe=False, install_requires=[ 'setuptools', ], entry_points=""" # -*- Entry points: -*- """, test_suite = 'zope.fixers.tests', ) zope.fixers-1.0/PKG-INFO0000644000175000017500000000330511252677752016366 0ustar lregebrolregebro00000000000000Metadata-Version: 1.0 Name: zope.fixers Version: 1.0 Summary: 2to3 fixers for Zope Home-page: http://svn.zope.org/zope.fixers/ Author: Lennart Regebro Author-email: regebro@gmail.com License: ZPL Description: Introduction ============ Fixers for Zope Component Architecture and the frameworks built with it. Currently, there is only one fixer, fix_implements. This fixer will change all uses of implements(IFoo) in a class body to the class decorator @implementer(IFoo), which is the most likely Python 3 syntax for zope.interfaces implements statements. zope.fixers requires Python 3.1. Usage ----- To use this you typically want all teh fixers from lib2to3, and add the fixers from zope.fixers to it. Like so: >>> from lib2to3.refactor import RefactoringTool, get_fixers_from_package >>> fixers = get_fixers_from_package('lib2to3.fixes') + \ ... get_fixers_from_package('zope.fixers') And the run the fixing with the fixers: >>> tool = RefactoringTool(fixers) >>> tool.refactor(files, write=True) For an example usage within setuptools, look at: http://svn.zope.org/zope.interface/branches/regebro-python3/build_ext_3.py?rev=98993&view=markup Changelog ========= 1.0 - Unreleased ---------------- * Initial release Keywords: 2to3 python3 zope Platform: UNKNOWN Classifier: Programming Language :: Python Classifier: Topic :: Software Development :: Libraries :: Python Modules