[Checkins] SVN: z3c.recipe.mkdir/trunk/ Fix (unnoticed?) bug and clean up main code a bit.
Ulrich Fouquet
cvs-admin at zope.org
Sat Jun 23 01:03:55 UTC 2012
Log message for revision 127051:
Fix (unnoticed?) bug and clean up main code a bit.
Changed:
U z3c.recipe.mkdir/trunk/CHANGES.txt
U z3c.recipe.mkdir/trunk/z3c/recipe/mkdir/__init__.py
A z3c.recipe.mkdir/trunk/z3c/recipe/mkdir/regression.txt
U z3c.recipe.mkdir/trunk/z3c/recipe/mkdir/tests.py
-=-
Modified: z3c.recipe.mkdir/trunk/CHANGES.txt
===================================================================
--- z3c.recipe.mkdir/trunk/CHANGES.txt 2012-06-22 20:44:49 UTC (rev 127050)
+++ z3c.recipe.mkdir/trunk/CHANGES.txt 2012-06-23 01:03:50 UTC (rev 127051)
@@ -4,6 +4,12 @@
0.4 (unreleased)
================
+* Fixed (unnoticed?) bug when using the deprecated ``path`` option. In
+ that case the default path (``parts/<sectionname>``) was created
+ instead of the given one.
+
+* Shortened main code.
+
* Updated tests to run with `zc.buildout` 1.5, thus requiring at least this
version.
Modified: z3c.recipe.mkdir/trunk/z3c/recipe/mkdir/__init__.py
===================================================================
--- z3c.recipe.mkdir/trunk/z3c/recipe/mkdir/__init__.py 2012-06-22 20:44:49 UTC (rev 127050)
+++ z3c.recipe.mkdir/trunk/z3c/recipe/mkdir/__init__.py 2012-06-23 01:03:50 UTC (rev 127051)
@@ -11,27 +11,18 @@
self.remove_on_update = string_to_bool(
options.get('remove-on-update', 'no'))
- paths = None
-
if 'path' in options.keys():
self.logger.warn(
"Use of 'path' option is deprectated. Use 'paths' instead.")
- paths = options['path']
- if "paths" in options:
- paths = options["paths"]
- else:
- paths = os.path.join(
- buildout['buildout']['parts-directory'], name)
- paths = [x.strip() for x in paths.split('\n')]
- paths = [os.path.abspath(x) for x in paths]
- paths = [os.path.normpath(x) for x in paths]
- self.paths = paths
+ paths = options.get(
+ 'paths', options.get('path', os.path.join(
+ buildout['buildout']['parts-directory'], name)))
+ self.paths = [os.path.normpath(os.path.abspath(
+ x.strip())) for x in paths.split('\n')]
# Update options to be referencable...
- paths_strings = '\n'.join(paths)
- options['path'] = paths_strings
- options['paths'] = paths_strings
+ options['path'] = options['paths'] = '\n'.join(self.paths)
def install(self):
for path in self.paths:
Added: z3c.recipe.mkdir/trunk/z3c/recipe/mkdir/regression.txt
===================================================================
--- z3c.recipe.mkdir/trunk/z3c/recipe/mkdir/regression.txt (rev 0)
+++ z3c.recipe.mkdir/trunk/z3c/recipe/mkdir/regression.txt 2012-06-23 01:03:50 UTC (rev 127051)
@@ -0,0 +1,33 @@
+Regression Tests
+================
+
+ >>> write('buildout.cfg',
+ ... '''
+ ... [buildout]
+ ... parts = mydir
+ ... offline = true
+ ...
+ ... [mydir]
+ ... recipe = z3c.recipe.mkdir
+ ... path = my/nested/dir
+ ... ''')
+
+Using 'path' (deprecated but we promised to still support it) creates
+the given path and not the default (parts/mydir) (bug up to 0.3.1):
+
+Now we can run buildout:
+
+ >>> print system(join('bin', 'buildout')),
+ mydir: Use of 'path' option is deprectated. Use 'paths' instead.
+ Installing mydir.
+ mydir: created path: /sample-buildout/my
+ mydir: created path: /sample-buildout/my/nested
+ mydir: created path: /sample-buildout/my/nested/dir
+
+The directories were indeed created in the current directory:
+
+ >>> ls('my')
+ d nested
+
+ >>> ls('my/nested')
+ d dir
Modified: z3c.recipe.mkdir/trunk/z3c/recipe/mkdir/tests.py
===================================================================
--- z3c.recipe.mkdir/trunk/z3c/recipe/mkdir/tests.py 2012-06-22 20:44:49 UTC (rev 127050)
+++ z3c.recipe.mkdir/trunk/z3c/recipe/mkdir/tests.py 2012-06-23 01:03:50 UTC (rev 127051)
@@ -43,7 +43,7 @@
def test_suite():
return unittest.TestSuite(
- doctest.DocFileSuite('README.txt',
+ doctest.DocFileSuite('README.txt', 'regression.txt',
setUp=setUp, tearDown=zc.buildout.testing.buildoutTearDown,
optionflags=doctest.ELLIPSIS, checker=checker),
)
More information about the checkins
mailing list