{ "info": { "author": "Uli Fouquet based on work of Wichert Akkerman", "author_email": "grok-dev@zope.org", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Framework :: Buildout", "License :: OSI Approved :: Zope Public License", "Programming Language :: Python", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "Introduction\n************\n\nThis recipe can be used to generate textfiles from a (text)\ntemplate. Different to `collective.recipe.template`_ you can also\nspecify a path to the output file and the path will be created, if it\ndoes not exist.\n\nA short example::\n\n [buildout]\n parts = zope.conf\n\n [message]\n recipe = collective.recipe.template\n input = templates/message.in\n output = ${buildout:parts-directory}/etc/message\n\n mymessage = Hello, World!\n\n\nIn the template you can use the exact same variables as you can use\nin the buildout configuration. For example an input file can look like this::\n\n My top level directory is ${buildout:directory}\n Executables are stored in ${buildout:bin-directory}\n\n\nAs an extension to the buildout syntax you can reference variables from\nthe current buildout part directly. For example::\n\n My message is: ${mymessage}\n\n\nWhy another template recipe?\n============================\n\nBoth `iw.recipe.template`_ and `inquant.recipe.textfile`_ claim to do the\nsame thing. I have found them to be undocumented and too buggy for real\nworld use, and neither are in a public repository where I could fix them. In\naddition this implementation leverages the buildout variable substitution\ncode, making it a lot simpler.\n\n`collective.recipe.template`_ actually lacks support for creating\npaths of target files to be generated (and tests).\n\n\n.. _iw.recipe.template: http://pypi.python.org/pypi/iw.recipe.template\n.. _inquant.recipe.textfile: http://pypi.python.org/pypi/inquant.recipe.textfile\n.. _collective.recipe.template: http://pypi.python.org/pypi/collective.recipe.template\n\n\nDetailed Description\n********************\n\nSimple creation of a file out of a template\n===========================================\n\nLets create a minimal `buildout.cfg` file::\n\n >>> write('buildout.cfg',\n ... '''\n ... [buildout]\n ... parts = template\n ... offline = true\n ...\n ... [template]\n ... recipe = z3c.recipe.template\n ... input = template.in\n ... output = template\n ... ''')\n\nWe create a template file::\n\n >>> write('template.in',\n ... '''#\n ... My template knows about buildout path:\n ... ${buildout:directory}\n ... ''')\n\nNow we can run buildout::\n\n >>> print system(join('bin', 'buildout')),\n Installing template.\n\nThe template was indeed created::\n\n >>> cat('template')\n #\n My template knows about buildout path:\n .../sample-buildout\n\nThe variable ``buildout:directory`` was also substituted by a path.\n\n\nCreating a template in a variable path\n======================================\n\nLets create a minimal `buildout.cfg` file. This time the output should\nhappen in a variable path::\n\n >>> write('buildout.cfg',\n ... '''\n ... [buildout]\n ... parts = template\n ... offline = true\n ...\n ... [template]\n ... recipe = z3c.recipe.template\n ... input = template.in\n ... output = ${buildout:parts-directory}/template\n ... ''')\n\nNow we can run buildout::\n\n >>> print system(join('bin', 'buildout')),\n Uninstalling template.\n Installing template.\n\nThe template was indeed created::\n\n >>> cat('parts', 'template')\n #\n My template knows about buildout path:\n .../sample-buildout\n\n\nCreating missing paths\n======================\n\nIf an output file should be created in a path that does not yet exist,\nthen the missing items will be created for us::\n\n >>> write('buildout.cfg',\n ... '''\n ... [buildout]\n ... parts = template\n ... offline = true\n ...\n ... [template]\n ... recipe = z3c.recipe.template\n ... input = template.in\n ... output = ${buildout:parts-directory}/etc/template\n ... ''')\n\n >>> print system(join('bin', 'buildout')),\n Uninstalling template.\n Installing template.\n\nAlso creation of several subdirectories is supported::\n\n\n >>> write('buildout.cfg',\n ... '''\n ... [buildout]\n ... parts = template\n ... offline = true\n ...\n ... [template]\n ... recipe = z3c.recipe.template\n ... input = template.in\n ... output = ${buildout:parts-directory}/foo/bar/template\n ... ''')\n\n >>> print system(join('bin', 'buildout')),\n Uninstalling template.\n Installing template.\n\n >>> cat('parts', 'foo', 'bar', 'template')\n #\n My template knows about buildout path:\n .../sample-buildout\n\nWhen changes happen to the output path, then the old path is removed\non uninstall. Therefore the ``etc/`` directory created above has\nvanished now::\n\n >>> ls('parts')\n d foo\n\n\nChanges\n*******\n\n0.1 (2009-03-09)\n================\n\nInitial build based on `collective.recipe.template`_\n\n.. _collective.recipe.template: http://pypi.python.org/pypi/collective.recipe.template", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://pypi.python.org/pypi/z3c.recipe.template", "keywords": "template buildout zope", "license": "ZPL 2.1", "maintainer": null, "maintainer_email": null, "name": "z3c.recipe.template", "package_url": "https://pypi.org/project/z3c.recipe.template/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/z3c.recipe.template/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://pypi.python.org/pypi/z3c.recipe.template" }, "release_url": "https://pypi.org/project/z3c.recipe.template/0.1/", "requires_dist": null, "requires_python": null, "summary": "Buildout recipe to generate a text file from a template", "version": "0.1" }, "last_serial": 802089, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "15f5ba95c6743132ef8464a67c5df26c", "sha256": "9d03353ca896efe8d78b17f992710df188552014986f1358091cdbd8c25a4d25" }, "downloads": -1, "filename": "z3c.recipe.template-0.1.tar.gz", "has_sig": false, "md5_digest": "15f5ba95c6743132ef8464a67c5df26c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5652, "upload_time": "2009-03-09T23:32:30", "url": "https://files.pythonhosted.org/packages/35/30/78e154c2b73bfdd0a3c1daef2bfa7932aad16ecee358139b7b5fc80d417e/z3c.recipe.template-0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "15f5ba95c6743132ef8464a67c5df26c", "sha256": "9d03353ca896efe8d78b17f992710df188552014986f1358091cdbd8c25a4d25" }, "downloads": -1, "filename": "z3c.recipe.template-0.1.tar.gz", "has_sig": false, "md5_digest": "15f5ba95c6743132ef8464a67c5df26c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5652, "upload_time": "2009-03-09T23:32:30", "url": "https://files.pythonhosted.org/packages/35/30/78e154c2b73bfdd0a3c1daef2bfa7932aad16ecee358139b7b5fc80d417e/z3c.recipe.template-0.1.tar.gz" } ] }