Hi,
Sorry if this is not the correct list for this issue.
We have patched the zc.recipe.cmmi so that it (optionally) leaves the sources in place, so that other packages can build against it. It just unpacks the archive into the parts dir instead of to a tempfile (if a dev option is set in the buildout), and then builds it in place. I attach the patch. Otherwise we probably would upload it as yaco.recipe.cmmi-devel, would this be correct?
--
Enrique Pérez Arnaud
Yaco Sistemas S.L.
diff -ru ./zc/recipe/cmmi/__init__.py /home/eperez/virtualenvs/uca-production/develop-eggs/zc.recipe.cmmi-1.1.0-py2.4.egg/zc/recipe/cmmi/__init__.py
--- ./zc/recipe/cmmi/__init__.py	2007-08-09 21:55:08.000000000 +0200
+++ /home/eperez/virtualenvs/uca-production/develop-eggs/zc.recipe.cmmi-1.1.0-py2.4.egg/zc/recipe/cmmi/__init__.py	2008-02-08 12:39:42.000000000 +0100
@@ -42,14 +42,15 @@
         # are correctly set, and that the download_cache directory has
         # been created: this is done by the main zc.buildout anyway
           
-        location = options.get(
+        options['parts-directory'] = options.get(
             'location', buildout['buildout']['parts-directory'])
-        options['location'] = os.path.join(location, name)
+        options['location'] = os.path.join(options['parts-directory'], name)
         options['prefix'] = options['location']
 
     def install(self):
         dest = self.options['location']
         url = self.options['url']
+        dev = self.options.get('dev', False)
         extra_options = self.options.get('extra_options', '')
         # get rid of any newlines that may be in the options so they
         # do not get passed through to the commandline
@@ -61,18 +62,34 @@
             url, self.name, self.download_cache, self.install_from_cache)
  
         # now unpack and work as normal
-        tmp = tempfile.mkdtemp('buildout-'+self.name)
+        if dev:
+            src = src_tmp = \
+                      os.path.join(self.options['parts-directory'], '_TMP_')
+        else:
+            src = tempfile.mkdtemp('buildout-'+self.name)
         logging.getLogger(self.name).info('Unpacking and configuring')
-        setuptools.archive_util.unpack_archive(fname, tmp)
-          
+        setuptools.archive_util.unpack_archive(fname, src)
         here = os.getcwd()
-        os.mkdir(dest)
+        if dev:
+            if 'configure' not in os.listdir(src):
+                entries = os.listdir(src)
+                if len(entries) == 1:
+                    src = os.path.join(src, entries[0])
+                else:
+                    raise ValueError("Couldn't find the sources")
+            os.rename(src, dest)
+            src = dest
+            if os.path.exists(src_tmp):
+                os.rmdir(src_tmp)
+            logging.getLogger(self.name).info('(Sources left in %s)' % dest)
+        else:
+            os.mkdir(dest)
 
         try:
-            os.chdir(tmp)                                        
+            os.chdir(src)
             try:
                 if not os.path.exists('configure'):
-                    entries = os.listdir(tmp)
+                    entries = os.listdir(src)
                     if len(entries) == 1:
                         os.chdir(entries[0])
                     else:
diff -ru ./zc/recipe/cmmi/README.txt /home/eperez/virtualenvs/uca-production/develop-eggs/zc.recipe.cmmi-1.1.0-py2.4.egg/zc/recipe/cmmi/README.txt
--- ./zc/recipe/cmmi/README.txt	2007-08-09 21:55:28.000000000 +0200
+++ /home/eperez/virtualenvs/uca-production/develop-eggs/zc.recipe.cmmi-1.1.0-py2.4.egg/zc/recipe/cmmi/README.txt	2008-02-08 12:46:51.000000000 +0100
@@ -138,3 +138,30 @@
     echo installing foo patched
     installing foo patched
     
+
+Sometimes You want to keep the sources, header files, .pc's, etc, so that other
+packages can compile against them. I that case, you can set a dev option to some
+string that evaluates to True:
+
+    >>> write('buildout.cfg',
+    ... """
+    ... [buildout]
+    ... parts = foo
+    ...
+    ... [foo]
+    ... recipe = zc.recipe.cmmi
+    ... url = file://%s/foo.tgz
+    ... dev = yes
+    ... """ % distros)
+
+    >>> print system('bin/buildout'),
+    Uninstalling foo.
+    Installing foo.
+    foo: Downloading .../distros/foo.tgz
+    foo: Unpacking and configuring
+    (Sources left in .../parts/foo)
+    configuring foo --prefix=/sample-buildout/parts/foo
+    echo building foo
+    building foo
+    echo installing foo
+    installing foo
_______________________________________________
Distutils-SIG maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/distutils-sig

Reply via email to