[Checkins] SVN: zc.recipe.cmmi/branches/tlotze-download-api/src/zc/recipe/cmmi/ updated tests to how logging is done by zc.buildout's download API

Thomas Lotze tl at gocept.com
Thu Jun 18 13:25:22 EDT 2009


Log message for revision 101128:
  updated tests to how logging is done by zc.buildout's download API

Changed:
  U   zc.recipe.cmmi/branches/tlotze-download-api/src/zc/recipe/cmmi/README.txt
  U   zc.recipe.cmmi/branches/tlotze-download-api/src/zc/recipe/cmmi/__init__.py
  U   zc.recipe.cmmi/branches/tlotze-download-api/src/zc/recipe/cmmi/downloadcache.txt
  U   zc.recipe.cmmi/branches/tlotze-download-api/src/zc/recipe/cmmi/patching.txt
  U   zc.recipe.cmmi/branches/tlotze-download-api/src/zc/recipe/cmmi/shared.txt
  U   zc.recipe.cmmi/branches/tlotze-download-api/src/zc/recipe/cmmi/tests.py

-=-
Modified: zc.recipe.cmmi/branches/tlotze-download-api/src/zc/recipe/cmmi/README.txt
===================================================================
--- zc.recipe.cmmi/branches/tlotze-download-api/src/zc/recipe/cmmi/README.txt	2009-06-18 17:24:36 UTC (rev 101127)
+++ zc.recipe.cmmi/branches/tlotze-download-api/src/zc/recipe/cmmi/README.txt	2009-06-18 17:25:16 UTC (rev 101128)
@@ -1,9 +1,12 @@
-We have an archive with a demo foo tar ball:
+We have an archive with a demo foo tar ball and publish it by http in order
+to see  offline effects:
 
     >>> ls(distros)
     -  bar.tgz
     -  foo.tgz
 
+    >>> distros = start_server(distros)
+
 Let's update a sample buildout to installs it:
 
     >>> write('buildout.cfg',
@@ -13,7 +16,7 @@
     ...
     ... [foo]
     ... recipe = zc.recipe.cmmi
-    ... url = file://%s/foo.tgz
+    ... url = %sfoo.tgz
     ... """ % distros)
 
 We used the url option to specify the location of the archive.
@@ -23,7 +26,7 @@
 
     >>> print system('bin/buildout'),
     Installing foo.
-    foo: Downloading .../distros/foo.tgz
+    foo: Downloading http://localhost/foo.tgz
     foo: Unpacking and configuring
     configuring foo --prefix=/sample-buildout/parts/foo
     echo building foo
@@ -51,14 +54,14 @@
     ...
     ... [foo]
     ... recipe = zc.recipe.cmmi
-    ... url = file://%s/foo.tgz
+    ... url = %sfoo.tgz
     ... extra_options = -a -b c
     ... """ % distros)
 
     >>> print system('bin/buildout'),
     Uninstalling foo.
     Installing foo.
-    foo: Downloading .../distros/foo.tgz
+    foo: Downloading http://localhost/foo.tgz
     foo: Unpacking and configuring
     configuring foo --prefix=/sample-buildout/parts/foo -a -b c
     echo building foo
@@ -92,7 +95,7 @@
     ...
     ... [foo]
     ... recipe = zc.recipe.cmmi
-    ... url = file://%s/foo.tgz
+    ... url = %sfoo.tgz
     ... environment =
     ...   CFLAGS=-I/usr/lib/postgresql7.4/include
     ... """ % distros)
@@ -101,7 +104,7 @@
     >>> print system('bin/buildout'),
     Uninstalling foo.
     Installing foo.
-    foo: Downloading .../distros/foo.tgz
+    foo: Downloading http://localhost/foo.tgz
     foo: Unpacking and configuring
     foo: Updating environment: CFLAGS=-I/usr/lib/postgresql7.4/include
     configuring foo --prefix=/sample_buildout/parts/foo
@@ -150,7 +153,7 @@
     ...
     ... [foo]
     ... recipe = zc.recipe.cmmi
-    ... url = file://%s/foo.tgz
+    ... url = %sfoo.tgz
     ... patch = ${buildout:directory}/patches/config.patch
     ... patch_options = -p0
     ... """ % distros)
@@ -158,7 +161,7 @@
     >>> print system('bin/buildout'),
     Uninstalling foo.
     Installing foo.
-    foo: Downloading .../distros/foo.tgz
+    foo: Downloading http://localhost/foo.tgz
     foo: Unpacking and configuring
     patching file configure
     configuring foo patched --prefix=/sample_buildout/parts/foo
@@ -176,14 +179,14 @@
     ...
     ... [foo]
     ... recipe = zc.recipe.cmmi
-    ... url = file://%s/bar.tgz
+    ... url = %s/bar.tgz
     ... autogen = autogen.sh
     ... """ % distros)
 
     >>> print system('bin/buildout'),
     Uninstalling foo.
     Installing foo.
-    foo: Downloading .../distros/bar.tgz
+    foo: Downloading http://localhost//bar.tgz
     foo: Unpacking and configuring
     foo: auto generating configure files
     configuring foo --prefix=/sample_buildout/parts/foo

Modified: zc.recipe.cmmi/branches/tlotze-download-api/src/zc/recipe/cmmi/__init__.py
===================================================================
--- zc.recipe.cmmi/branches/tlotze-download-api/src/zc/recipe/cmmi/__init__.py	2009-06-18 17:24:36 UTC (rev 101127)
+++ zc.recipe.cmmi/branches/tlotze-download-api/src/zc/recipe/cmmi/__init__.py	2009-06-18 17:25:16 UTC (rev 101128)
@@ -72,9 +72,8 @@
                         "Set the 'shared' option of zc.recipe.cmmi to an existing"
                         " directory, or set ${buildout:download-cache}")
 
-                self.shared = os.path.join(directory, download_cache, 'build')
-                if not os.path.isdir(self.shared):
-                    os.mkdir(self.shared)
+                self.shared = os.path.join(
+                    directory, download_cache, 'cmmi', 'build')
                 self.shared = os.path.join(self.shared, self._state_hash())
 
             options['location'] = self.shared
@@ -91,14 +90,15 @@
     def install(self):
         logger = logging.getLogger(self.name)
         download = zc.buildout.download.Download(
-            self.buildout['buildout'], namespace='cmmi', hash_name=True)
+            self.buildout['buildout'], namespace='cmmi', hash_name=True,
+            logger=logger)
 
         if self.shared:
             if os.path.isdir(self.shared):
                 logger.info('using existing shared build')
                 return ()
             else:
-                os.mkdir(self.shared)
+                os.makedirs(self.shared)
 
         dest = self.options['location']
         here = os.getcwd()

Modified: zc.recipe.cmmi/branches/tlotze-download-api/src/zc/recipe/cmmi/downloadcache.txt
===================================================================
--- zc.recipe.cmmi/branches/tlotze-download-api/src/zc/recipe/cmmi/downloadcache.txt	2009-06-18 17:24:36 UTC (rev 101127)
+++ zc.recipe.cmmi/branches/tlotze-download-api/src/zc/recipe/cmmi/downloadcache.txt	2009-06-18 17:25:16 UTC (rev 101128)
@@ -14,12 +14,15 @@
 
     >>> cache = tmpdir('cache')
 
-We have an archive with a demo foo tar ball:
+We have an archive with a demo foo tar ball and publish it by http in order
+to see offline effects:
 
     >>> ls(distros)
     -  bar.tgz
     -  foo.tgz
 
+    >>> distros = start_server(distros)
+
 Let's update a sample buildout to install it:
 
     >>> write('buildout.cfg',
@@ -31,7 +34,7 @@
     ...
     ... [foo]
     ... recipe = zc.recipe.cmmi
-    ... url = file://%s/foo.tgz
+    ... url = %s/foo.tgz
     ... """ % (cache, distros))
 
 We used the url option to specify the location of the archive.
@@ -43,8 +46,8 @@
     ...
     Installing foo.
     foo: Searching cache at /cache/cmmi
-    foo: Did not find foo.tgz under cache key /cache/cmmi/...
-    foo: Cache download /distros/foo.tgz as /cache/cmmi/...
+    foo: Cache miss; will cache http://localhost//foo.tgz as /cache/cmmi/...
+    foo: Downloading http://localhost//foo.tgz
     foo: Unpacking and configuring
     configuring foo /sample-buildout/parts/foo
     echo building foo
@@ -107,8 +110,7 @@
     ...
     Installing foo.
     foo: Searching cache at /cache/cmmi
-    foo: Did not find foo.tgz under cache key /cache/cmmi/...
-    foo: Cache download /distros/foo.tgz as /cache/cmmi/...
+    foo: Cache miss; will cache http://localhost//foo.tgz as /cache/cmmi/...
     foo: Unpacking and configuring
     configuring foo /sample-buildout/parts/foo
     echo building foo
@@ -133,7 +135,7 @@
     ...
     ... [foo]
     ... recipe = zc.recipe.cmmi
-    ... url = file://%s/foo.tgz
+    ... url = %s/foo.tgz
     ... """ % (cache2, distros))
 
     >>> print system('bin/buildout')
@@ -141,8 +143,7 @@
     ...
     Installing foo.
     foo: Searching cache at /cache2/cmmi
-    foo: Did not find foo.tgz under cache key /cache2/cmmi/...
-    foo: Cache download /distros/foo.tgz as /cache2/cmmi/...
+    foo: Cache miss; will cache http://localhost//foo.tgz as /cache2/cmmi/...
     foo: Unpacking and configuring
     configuring foo /sample-buildout/parts/foo
     echo building foo
@@ -181,7 +182,7 @@
     ...
     ... [foo]
     ... recipe = zc.recipe.cmmi
-    ... url = file://%s/foo.tgz
+    ... url = %s/foo.tgz
     ... """ % (cache, distros))
 
     >>> for f in os.listdir('parts'):
@@ -217,9 +218,9 @@
     Uninstalling foo.
     Installing foo.
     foo: Searching cache at /cache/cmmi
-    foo: Did not find foo.tgz under cache key /cache/cmmi/...
+    foo: Cache miss; will cache http://localhost//foo.tgz as /cache/cmmi/...
     While:
       Installing foo.
-    Error: Offline mode: file from /distros/foo.tgz not found in the cache at /cache/cmmi
+    Error: Couldn't download 'http://localhost//foo.tgz' in offline mode.
     <BLANKLINE>
 

Modified: zc.recipe.cmmi/branches/tlotze-download-api/src/zc/recipe/cmmi/patching.txt
===================================================================
--- zc.recipe.cmmi/branches/tlotze-download-api/src/zc/recipe/cmmi/patching.txt	2009-06-18 17:24:36 UTC (rev 101127)
+++ zc.recipe.cmmi/branches/tlotze-download-api/src/zc/recipe/cmmi/patching.txt	2009-06-18 17:25:16 UTC (rev 101128)
@@ -59,12 +59,12 @@
     In...
     Installing foo.
     foo: Searching cache at /cache/cmmi
-    foo: Did not find foo.tgz under cache key /cache/cmmi/...
-    foo: Cache download /distros/foo.tgz as /cache/cmmi/...
+    foo: Cache miss; will cache /distros/foo.tgz as /cache/cmmi/...
+    foo: Using local resource /distros/foo.tgz
     foo: Unpacking and configuring
     foo: Searching cache at /cache/cmmi
-    foo: Did not find config.patch under cache key /cache/cmmi/...
-    foo: Cache download .../config.patch as /cache/cmmi/...
+    foo: Cache miss; will cache http://localhost//config.patch as /cache/cmmi/...
+    foo: Downloading http://localhost//config.patch
     patching file configure
     configuring foo patched /sample-buildout/parts/foo
     echo building foo patched

Modified: zc.recipe.cmmi/branches/tlotze-download-api/src/zc/recipe/cmmi/shared.txt
===================================================================
--- zc.recipe.cmmi/branches/tlotze-download-api/src/zc/recipe/cmmi/shared.txt	2009-06-18 17:24:36 UTC (rev 101127)
+++ zc.recipe.cmmi/branches/tlotze-download-api/src/zc/recipe/cmmi/shared.txt	2009-06-18 17:25:16 UTC (rev 101128)
@@ -109,7 +109,6 @@
     >>> remove('.installed.cfg')
     >>> print system('bin/buildout')
     Installing foo.
-    foo: Downloading /distros/foo.tgz
     foo: Unpacking and configuring
     configuring foo /cache/existing/cmmi
     echo building foo

Modified: zc.recipe.cmmi/branches/tlotze-download-api/src/zc/recipe/cmmi/tests.py
===================================================================
--- zc.recipe.cmmi/branches/tlotze-download-api/src/zc/recipe/cmmi/tests.py	2009-06-18 17:24:36 UTC (rev 101127)
+++ zc.recipe.cmmi/branches/tlotze-download-api/src/zc/recipe/cmmi/tests.py	2009-06-18 17:25:16 UTC (rev 101128)
@@ -84,6 +84,8 @@
                  '--prefix=/sample_buildout'),
                 (re.compile(' = \S+sample-buildout'),
                  ' = /sample_buildout'),
+                (re.compile('http://localhost:[0-9]{4,5}/'),
+                 'http://localhost/'),
                ]),
             optionflags = doctest.ELLIPSIS
             ),
@@ -101,6 +103,8 @@
                zc.buildout.testing.normalize_script,
                zc.buildout.testing.normalize_egg_py,
                normalize_bang,
+               (re.compile('http://localhost:[0-9]{4,5}/'),
+                'http://localhost/'),
                (re.compile('extdemo[.]pyd'), 'extdemo.so')
                ]),
             optionflags = doctest.ELLIPSIS|doctest.NORMALIZE_WHITESPACE



More information about the Checkins mailing list