[Checkins] SVN: zc.recipe.cmmi/trunk/ buildoutified

Jim Fulton jim at zope.com
Tue Nov 21 17:20:36 EST 2006


Log message for revision 71257:
  buildoutified
  

Changed:
  _U  zc.recipe.cmmi/trunk/
  A   zc.recipe.cmmi/trunk/buildout.cfg
  A   zc.recipe.cmmi/trunk/zc/recipe/cmmi/README.txt
  U   zc.recipe.cmmi/trunk/zc/recipe/cmmi/__init__.py
  A   zc.recipe.cmmi/trunk/zc/recipe/cmmi/tests.py

-=-

Property changes on: zc.recipe.cmmi/trunk
___________________________________________________________________
Name: svn:ignore
   + develop-eggs
bin
parts


Added: zc.recipe.cmmi/trunk/buildout.cfg
===================================================================
--- zc.recipe.cmmi/trunk/buildout.cfg	2006-11-21 22:19:10 UTC (rev 71256)
+++ zc.recipe.cmmi/trunk/buildout.cfg	2006-11-21 22:20:35 UTC (rev 71257)
@@ -0,0 +1,8 @@
+[buildout]
+develop = .
+parts = test
+
+[test]
+recipe = zc.recipe.testrunner
+eggs = zc.recipe.cmmi
+


Property changes on: zc.recipe.cmmi/trunk/buildout.cfg
___________________________________________________________________
Name: svn:eol-style
   + native

Added: zc.recipe.cmmi/trunk/zc/recipe/cmmi/README.txt
===================================================================
--- zc.recipe.cmmi/trunk/zc/recipe/cmmi/README.txt	2006-11-21 22:19:10 UTC (rev 71256)
+++ zc.recipe.cmmi/trunk/zc/recipe/cmmi/README.txt	2006-11-21 22:20:35 UTC (rev 71257)
@@ -0,0 +1,45 @@
+The configure-make-make-install recipe automates installation of
+traditional configure-based source distribution into buildouts.
+
+The only option is the url option which gives the location of a source
+archive.   We have an archive with a demo foo tar ball:
+
+    >>> ls(distros)
+    -  foo.tgz
+
+Let's update a sample buildout to installs it:
+
+    >>> write('buildout.cfg',
+    ... """
+    ... [buildout]
+    ... parts = foo
+    ...
+    ... [foo]
+    ... recipe = zc.recipe.cmmi
+    ... url = file://%s/foo.tgz
+    ... """ % distros)
+
+We used the URL option to specify the location of the archive.
+
+If we run the buildout, the configure script in the archive is run.
+It creates a make file which is also run:
+
+    >>> print system('bin/buildout'),
+    buildout: Installing foo
+    configuring foo --prefix=/sample-buildout/parts/foo
+    echo building foo
+    building foo
+    echo installing foo
+    installing foo
+
+The recipe also creates the parts directory:
+
+    >>> ls(sample_buildout, 'parts')
+    d  foo
+
+If we run the buildout again, the update method will be called, which
+does nothing:
+
+    >>> print system('bin/buildout'),
+    buildout: Updating foo
+


Property changes on: zc.recipe.cmmi/trunk/zc/recipe/cmmi/README.txt
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: zc.recipe.cmmi/trunk/zc/recipe/cmmi/__init__.py
===================================================================
--- zc.recipe.cmmi/trunk/zc/recipe/cmmi/__init__.py	2006-11-21 22:19:10 UTC (rev 71256)
+++ zc.recipe.cmmi/trunk/zc/recipe/cmmi/__init__.py	2006-11-21 22:20:35 UTC (rev 71257)
@@ -62,6 +62,9 @@
 
         return dest
 
+    def update(self):
+        pass
+
 def tar(stream, path, mode='r|'):
     import tarfile
     t = tarfile.open(mode=mode, fileobj=stream)

Added: zc.recipe.cmmi/trunk/zc/recipe/cmmi/tests.py
===================================================================
--- zc.recipe.cmmi/trunk/zc/recipe/cmmi/tests.py	2006-11-21 22:19:10 UTC (rev 71256)
+++ zc.recipe.cmmi/trunk/zc/recipe/cmmi/tests.py	2006-11-21 22:20:35 UTC (rev 71257)
@@ -0,0 +1,73 @@
+##############################################################################
+#
+# Copyright (c) 2006 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+
+import os, re, StringIO, sys, tarfile
+import zc.buildout.testing
+
+import unittest
+import zope.testing
+from zope.testing import doctest, renormalizing
+
+def setUp(test):
+    zc.buildout.testing.buildoutSetUp(test)
+    zc.buildout.testing.install_develop('zc.recipe.cmmi', test)
+    distros = test.globs['distros'] = test.globs['tmpdir']('distros')
+    tarpath = os.path.join(distros, 'foo.tgz')
+    tar = tarfile.open(tarpath, 'w:gz')
+    configure = configure_template % sys.executable
+    info = tarfile.TarInfo('configure')
+    info.size = len(configure)
+    info.mode = 0755
+    tar.addfile(info, StringIO.StringIO(configure))
+    
+
+def add(tar, name, src, mode=None):
+    info.size = len(src)
+    if mode is not None:
+        info.mode = mode
+    tar.addfile(info, StringIO.StringIO(src))
+
+configure_template = """#!%s
+import sys
+print "configuring foo", ' '.join(sys.argv[1:])
+
+Makefile_template = '''
+all:
+\techo building foo
+
+install:
+\techo installing foo
+'''
+
+open('Makefile', 'w').write(Makefile_template)
+
+"""
+    
+
+def test_suite():
+    return unittest.TestSuite((
+        #doctest.DocTestSuite(),
+        doctest.DocFileSuite(
+            'README.txt',
+            setUp=setUp, tearDown=zc.buildout.testing.buildoutTearDown,
+            checker=renormalizing.RENormalizing([
+                (re.compile('--prefix=\S+sample-buildout'),
+                 '--prefix=/sample_buildout'),
+#               zc.buildout.testing.normalize_path,
+#               zc.buildout.testing.normalize_script,
+#               zc.buildout.testing.normalize_egg_py,        
+               ])
+            ),
+        
+        ))


Property changes on: zc.recipe.cmmi/trunk/zc/recipe/cmmi/tests.py
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native



More information about the Checkins mailing list