<?xml version="1.0" encoding="iso-8859-1"?>
<rss version="2.0">
  <channel>
    <title>Must@p Zone</title>
    <link>http://www.mustap.com/</link>
    <description>echo >> /dev/null</description>
    <language>en-us</language>           
    <generator>Nucleus CMS v3.22</generator>
    <copyright>©</copyright>             
    <category>Weblog</category>
    <docs>http://backend.userland.com/rss</docs>
    <image>
      <url>http://www.mustap.com/nucleus/mustapfeed.png</url>
      <title>Must@p Zone</title>
      <link>http://www.mustap.com/</link>
    </image>
    <item>
 <title>Adjusting options in buildout</title>
 <link>http://www.mustap.com/pythonzone_post_244_adjusting-options-in-buildou</link>
<description><![CDATA[The configuration syntax in the <a href="http://pypi.python.org/pypi/zc.buildout">new version of zc.buildout</a> is extended with two operators += and -= to allow adjusting options in an extended profile. This is very helpful. You don't need anymore to overwrite an option in the base configuration when all you want is to remove/add an entry.<br />
<br />
here is an example:<br />
<pre><br />
# base.cfg file<br />
[buildout]<br />
<br />
parts =<br />
    part1<br />
    part2<br />
<br />
eggs =<br />
    eggs1<br />
    eggs2<br />
    eggs3<br />
</pre><br />
To add new part and remove egg2 in an extended configuration, we do:<br />
<pre><br />
# newconfig.cfg file<br />
<br />
[buildout]<br />
extends = base.cfg<br />
<br />
parts <font color="red">+=</font><br />
    part3<br />
<br />
eggs <font color="red">-=</font><br />
    eggs2<br />
</pre><br />
Running buildout, the result will be as if you have run it with this configuration file:<br />
<pre><br />
[buildout]<br />
parts =<br />
    part1<br />
    part2<br />
    part3<br />
<br />
eggs =<br />
    egg1<br />
    eggs3<br />
</pre><br />
<br />
That's it. <br />
If you want to add new egg to all your profiles all you have to do is to add it to the base.cfg.]]></description>
 <category>buildout</category>
<comments>http://www.mustap.com/pythonzone_post_244_adjusting-options-in-buildou</comments>
 <pubDate>Tue, 10 Jun 2008 19:15:47 +0200</pubDate>
</item><item>
 <title>Shebang max. length</title>
 <link>http://www.mustap.com/pythonzone_post_243_shebang-max-length</link>
<description><![CDATA[This may save someone's time.<br />
<br />
If you get an error like this when running ./bin/buildout:<br />
<br />
<font color="red">bash: bin/buildout: /home/mustapha/workspace/collective.buildbot/test/parts/buildslave/customer.pr: bad interpreter: Permission denied</font><br />
<br />
Pay attention: the full path to the used python is truncated here.<br />
<br />
that means that the shebang line (the first line in the bin/buildout script starting with #!) is too long. The maximum length of a shebang line is system dependent. On my Ubuntu the maximum length is 80. This table <a href="http://www.in-ulm.de/~mascheck/various/shebang/#results">lists the maximum length of the shebang line per OS</a><br />
]]></description>
 <category>buildout</category>
<comments>http://www.mustap.com/pythonzone_post_243_shebang-max-length</comments>
 <pubDate>Sun, 25 May 2008 15:11:26 +0200</pubDate>
</item><item>
 <title>collective.recipe.supervisor: now accepts arguments</title>
 <link>http://www.mustap.com/pythonzone_post_242_collectiverecipesupervisor-n</link>
<description><![CDATA[Now one can add arguments to the command controlled by supervisor. You have to give all arguments between [] like this: [arg1 arg2 arg3]. <s>This way one can use ctl scripts generated by other recipes and give them the appropriate argument to make them run in foreground</s>. An example:<br />
<pre><br />
[buildout]<br />
parts = <br />
   instance1 <br />
   supervisor<br />
<br />
[instance1]<br />
<br />
...<br />
<br />
[supervisor]<br />
recipe = collective.recipe.supervisor<br />
port = 9001<br />
user = mustapha<br />
password = secret<br />
serverurl = http://supervisor.mustap.com<br />
<br />
programs =<br />
 <s>10 instance1 ${buildout:bin-directory}/instance1 [fg] ${instance1:location}</s><br />
 10 instance1 ${instance1:location}/bin/runzope ${instance1:location}<br />
 20 myprog /mypath/bin/myprog [-n 100] /mypath<br />
<br />
</pre><br />
<br />
For more info: <a href="http://pypi.python.org/pypi/collective.recipe.supervisor">http://pypi.python.org/pypi/collective.recipe.supervisor</a><br />
<br />
<font color="red">UPDATE:</font> After a discussion with Chris Mc Donough, I updated this post. For zope instances and zeo instances, please use the <I>runzope</I> and <I>runzeo</I> scripts instead of <I>instance</I> and <I>zeo</I> ]]></description>
 <category>buildout</category>
<comments>http://www.mustap.com/pythonzone_post_242_collectiverecipesupervisor-n</comments>
 <pubDate>Fri, 23 May 2008 15:44:45 +0200</pubDate>
</item><item>
 <title>A buildout recipe to install supervisor</title>
 <link>http://www.mustap.com/pythonzone_post_241_a-buildout-recipe-to-install</link>
<description><![CDATA[The collective.recipe.supervisor is buildout recipe that helps with the install and configuration of <a href="http://supervisord.org">supervisor</a>.  <br />
<br />
How to use it: <a href="http://pypi.python.org/pypi/collective.recipe.supervisor">http://pypi.python.org/pypi/collective.recipe.supervisor</a><br />
<br />
]]></description>
 <category>buildout</category>
<comments>http://www.mustap.com/pythonzone_post_241_a-buildout-recipe-to-install</comments>
 <pubDate>Thu, 22 May 2008 08:43:33 +0200</pubDate>
</item><item>
 <title>self.note = svn import with git</title>
 <link>http://www.mustap.com/pythonzone_post_240_selfnote--svn-import-with-gi</link>
<description><![CDATA[Let's create a project called plone.app.myproject:<br />
<pre>$ mkdir plone.app.myproject <br />
$ cd !$<br />
$ git svn init -s http://server.com/!$ <br />
</pre>The last command assumes that plone.app.myproject/trunk, plone.app.myproject/branches and plone.app.myproject/tags already exist in the svn repository.<br />
<pre>$ git svn fetch<br />
$ git add .<br />
$ git commit -m 'initial import'<br />
$ git svn dcommit<br />
</pre>That's it. At this stage the master branch is reflecting the remote trunk.<br />
]]></description>
 <category>General</category>
<comments>http://www.mustap.com/pythonzone_post_240_selfnote--svn-import-with-gi</comments>
 <pubDate>Wed, 7 May 2008 21:00:09 +0200</pubDate>
</item><item>
 <title>Autoload eggs from buildout&apos;s development directories</title>
 <link>http://www.mustap.com/pythonzone_post_239_autoload-eggs-from-buildouts</link>
<description><![CDATA[When developing zope/plone eggs with buildout I have to edit the buildout configuration file ( in 3 places ) every time I create/delete/rename a development egg in the <i>src</i> directory or in other development directories (sometime I have more than one).<br />
<p><br />
I have to add/delete/rename the egg in the <i>eggs</i> option of the <i>[buildout]</i> and then add/delete/rename the egg path in the <i>develop</i> option of the <i>[buildout]</i> and in the end add/delete/rename the <i>zcml</i> option of the zope <i>[instance]</i> or in the <i>configure.zcml</i> file of my policy package. This is too much specially when the speed is set to development mode. I need a less boring way to develop.<br />
</p><br />
<h3>Solution</h3><br />
<i>buildout.eggtractor</i> is a buildout extension that scans the <i>src</i> directory or a list of directories I give for eggs and picks them up automatically. So no more editing of the buildout's configuration file.<br />
<p><br />
When <i>buildout.eggtractor</i> finds an egg in the scanned directory it:<br />
<ul><br />
  <li> adds the egg to the <i>eggs</i> option of all zope instance parts or to a set of given parts </li><br />
  <li>adds the egg's path in the <i>develop</i> option of the <i>[buildout]</i></li><br />
  <li>If <i>tractor-autoload-zcml</i> is not set to false, scans the egg folder for <i>configure.zcml</i>, <i>meta.zcml</i> and <i>overrides.zcml</i> and adds the appropriate zcml entries to the <i>zcml</i> option of the zope instance parts or to a set of given parts.</li><br />
</ul><br />
This steps are done on the fly when running buildout. So I can add/delete/rename an egg and it will be picked up.<br />
<p><br />
NOTE: The extension does not write to the buildout's configuration file.<br />
</p><br />
<h3>buildout.eggtractor options</h3><br />
<b>tractor-src-directory:</b> A set of directories to scan for development eggs. Defaults to the <i>src</i> directory of the buildout.<br><br />
<b>tractor-target-parts:</b> A set of parts to update their <i>eggs</i> option with eggs found in the <i>tractor-src-directory</i>. Defaults to zope instance parts if any.<br><br />
<b>tractor-autoload-zcml(boolean):</b> Update the <i>zcml</i> option of <i>tractor-target-parts</i> with the eggs found in <i>tractor-src-directory</i>. Defaults to true<br><br />
<b>tractor-zcml-top:</b> A set of eggs to load their zcml files first. Defaults to an empty set.<br />
<br />
<h3>How to use it</h3><br />
Using <i>buildout.eggtractor</i> is very simple. As said, it is a buildout extension. All I have to do is to declare it in the <i>extensions</i> option:<br />
<pre><br />
  [buildout]<br />
  parts =<br />
  <br />
  extensions = buildout.eggtractor<br />
</pre><br />
That's all. <i>buildout.eggtractor</i> will scan the <i>src</i> directory and do its job every time I run the buildout command.<br />
<br><br />
When I have other directories I want to scan I just add an <i>tractor-src-directory</i> option in the <i>[buildout]</i> and add my directories there:<br />
<pre><br />
  [buildout]<br />
  parts =<br />
  <br />
  extensions = buildout.eggtractor<br />
  <br />
  tractor-src-directory = <br />
                        dev-src1 <br />
                        dev-src2<br />
                        src<br />
</pre><br />
In a few cases when the priority of loading zcml files matters. I add the egg to be loaded first in the <i>tractor-zcml-top</i> option in the <i>[buildout]</i>:<br />
<pre><br />
  [buildout]<br />
  parts =<br />
  <br />
  extensions = buildout.eggtractor<br />
  <br />
  tractor-src-directory = <br />
            dev-src1 <br />
            dev-src2<br />
            src<br />
            <br />
  tractor-zcml-top = <br />
            plone.app.mypackage1<br />
<br />
</pre><br />
If I want to add the eggs found in the development directories to the eggs option of a given set of parts, I add a <i>tractor-target-parts</i> option and add the parts there:<br />
<pre><br />
  [buildout]<br />
  parts = instance1 instance2 instance3<br />
  <br />
  extensions = buildout.eggtractor<br />
  <br />
  tractor-target-parts = instance1 instance3<br />
</pre><br />
This way only instance1 and instance3 will be updated.<br />
<p><br />
If I have already other way to include the zcml files (ie: z3c.autoinclude) and don't want <i>eggtractor</i> to generate the zcml slugs, I add an <i>tractor-autoload-zcml</i> option and set it to <i>false</i><br />
</p><br />
In most cases you will only need to add <i>buildout.eggtractor</i> to the <i>extensions</i> option of the <i>[buildout]</i> without any extra configuration options.<br />
<br />
<h3>LIMITATION</h3><br />
The extension assumes that the egg name reflects its file system structure example: if the egg name is com.mustap.www the extension assumes that the file system structure is one of the following::<br />
<ul><br />
  <li>com.mustap.www/src/com/mustap/www</li><br />
  <li>com.mustap.www/com/mustap/www</li><br />
</ul><br />
This is where the extension looks for configure.zcml, meta.zcml and overrides.zcml files.<br />
<p><br />
If the egg name does not reflect the file system structure, the extension will ignore it.<br><br />
XXX: I guess walking through the directory is better than this assumption. <br>In my case this is not a limitation as I choose my egg names that way.<br />
</p><h3>URL</h3>You can get it from <a href="http://pypi.python.org/pypi/buildout.eggtractor">http://pypi.python.org/pypi/buildout.eggtractor</a><br />
<br />
<h3>THANKS</h3> Martin, Wichert and Hanno for the help and feedbacks]]></description>
 <category>buildout</category>
<comments>http://www.mustap.com/pythonzone_post_239_autoload-eggs-from-buildouts</comments>
 <pubDate>Wed, 30 Apr 2008 19:32:47 +0200</pubDate>
</item><item>
 <title>Running more than one year without stop</title>
 <link>http://www.mustap.com/pythonzone_post_238_running-more-than-one-year-w</link>
<description><![CDATA[My colleague Jakob aka bartholdy discovered this one today. The instance is running more than one year without stop.<br />
Software used:<br />
<pre><br />
Plone 2.5.1,<br />
CMF-1.6.2,<br />
Zope (Zope 2.9.4-final, python 2.4.3, freebsd5),<br />
Five 1.3.7,<br />
Python 2.4.3 (#1, Oct 3 2006, 11:03:02) [GCC 3.4.2 [FreeBSD] 20040728],<br />
PIL 1.1.5<br />
</pre><br />
<img src="zmi.gif" /><br />
That's great.]]></description>
 <category>Plone</category>
<comments>http://www.mustap.com/pythonzone_post_238_running-more-than-one-year-w</comments>
 <pubDate>Fri, 22 Feb 2008 10:07:27 +0100</pubDate>
</item><item>
 <title>PYPI in PSC</title>
 <link>http://www.mustap.com/pythonzone_post_237_pypi-in-psc</link>
<description><![CDATA[I tried <a href="http://dev.plone.org/collective/browser/PloneSoftwareCenter/branches/pypi">Tarek's PloneSoftwareCenter branch</a> today. The good news is: IT IS WORKING. Bravo Tarek. If you don't already know it, the branch is about <a href="http://tarekziade.wordpress.com/2007/12/21/ideas-on-distributing-and-promoting-plone-packages/">adding PYPI features to PSC</a>.<br />
<br />
Used software for test:<br />
<br />
<ul><li> Plone 3.0.4</li><br />
<li> DataGridField 1.6.0-beta2</li><br />
<li> PloneHelpCenter 1.5.0-beta-5 </li><br />
<li> PloneSoftwareCenter (Tarek's branch named pypi)</li></ul><br />
You need a .pypirc file in your home directory with the username/password for an existing plone user:<br />
<pre><br />
[server-login]<br />
username: mustap<br />
password: secret <br />
</pre><br />
<br />
Now one can easily upload a package to PSC:<br />
<pre><br />
$ <font color="green">python2.4 setup.py bdist_egg upload \<br />
  --repository=http://localhost:8080/site1/software-center</font><br />
running bdist_egg<br />
running egg_info<br />
writing requirements to test.egg-info/requires.txt<br />
writing test.egg-info/PKG-INFO<br />
writing namespace_packages to test.egg-info/namespace_packages.txt<br />
writing top-level names to test.egg-info/top_level.txt<br />
writing dependency_links to test.egg-info/dependency_links.txt<br />
writing entry points to test.egg-info/entry_points.txt<br />
reading manifest file 'test.egg-info/SOURCES.txt'<br />
writing manifest file 'test.egg-info/SOURCES.txt'<br />
installing library code to build/bdist.linux-i686/egg<br />
running install_lib<br />
running build_py<br />
creating build/bdist.linux-i686/egg<br />
creating build/bdist.linux-i686/egg/plone<br />
<br />
... [many output] ...<br />
<br />
copying test.egg-info/top_level.txt -> build/bdist.linux-i686/egg/EGG-INFO<br />
creating 'dist/test-0.1dev-py2.4.egg' and adding 'build/bdist.linux-i686/egg' to it<br />
removing 'build/bdist.linux-i686/egg' (and everything under it)<br />
<font color="red">running upload<br />
Submitting dist/test-0.1dev-py2.4.egg to http://localhost:8080/site1/software-center<br />
Server response (200): OK</font><br />
</pre><br />
Great !<br />
<br />
and here is how it looks like in plone:<br />
<img src="http://www.mustap.com/test-package.png" /><br />
<br />
One can use easy_install to install the uploded package:<br />
<pre><br />
$ <font color="green">easy_install \<br />
    -f http://localhost:8080/site1/software-center/simple test</font><br />
Searching for test<br />
Reading http://localhost:8080/site1/software-center/simple<br />
Best match: test 0.1dev<br />
Downloading http://localhost:8080/site1/software-center/test/releases/0.1dev/test-0.1dev-py2.4.egg<br />
Processing test-0.1dev-py2.4.egg<br />
creating /home/mustapha/Projects/pylonsenv/lib/python2.4/site-packages/test-0.1dev-py2.4.egg<br />
Extracting test-0.1dev-py2.4.egg to /home/mustapha/Projects/pylonsenv/lib/python2.4/site-packages<br />
Adding test 0.1dev to easy-install.pth file<br />
<br />
Installed /home/mustapha/Projects/pylonsenv/lib/python2.4/site-packages/test-0.1dev-py2.4.egg<br />
Processing dependencies for test<br />
Finished processing dependencies for test<br />
</pre><br />
<br />
This is really a good step forward to make PSC pypi-compatible.<br />
<br />
Try it.]]></description>
 <category>Plone</category>
<comments>http://www.mustap.com/pythonzone_post_237_pypi-in-psc</comments>
 <pubDate>Thu, 27 Dec 2007 22:08:28 +0100</pubDate>
</item><item>
 <title>Note.self = Specifying recipe version in buildout</title>
 <link>http://www.mustap.com/pythonzone_post_236_noteself--specifying-recipe-</link>
<description><![CDATA[We can add a 'versions' section in buildout.cfg to indicate the version of used recipes.<br />
<br />
ie: buildout.cfg for myProject-1.0<br />
<pre><br />
[buildout]<br />
<br />
parts =<br />
    zope2<br />
    instance<br />
<font color="red"><br />
versions = myProject-1.0<br />
<br />
[myProject-1.0]<br />
plone.recipe.zope2install = 0.2<br />
plone.recipe.zope2instance = 0.8<br />
</font><br />
[zope2]<br />
recipe = plone.recipe.zope2install<br />
url = http://www.zope.org/Products/Zope/2.9.7/Zope-2.9.7-final.tgz<br />
<br />
[instance]<br />
recipe = plone.recipe.zope2instance<br />
zope2-location = ${zope2:location}<br />
user = admin:admin<br />
debug-mode = off<br />
zodb-cache-size = 70000<br />
</pre><br />
This way, buildout will use <em>plone.recipe.zope2install</em> version 0.2 and <em>plone.recipe.zope2instance</em> version 0.8. For other stuff like setuptools it will "pick" the best distribution. We can tell buildout to generate an error when it "Picks" a version:<br />
<pre><br />
[buildout]<br />
<br />
parts =<br />
    zope2<br />
    instance<br />
<br />
versions = myProject-1.0<br />
<font color="red">allow-picked-versions = false</font><br />
<br />
[myProject-1.0]<br />
plone.recipe.zope2install = 0.2<br />
plone.recipe.zope2instance = 0.8<br />
<br />
[zope2]<br />
recipe = plone.recipe.zope2install<br />
url = http://www.zope.org/Products/Zope/2.9.7/Zope-2.9.7-final.tgz<br />
<br />
[instance]<br />
recipe = plone.recipe.zope2instance<br />
zope2-location = ${zope2:location}<br />
user = admin:admin<br />
debug-mode = off<br />
zodb-cache-size = 70000<br />
</pre>]]></description>
 <category>buildout</category>
<comments>http://www.mustap.com/pythonzone_post_236_noteself--specifying-recipe-</comments>
 <pubDate>Sun, 25 Nov 2007 15:55:35 +0100</pubDate>
</item><item>
 <title>ZopeSkel local commands - Insert mode</title>
 <link>http://www.mustap.com/pythonzone_post_235_zopeskel-local-commands--ins</link>
<description><![CDATA[I had a good discussion (by email) with <a href="http://efod.se/">Erik Forsberg</a> about <a href="http://www.mustap.com/pythonzone_post_234_zopeskel-with-local-commands">zopeskel.localcommands</a> and how the "insert" stuff works. The discussion started by reporting a setuptools problem with <a href="http://www.mustap.com/pythonzone_post_234_zopeskel-with-local-commands">zopeskel.localcommands</a>. Setuptools fails with 'SyntaxError' if a template contains a .py file with cheetah variables.<br />
<br />
He came with a suggestion to add '_insert' in the end of file names that should be treated in insert-mode so setuptools will not try to compile them (in case of .py files). I think it is a good suggestion. <br />
<br />
So here is how it works now:<br />
<br />
The '_insert' in the end of file names is required for .py files and optional for other kind of files. For <a href="http://www.mustap.com/pythonzone_post_234_zopeskel-with-local-commands">zopeskel.localcommands</a> there is no difference between "configure.zcml_insert" and "configure.zcml". Both will be treated in insert-mode. In the case of .py files if you don't add '_insert' in the end of their names, setuptools will fail with 'SyntaxError' when installing ZopeSkel. That's normal because of the template-variables.<br />
<br />
For readability I recommend using the '_insert' syntax for files that their content should be inserted in existing project files.<br />
<br />
As example here is the structure of the "portlet" template as is now:<br />
<pre> portlets/<br />
          +portlet_filename+.pt_tmpl<br />
          +portlet_filename+.py_tmpl<br />
<br />
          configure.zcml_insert<br />
 profiles/<br />
         default/<br />
                 portlets.xml_insert<br />
 tests/<br />
       base_+portlet_filename+.py_tmpl<br />
<br />
       test_+portlet_filename+portlet.py_tmpl</pre><br />
<br />
(<A href="http://dev.plone.org/collective/browser/ZopeSkel/branches/mustap/zopeskel/localcommands/README.txt">README.txt</A> updated)<br />
]]></description>
 <category>Plone</category>
<comments>http://www.mustap.com/pythonzone_post_235_zopeskel-local-commands--ins</comments>
 <pubDate>Sun, 11 Nov 2007 23:09:05 +0100</pubDate>
</item>
  </channel>
</rss>