[Checkins] SVN: lovely.recipe/trunk/ - i18nextract allows the
definition of a custem configure.zcml which is needed
Juergen Kartnaller
juergen at kartnaller.at
Thu Aug 30 09:25:08 EDT 2007
Log message for revision 79382:
- i18nextract allows the definition of a custem configure.zcml which is needed
to be able to use it with package who do not contain a full configuration
setup.
- fix tests to run not only on jukart's mac
Changed:
U lovely.recipe/trunk/CHANGES.txt
U lovely.recipe/trunk/setup.py
U lovely.recipe/trunk/src/lovely/recipe/fs/tests.py
U lovely.recipe/trunk/src/lovely/recipe/i18n/README.txt
U lovely.recipe/trunk/src/lovely/recipe/i18n/i18n.py
A lovely.recipe/trunk/src/lovely/recipe/i18n/tests.py
U lovely.recipe/trunk/src/lovely/recipe/importchecker/tests.py
A lovely.recipe/trunk/src/lovely/recipe/testing.py
-=-
Modified: lovely.recipe/trunk/CHANGES.txt
===================================================================
--- lovely.recipe/trunk/CHANGES.txt 2007-08-30 13:20:06 UTC (rev 79381)
+++ lovely.recipe/trunk/CHANGES.txt 2007-08-30 13:25:07 UTC (rev 79382)
@@ -2,7 +2,16 @@
Changes for lovely.recipe
=========================
+After
+=====
+- i18nextract allows the definition of a custem configure.zcml which is needed
+ to be able to use it with package who do not contain a full configuration
+ setup.
+
+- fix tests to run not only on jukart's mac
+
+
2007/06/04 0.3.0a1:
===================
Modified: lovely.recipe/trunk/setup.py
===================================================================
--- lovely.recipe/trunk/setup.py 2007-08-30 13:20:06 UTC (rev 79381)
+++ lovely.recipe/trunk/setup.py 2007-08-30 13:25:07 UTC (rev 79382)
@@ -23,6 +23,7 @@
install_requires = ['setuptools',
'zc.buildout',
'zc.recipe.egg',
+ 'zope.app.locales',
],
entry_points = entry_points,
zip_safe = True,
Modified: lovely.recipe/trunk/src/lovely/recipe/fs/tests.py
===================================================================
--- lovely.recipe/trunk/src/lovely/recipe/fs/tests.py 2007-08-30 13:20:06 UTC (rev 79381)
+++ lovely.recipe/trunk/src/lovely/recipe/fs/tests.py 2007-08-30 13:25:07 UTC (rev 79382)
@@ -1,3 +1,21 @@
+##############################################################################
+#
+# Copyright (c) 2007 Lovely Systems 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.
+#
+##############################################################################
+"""
+$Id$
+"""
+__docformat__ = 'restructuredtext'
+
from zc.buildout import testing
import doctest, unittest
from zope.testing import doctest, renormalizing
@@ -2,17 +20,16 @@
-def setUp(test):
- testing.buildoutSetUp(test)
- testing.install_develop('zc.recipe.egg', test)
- testing.install_develop('lovely.recipe', test)
+from lovely.recipe.testing import setUpBuildout
+
def test_suite():
return unittest.TestSuite((
doctest.DocFileSuite('README.txt',
- setUp=setUp,
+ setUp=setUpBuildout,
tearDown=testing.buildoutTearDown,
checker=renormalizing.RENormalizing([
- testing.normalize_path,
- testing.normalize_script,
- testing.normalize_egg_py])
+ testing.normalize_path,
+ testing.normalize_script,
+ testing.normalize_egg_py])
)))
+
Modified: lovely.recipe/trunk/src/lovely/recipe/i18n/README.txt
===================================================================
--- lovely.recipe/trunk/src/lovely/recipe/i18n/README.txt 2007-08-30 13:20:06 UTC (rev 79381)
+++ lovely.recipe/trunk/src/lovely/recipe/i18n/README.txt 2007-08-30 13:25:07 UTC (rev 79382)
@@ -13,7 +13,6 @@
... [buildout]
... parts = i18n
...
- ... find-links = http://download.zope.org/distribution
... offline = true
...
... [i18n]
@@ -22,7 +21,6 @@
... domain = recipe
... location = src/somewhere
... output = locales
- ... zcml = src/somewhere/configure.zcml
... maker = z3c.csvvocabulary.csvStrings
... """)
>>> print system(buildout),
@@ -37,16 +35,106 @@
- i18nextract
- i18nmergeall
+
+The i18n Extractor
+------------------
+
>>> cat('bin', 'i18nextract')
- #!/opt/local/bin/python
+ #!...
<BLANKLINE>
import sys
sys.path[0:0] = [
- ,
+ ...
]
<BLANKLINE>
import lovely.recipe.i18n.i18nextract
<BLANKLINE>
if __name__ == '__main__':
- lovely.recipe.i18n.i18nextract.main()
+ lovely.recipe.i18n.i18nextract.main(['i18nextract', '-d', 'recipe', '-s', '/sample-buildout/parts/i18n/configure.zcml', '-p', 'src/somewhere', '-o', 'locales', '-m', 'z3c.csvvocabulary.csvStrings'])
+We have a configure.zcml created.
+
+ >>> cat('parts', 'i18n', 'configure.zcml')
+ <configure xmlns='http://namespaces.zope.org/zope'>
+ <include package="lovely.recipe" />
+ </configure>
+
+
+i18n Merge
+----------
+
+ >>> cat('bin', 'i18nmergeall')
+ #!...
+ <BLANKLINE>
+ import sys
+ sys.path[0:0] = [
+ ...
+ ]
+ <BLANKLINE>
+ import lovely.recipe.i18n.i18nmergeall
+ <BLANKLINE>
+ if __name__ == '__main__':
+ lovely.recipe.i18n.i18nmergeall.main(['i18nmergeall', '-l', 'src/somewhere/locales'])
+
+
+Adding a custom configure.zcml
+------------------------------
+
+The created configure.zcml includes the package an assumes that the package
+contains a configure.zcml. If this is not the case or if additional package
+includes are needed then the zcml parameter can be used to define the content
+of the generated configure.zcml.
+
+ >>> write(sample_buildout, 'buildout.cfg',
+ ... """
+ ... [buildout]
+ ... parts = i18n
+ ...
+ ... offline = true
+ ...
+ ... [i18n]
+ ... recipe = lovely.recipe:i18n
+ ... package = lovely.recipe
+ ... domain = recipe
+ ... location = src/somewhere
+ ... output = locales
+ ... maker = z3c.csvvocabulary.csvStrings
+ ... zcml =
+ ... <include package='zope.component' file='meta.zcml' />
+ ... <include package='lovely.recipe' />
+ ...
+ ... """)
+
+ >>> print system(buildout),
+ Uninstalling i18n.
+ Installing i18n.
+ i18n: setting up i18n tools
+ Generated script 'bin/i18nextract'.
+ Generated script 'bin/i18nmergeall'.
+
+ >>> cat('bin', 'i18nextract')
+ #!...
+ <BLANKLINE>
+ import sys
+ sys.path[0:0] = [
+ ...
+ ]
+ <BLANKLINE>
+ import lovely.recipe.i18n.i18nextract
+ <BLANKLINE>
+ if __name__ == '__main__':
+ lovely.recipe.i18n.i18nextract.main(['i18nextract', '-d', 'recipe', '-s', '/sample-buildout/parts/i18n/configure.zcml', '-p', 'src/somewhere', '-o', 'locales', '-m', 'z3c.csvvocabulary.csvStrings'])
+
+And the generated configure-zcml contains our extra code.
+
+ >>> cat('parts', 'i18n', 'configure.zcml')
+ <configure xmlns='http://namespaces.zope.org/zope'
+ xmlns:meta="http://namespaces.zope.org/meta"
+ >
+ <BLANKLINE>
+ <BLANKLINE>
+ <include package='zope.component' file='meta.zcml' />
+ <include package='lovely.recipe' />
+ <BLANKLINE>
+ </configure>
+
Modified: lovely.recipe/trunk/src/lovely/recipe/i18n/i18n.py
===================================================================
--- lovely.recipe/trunk/src/lovely/recipe/i18n/i18n.py 2007-08-30 13:20:06 UTC (rev 79381)
+++ lovely.recipe/trunk/src/lovely/recipe/i18n/i18n.py 2007-08-30 13:25:07 UTC (rev 79382)
@@ -46,15 +46,27 @@
requirements, ws = self.egg.working_set()
+ package = self.options['package']
+ zcml = self.options.get('zcml', None)
+ if zcml is None:
+ zcml = staticTemplate% package
+ else:
+ zcml = template % zcml
+ partsDir = os.path.join(
+ self.buildout['buildout']['parts-directory'],
+ self.name,
+ )
+ if not os.path.exists(partsDir):
+ os.mkdir(partsDir)
+ zcmlFilename = os.path.join(partsDir, 'configure.zcml')
+ file(zcmlFilename, 'w').write(zcml)
+
arguments = ['i18nextract',
- '-d', self.options.get('domain',
- self.options['package']),
+ '-d', self.options.get('domain', package),
+ '-s', zcmlFilename,
'-p', self.options['location'],
'-o', self.options.get('output', 'locales'),
]
- zcml = self.options.get('zcml', None)
- if zcml is not None:
- arguments.extend(['-s', zcml])
makers = [m for m in self.options.get('maker', '').split() if m!='']
for m in makers:
arguments.extend(['-m', m])
@@ -81,3 +93,19 @@
return generated
+staticTemplate = """<configure xmlns='http://namespaces.zope.org/zope'>
+ <include package="%s" />
+</configure>
+"""
+
+
+template = """<configure xmlns='http://namespaces.zope.org/zope'
+ xmlns:meta="http://namespaces.zope.org/meta"
+ >
+
+ %s
+
+</configure>
+"""
+
+
Added: lovely.recipe/trunk/src/lovely/recipe/i18n/tests.py
===================================================================
--- lovely.recipe/trunk/src/lovely/recipe/i18n/tests.py (rev 0)
+++ lovely.recipe/trunk/src/lovely/recipe/i18n/tests.py 2007-08-30 13:25:07 UTC (rev 79382)
@@ -0,0 +1,37 @@
+##############################################################################
+#
+# Copyright (c) 2007 Lovely Systems 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.
+#
+##############################################################################
+"""
+$Id$
+"""
+__docformat__ = 'restructuredtext'
+
+from zc.buildout import testing
+import doctest, unittest
+from zope.testing import doctest, renormalizing
+
+from lovely.recipe.testing import setUpBuildout
+
+
+def test_suite():
+ return unittest.TestSuite((
+ doctest.DocFileSuite('README.txt',
+ setUp=setUpBuildout,
+ tearDown=testing.buildoutTearDown,
+ optionflags=doctest.ELLIPSIS,
+ checker=renormalizing.RENormalizing([
+ testing.normalize_path,
+ testing.normalize_script,
+ testing.normalize_egg_py])
+ )))
+
Property changes on: lovely.recipe/trunk/src/lovely/recipe/i18n/tests.py
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Modified: lovely.recipe/trunk/src/lovely/recipe/importchecker/tests.py
===================================================================
--- lovely.recipe/trunk/src/lovely/recipe/importchecker/tests.py 2007-08-30 13:20:06 UTC (rev 79381)
+++ lovely.recipe/trunk/src/lovely/recipe/importchecker/tests.py 2007-08-30 13:25:07 UTC (rev 79382)
@@ -20,15 +20,13 @@
import doctest, unittest
from zope.testing import doctest, renormalizing
-def setUp(test):
- testing.buildoutSetUp(test)
- testing.install_develop('zc.recipe.egg', test)
- testing.install_develop('lovely.recipe', test)
+from lovely.recipe.testing import setUpBuildout
+
def test_suite():
return unittest.TestSuite((
doctest.DocFileSuite('README.txt',
- setUp=setUp,
+ setUp=setUpBuildout,
tearDown=testing.buildoutTearDown,
optionflags=doctest.ELLIPSIS,
checker=renormalizing.RENormalizing([
Added: lovely.recipe/trunk/src/lovely/recipe/testing.py
===================================================================
--- lovely.recipe/trunk/src/lovely/recipe/testing.py (rev 0)
+++ lovely.recipe/trunk/src/lovely/recipe/testing.py 2007-08-30 13:25:07 UTC (rev 79382)
@@ -0,0 +1,68 @@
+from zc.buildout import testing
+
+
+def setUpBuildout(test):
+ testing.buildoutSetUp(test)
+ testing.install_develop('zc.recipe.egg', test)
+ testing.install_develop('lovely.recipe', test)
+ testing.install_develop('ZODB3', test)
+ testing.install_develop('zodbcode', test)
+ testing.install_develop('pytz', test)
+ testing.install_develop('RestrictedPython', test)
+ testing.install_develop('zdaemon', test)
+ testing.install_develop('ZConfig', test)
+ testing.install_develop('zope.annotation', test)
+ testing.install_develop('zope.cachedescriptors', test)
+ testing.install_develop('zope.configuration', test)
+ testing.install_develop('zope.component', test)
+ testing.install_develop('zope.contenttype', test)
+ testing.install_develop('zope.copypastemove', test)
+ testing.install_develop('zope.deprecation', test)
+ testing.install_develop('zope.dublincore', test)
+ testing.install_develop('zope.filerepresentation', test)
+ testing.install_develop('zope.formlib', test)
+ testing.install_develop('zope.interface', test)
+ testing.install_develop('zope.i18nmessageid', test)
+ testing.install_develop('zope.i18n', test)
+ testing.install_develop('zope.datetime', test)
+ testing.install_develop('zope.deferredimport', test)
+ testing.install_develop('zope.dottedname', test)
+ testing.install_develop('zope.event', test)
+ testing.install_develop('zope.exceptions', test)
+ testing.install_develop('zope.hookable', test)
+ testing.install_develop('zope.minmax', test)
+ testing.install_develop('zope.pagetemplate', test)
+ testing.install_develop('zope.proxy', test)
+ testing.install_develop('zope.publisher', test)
+ testing.install_develop('zope.size', test)
+ testing.install_develop('zope.security', test)
+ testing.install_develop('zope.lifecycleevent', test)
+ testing.install_develop('zope.location', test)
+ testing.install_develop('zope.schema', test)
+ testing.install_develop('zope.tal', test)
+ testing.install_develop('zope.tales', test)
+ testing.install_develop('zope.testing', test)
+ testing.install_develop('zope.thread', test)
+ testing.install_develop('zope.traversing', test)
+ testing.install_develop('zope.app.appsetup', test)
+ testing.install_develop('zope.app.authentication', test)
+ testing.install_develop('zope.app.applicationcontrol', test)
+ testing.install_develop('zope.app.basicskin', test)
+ testing.install_develop('zope.app.broken', test)
+ testing.install_develop('zope.app.container', test)
+ testing.install_develop('zope.app.component', test)
+ testing.install_develop('zope.app.error', test)
+ testing.install_develop('zope.app.exception', test)
+ testing.install_develop('zope.app.folder', test)
+ testing.install_develop('zope.app.form', test)
+ testing.install_develop('zope.app.http', test)
+ testing.install_develop('zope.app.i18n', test)
+ testing.install_develop('zope.app.interface', test)
+ testing.install_develop('zope.app.locales', test)
+ testing.install_develop('zope.app.pagetemplate', test)
+ testing.install_develop('zope.app.publication', test)
+ testing.install_develop('zope.app.publisher', test)
+ testing.install_develop('zope.app.security', test)
+ testing.install_develop('zope.app.session', test)
+ testing.install_develop('zope.app.zapi', test)
+
Property changes on: lovely.recipe/trunk/src/lovely/recipe/testing.py
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
More information about the Checkins
mailing list