{ "info": { "author": "Mustapha Benali", "author_email": "mustapha@headnet.dk", "bugtrack_url": null, "classifiers": [ "Framework :: Buildout", "Intended Audience :: Developers", "Topic :: Software Development :: Build Tools", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "buildout.eggtractor\r\n===================\r\n\r\nQ: What is a buildout extension ?\r\n\r\nA: http://pypi.python.org/pypi/zc.buildout#extensions\r\n\r\nThe problem\r\n-----------\r\n\r\nWhen developing zope/plone eggs with buildout I have to edit the buildout\r\nconfiguration file ( in 3 places ) each time I create/delete/rename a\r\ndevelopment egg in the ``src`` directory or in other development directories\r\n(sometime I have more than one).\r\n\r\nI have to add/delete/rename the egg in the ``eggs`` option of the \r\n``[buildout]`` and then add/delete/rename the egg path in the ``develop`` option\r\nof the ``[buildout]`` and in the end add/delete/rename the ``zcml`` option of\r\nthe zope ``[instance]`` or in the ``configure.zcml`` file of my policy package.\r\nThis is too much specially when the speed is set to development mode. I need a\r\nless boring way to develop.\r\n\r\nSolution\r\n--------\r\n\r\n``buildout.eggtractor`` is a buildout extension that scans the ``src`` \r\ndirectory or a list of directories I give for eggs and picks them up\r\nautomatically. So no more editing of the buildout's configuration file.\r\n\r\nWhen ``buildout.eggtractor`` finds an egg in the scanned directory it::\r\n\r\n 1. adds the egg to the ``eggs`` option of all zope instance parts or\r\n to a set of given parts\r\n\r\n 2. adds the egg's path in the ``develop`` option of the ``[buildout]``\r\n \r\n 3. If ``tractor-autoload-zcml`` is not given or set to other thing than\r\n false, scans the egg folder for ``configure.zcml``, ``meta.zcml`` and\r\n ``overrides.zcml`` and adds the appropriate zcml entries to the ``zcml``\r\n option of the zope instance parts or to a set of given parts.\r\n\r\nThis steps are done on the fly when running buildout. So I can add/delete/rename\r\nan egg and it will be picked up.\r\n\r\nNOTE: The extension does not write to the buildout's configuration file.\r\n\r\nbuildout.eggtractor options\r\n---------------------------\r\n\r\ntractor-src-directory:\r\n A set of directories to scan for development eggs. Defaults to the ``src``\r\n directory of the buildout.\r\n\r\ntractor-target-parts:\r\n A set of parts to update their ``eggs`` option with eggs found in the \r\n ``tractor-src-directory``. Defaults to zope instance parts if any.\r\n\r\ntractor-autoload-zcml(boolean):\r\n Update the ``zcml`` option of ``tractor-target-parts`` with the eggs found\r\n in ``tractor-src-directory``. Defaults to true\r\n\r\ntractor-zcml-top:\r\n A set of eggs to load their zcml files first. Defaults to an empty set.\r\n\r\n\r\nHow to use it\r\n-------------\r\n\r\nUsing ``buildout.eggtractor`` is very simple. As said, it is a buildout\r\nextension. All I have to do is to declare it in the ``extensions`` option::\r\n\r\n [buildout]\r\n parts =\r\n \r\n extensions = buildout.eggtractor\r\n\r\nThat's all. ``buildout.eggtractor`` will scan the ``src`` directory and do its\r\njob every time I run the buildout command.\r\n\r\nWhen I have other directories I want to scan I just add an\r\n``tractor-src-directory`` option in the ``[buildout]`` and add my directories\r\nthere::\r\n\r\n [buildout]\r\n parts =\r\n \r\n extensions = buildout.eggtractor\r\n \r\n tractor-src-directory = \r\n dev-src1 \r\n dev-src2\r\n src\r\n\r\nIn a few cases when the priority of loading zcml files matters. I add the egg to\r\nbe loaded first in the ``tractor-zcml-top`` option in the ``[buildout]``::\r\n\r\n [buildout]\r\n parts =\r\n \r\n extensions = buildout.eggtractor\r\n \r\n tractor-src-directory = \r\n dev-src1 \r\n dev-src2\r\n src\r\n \r\n tractor-zcml-top = \r\n plone.app.mypackage1\r\n\r\n\r\nIf I want to add the eggs found in the development directories to the eggs\r\noption of a given set of parts, I add a ``tractor-target-parts`` option \r\nand add the parts there::\r\n\r\n [buildout]\r\n parts = instance1 instance2 instance3\r\n \r\n extensions = buildout.eggtractor\r\n \r\n tractor-target-parts = instance1 instance3\r\n\r\nThis way only instance1 and instance3 will be updated.\r\n\r\nIf I have already other way to include the zcml files (ie: z3c.autoinclude)\r\nand don't want ``eggtractor`` to generate the zcml slugs, I add an\r\n``tractor-autoload-zcml`` option and set it to ``false``\r\n\r\n\r\nIn most cases you will only need to add ``buildout.eggtractor`` to the\r\n``extensions`` option of the ``[buildout]`` without any extra configuration\r\noptions.\r\n\r\n\r\nLIMITATION\r\n----------\r\n\r\nThe extension assumes that the egg name reflects its file system structure\r\n\r\nexample: if the egg name is com.mustap.www the extension assumes that the file\r\nsystem structure is one of the following::\r\n\r\n 1. com.mustap.www/src/com/mustap/www\r\n \r\n 2. com.mustap.www/com/mustap/www\r\n\r\nThis is where the extension looks for configure.zcml, meta.zcml and\r\noverrides.zcml files.\r\n\r\nIf the egg name has nothing to do with how it is structured on the system,\r\nthe extension will ignore it.\r\n\r\nXXX: I guess walking through the directory is better than this assumption.\r\n\r\nIn my case this is not a limitation as I choose my egg names that way.\r\n\r\n\r\n\r\nMustapha\r\n\r\nemail: mustap_at_gmail_com\r\n\r\nweb: http://www.mustap.com\r\n\r\nChange history\r\n==============\r\n\r\n0.6 (2008-10-29)\r\n----------------\r\n\r\n- fixed install problem on windows: \r\n http://plone.org/support/forums#nabble-f293351\r\n\r\n- split buildout configuration values before we test if an egg was\r\n added already. using 'in' with a string doen't work if an egg's\r\n name is a substring of an already added egg (e.g. plone.app.content \r\n after plone.app.contentmenu).\r\n [csenger]\r\n\r\n- sort output of os.listdir (it's order is undefined) to make\r\n debugging easier.\r\n [csenger]\r\n\r\n\r\n0.5 (2008-04-30)\r\n----------------\r\n\r\n- Refactoring\r\n Added tractor-target-parts option\r\n Added tractor-autoload-zcml option\r\n Updated documentation\r\n Updated tests: need more tests\r\n [mustapha] \r\n\r\n\r\n0.4 (2008-04-27)\r\n----------------\r\n\r\n- Made sure the configure.zcml is added to package includes if a meta.zcml or\r\n overrides.zcml in the same packages have already been found.\r\n [hannosch]\r\n\r\n\r\n0.3 (2008-04-27)\r\n----------------\r\n\r\n- Use a new line as a separator for added entries. A space makes buildout\r\n think it has to deal with a version specifier.\r\n [hannosch]\r\n\r\n\r\n0.2 (2008-04-27)\r\n----------------\r\n\r\n- Added support for automatically finding multiple instances.\r\n [hannosch]\r\n\r\n- Better use the recipe name for finding the instance, as this is less likely\r\n to conflict.\r\n [hannosch]\r\n\r\n\r\n0.1 (2008-04-27)\r\n----------------\r\n\r\n- Whitespace fixes.\r\n [hannosch]\r\n\r\n- Created recipe with ZopeSkel.\r\n [mustapha]\r\n\r\nDetailed Documentation\r\n======================\r\n\r\nTests for buildout.eggtractor buildout extension\r\n------------------------------------------------\r\n\r\nLet's create a buildout configuration file::\r\n\r\n >>> data = \"\"\"\r\n ... [buildout]\r\n ... parts = zope2 instance1 instance2\r\n ... extensions = buildout.eggtractor\r\n ... eggs =\r\n ... develop = \r\n ... [instance1]\r\n ... recipe = plone.recipe.zope2instance\r\n ... zope2-location = ${zope2:location}\r\n ... user = admin:admin\r\n ... [instance2]\r\n ... recipe = plone.recipe.zope2instance\r\n ... zope2-location = ${zope2:location}\r\n ... user = admin:admin\r\n ... [zope2]\r\n ... recipe = plone.recipe.zope2install\r\n ... url = http://www.zope.org/Products/Zope/2.9.8/Zope-2.9.8-final.tgz\r\n ... \"\"\"\r\n >>> rmdir(tempdir, 'buildout.test')\r\n >>> cd(tempdir)\r\n >>> sh('mkdir buildout.test')\r\n mkdir buildout.test\r\n \r\n >>> cd('buildout.test')\r\n >>> touch('buildout.cfg', data=data)\r\n >>> ls('.')\r\n buildout.cfg\r\n\r\nrun the buildout first time so wget our zope instances::\r\n\r\n >>> sh('buildout bootstrap')\r\n buildout bootstrap\r\n Creating directory '/tmp/buildout.test/bin'.\r\n Creating directory '/tmp/buildout.test/parts'.\r\n Creating directory '/tmp/buildout.test/develop-eggs'.\r\n Generated script '/tmp/buildout.test/bin/buildout'.\r\n \r\n >>> sh('bin/buildout')\r\n bin/buildout\r\n ...\r\n Installing instance1.\r\n Generated script '/tmp/buildout.test/bin/instance1'.\r\n Generated script '/tmp/buildout.test/bin/repozo'.\r\n Installing instance2.\r\n Generated script '/tmp/buildout.test/bin/instance2'.\r\n \r\n \r\n \r\nNow let's create an egg in the src directory::\r\n\r\n >>> sh(\"paster create --no-interactive -o src -t plone_app com.mustap.www namespace_package=com namespace_package2=mustap package=www\")\r\n paster create --no-interactive -o src -t plone_app com.mustap.www namespace_package=com namespace_package2=mustap package=www\r\n ...\r\n ...setup.py egg_info\r\n \r\n\r\nOk, so now that we have an egg, lets run the buildout in offline mode. We \r\nshould get a link file in develop-egg, a zcml slugs in \r\nparts/instance1/etc/package-includes and parts/instance2/etc/package-includes\r\nand a line with the path to our egg in the bin/instance1 and bin/instance2 \r\nfiles. \r\n\r\nFirst we check that there is nothing of the previous mentioned things::\r\n\r\n >>> ls('develop-eggs')\r\n >>> ls('parts/instance1/etc/package-includes') \r\n No directory named parts/instance1/etc/package-includes\r\n\r\n >>> ls('parts/instance2/etc/package-includes') \r\n No directory named parts/instance2/etc/package-includes\r\n\r\n >>> sh('grep com.mustap.www bin/instance1')\r\n grep com.mustap.www bin/instance1\r\n \r\n \r\n >>> sh('grep com.mustap.www bin/instance2')\r\n grep com.mustap.www bin/instance2\r\n \r\n\r\nOK, now run the buildout in offline mode::\r\n \r\n >>> sh('./bin/buildout -o')\r\n ./bin/buildout -o\r\n ...\r\n\r\nCheck that we have a correct created buildout. First check that we have\r\na link in the develop-eggs directory::\r\n\r\n >>> ls('develop-eggs')\r\n com.mustap.www.egg-link\r\n\r\nCheck that we have our zcml slugs in the package-includes::\r\n\r\n >>> ls('parts', 'instance1', 'etc', 'package-includes')\r\n 001-com.mustap.www-configure.zcml\r\n \r\n >>> ls('parts', 'instance2', 'etc', 'package-includes')\r\n 001-com.mustap.www-configure.zcml\r\n\r\nand in the end check that there is a line in bin/instance1 and bin/instance1\r\nthat includes our egg in the path::\r\n\r\n >>> cat('bin', 'instance1')\r\n #!/usr/bin/python2.4\r\n ...\r\n sys.path[0:0] = [\r\n '/tmp/buildout.test/src/com.mustap.www',\r\n ...\r\n ]\r\n ...\r\n\r\n >>> cat('bin', 'instance2')\r\n #!/usr/bin/python2.4\r\n ...\r\n sys.path[0:0] = [\r\n '/tmp/buildout.test/src/com.mustap.www',\r\n ...\r\n ]\r\n ...\r\n\r\nLet's now try the ``tractor-target-parts`` option. We create a new buildout.cfg file\r\nwith an empty ``tractor-target-parts``::\r\n\r\n >>> data = data.replace('eggs =', 'tractor-target-parts = \\neggs = ')\r\n >>> touch('buildout.cfg', data=data)\r\n >>> sh('./bin/buildout -o')\r\n ./bin/buildout -o\r\n ...\r\n\r\nWe get the egg link in the develop-egg directory::\r\n\r\n >>> ls('develop-eggs')\r\n com.mustap.www.egg-link\r\n\r\nBut no zcml slug in the instance 1 and 2:: \r\n\r\n >>> ls('parts', 'instance1', 'etc', 'package-includes')\r\n No directory named parts/instance1/etc/package-includes\r\n\r\n >>> ls('parts', 'instance2', 'etc', 'package-includes')\r\n No directory named parts/instance2/etc/package-includes\r\n\r\nNor a line in bin/instance1 and bin/instance2 with our egg path::\r\n\r\n >>> code = cat('bin', 'instance1', returndata=True)\r\n >>> code.find('com.mustap.www') == -1\r\n True\r\n\r\n >>> code = cat('bin', 'instance2', returndata=True)\r\n >>> code.find('com.mustap.www') == -1\r\n True\r\n\r\nBut if the ``tractor-target-parts`` option is not empty::\r\n\r\n >>> data = data.replace('tractor-target-parts =', 'tractor-target-parts = instance1')\r\n >>> touch('buildout.cfg', data=data)\r\n >>> sh('./bin/buildout -o')\r\n ./bin/buildout -o\r\n ...\r\n\r\nand we get a zcml slug only in the specified target::\r\n\r\n >>> ls('parts', 'instance1', 'etc', 'package-includes')\r\n 001-com.mustap.www-configure.zcml\r\n\r\n >>> ls('parts', 'instance2', 'etc', 'package-includes')\r\n No directory named parts/instance2/etc/package-includes\r\n\r\nand only the specified target's control script is updated::\r\n\r\n >>> code = cat('bin', 'instance1', returndata=True)\r\n >>> code.find('com.mustap.www') == -1\r\n False\r\n\r\n >>> code = cat('bin', 'instance2', returndata=True)\r\n >>> code.find('com.mustap.www') == -1\r\n True\r\n\r\n\r\nContributors\r\n============\r\n\r\n- mustapha, Author\r\n- hannosch, Minor fixes", "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/buildout.eggtractor", "keywords": "buildout extension egg tractor", "license": "GPL", "maintainer": "", "maintainer_email": "", "name": "buildout.eggtractor", "package_url": "https://pypi.org/project/buildout.eggtractor/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/buildout.eggtractor/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://pypi.python.org/pypi/buildout.eggtractor" }, "release_url": "https://pypi.org/project/buildout.eggtractor/0.6/", "requires_dist": null, "requires_python": null, "summary": "Auto generates zcml slugs, buildout:egg and buildout:develop entries.", "version": "0.6" }, "last_serial": 680382, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "c9261f7d05e95389bfe7bbea606f85ef", "sha256": "32e42aab17bc7d97196553e85dedf703dbcf55fab82eb12f7612f9bdf427b8e5" }, "downloads": -1, "filename": "buildout.eggtractor-0.1-py2.4.egg", "has_sig": true, "md5_digest": "c9261f7d05e95389bfe7bbea606f85ef", "packagetype": "bdist_egg", "python_version": "2.4", "requires_python": null, "size": 11751, "upload_time": "2008-04-27T14:29:13", "url": "https://files.pythonhosted.org/packages/9a/b1/77bcbaf40b26efbf6712a71fae6eac871b6c1e0ffc65c4550fa3be0504b3/buildout.eggtractor-0.1-py2.4.egg" }, { "comment_text": "", "digests": { "md5": "dd065c29def511eae4290eab50c8fcfc", "sha256": "2f2d051c62eaa3312618b107b55a92d7a29910c837dc36f73f05947a42bb3b05" }, "downloads": -1, "filename": "buildout.eggtractor-0.1.tar.gz", "has_sig": true, "md5_digest": "dd065c29def511eae4290eab50c8fcfc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6708, "upload_time": "2008-04-27T14:29:05", "url": "https://files.pythonhosted.org/packages/30/fc/6767055f8c11582e6da6c2c4381fcf815268862ac754d4a7f69c5745d9dd/buildout.eggtractor-0.1.tar.gz" } ], "0.1dev-r63768": [], "0.2": [ { "comment_text": "", "digests": { "md5": "4dacee3253fbe709dd663e63a72e87e4", "sha256": "b97ec886a2f28ba591bbbd7dbb167de58d796af31778b30d88ec690351959192" }, "downloads": -1, "filename": "buildout.eggtractor-0.2.tar.gz", "has_sig": true, "md5_digest": "4dacee3253fbe709dd663e63a72e87e4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6805, "upload_time": "2008-04-27T16:29:57", "url": "https://files.pythonhosted.org/packages/41/c5/7de21485d7bd4349ac87b3d310f5fd8eddc390845a4eeb8dfeaf389862f1/buildout.eggtractor-0.2.tar.gz" } ], "0.3": [ { "comment_text": "", "digests": { "md5": "3db49bb4c2ddad71d043b31ff9e1a57e", "sha256": "af1d03ae70bbf9a62f5325908908df159332c8b53da4021fdf46a5eaf37ef391" }, "downloads": -1, "filename": "buildout.eggtractor-0.3.tar.gz", "has_sig": true, "md5_digest": "3db49bb4c2ddad71d043b31ff9e1a57e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6900, "upload_time": "2008-04-27T17:33:16", "url": "https://files.pythonhosted.org/packages/a2/0c/e8093d68f1a7b9b7530d3ea5446a2120e3e3e51005357527f13516fe4be1/buildout.eggtractor-0.3.tar.gz" } ], "0.4": [ { "comment_text": "", "digests": { "md5": "e0e8e5d1018bf323e999a34b7042b70a", "sha256": "2734337185c81a84d808d27930a2af53ef557ac165738183b0738b1e3d1fbf37" }, "downloads": -1, "filename": "buildout.eggtractor-0.4.tar.gz", "has_sig": true, "md5_digest": "e0e8e5d1018bf323e999a34b7042b70a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7046, "upload_time": "2008-04-27T18:33:13", "url": "https://files.pythonhosted.org/packages/3f/bd/2ad408ce4b2ae79d6298038592f625c7d662ee11b86e9e3d3f5a140bd36e/buildout.eggtractor-0.4.tar.gz" } ], "0.5": [ { "comment_text": "", "digests": { "md5": "b3dce87fe8d344864ad335e0b01b78f8", "sha256": "37000ca4a0d08da5fd8039fd087dc05b7229b4f80580f88d0e447f4cf6a6a953" }, "downloads": -1, "filename": "buildout.eggtractor-0.5-py2.4.egg", "has_sig": true, "md5_digest": "b3dce87fe8d344864ad335e0b01b78f8", "packagetype": "bdist_egg", "python_version": "2.4", "requires_python": null, "size": 13588, "upload_time": "2008-05-14T17:37:08", "url": "https://files.pythonhosted.org/packages/e6/59/534bc6731d8a5087afc402765dd95561c24555855cd41f8313cc99d36736/buildout.eggtractor-0.5-py2.4.egg" }, { "comment_text": "", "digests": { "md5": "8e3ce01728295df983336afd9ff5d21d", "sha256": "d74d6ee1774b9cc864d5a86295a7fc4d7ffcfe3053b1182820160824f2592f0a" }, "downloads": -1, "filename": "buildout.eggtractor-0.5-py2.6.egg", "has_sig": false, "md5_digest": "8e3ce01728295df983336afd9ff5d21d", "packagetype": "bdist_egg", "python_version": "2.6", "requires_python": null, "size": 13498, "upload_time": "2008-10-26T19:33:23", "url": "https://files.pythonhosted.org/packages/b0/b9/9abe49a1adb3bb3e176ecfcea537f463d89717d11b7daaba78d89d7b9ae0/buildout.eggtractor-0.5-py2.6.egg" }, { "comment_text": "", "digests": { "md5": "e5ed4d3701bf2810b154bb845fc4ba69", "sha256": "ba910458d75c692b51a7ea753e4ab41a7916a6ee3423e62af87a3b0a3337df2e" }, "downloads": -1, "filename": "buildout.eggtractor-0.5.tar.gz", "has_sig": true, "md5_digest": "e5ed4d3701bf2810b154bb845fc4ba69", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11025, "upload_time": "2008-04-30T17:29:37", "url": "https://files.pythonhosted.org/packages/18/3b/b0d150257a1912ff45bde2877df548063b27e40420d0d2ab23dba395fdcd/buildout.eggtractor-0.5.tar.gz" } ], "0.6": [ { "comment_text": "", "digests": { "md5": "f137b4bc0218e90ab12f15f58accdf8e", "sha256": "a7f630f42f196b6f8aacba3b337e7f1f549ee27080c5928eb44b85d31637e52c" }, "downloads": -1, "filename": "buildout.eggtractor-0.6.tar.gz", "has_sig": false, "md5_digest": "f137b4bc0218e90ab12f15f58accdf8e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8417, "upload_time": "2008-10-29T17:35:05", "url": "https://files.pythonhosted.org/packages/70/6c/e435172da4100d3f5bdbeb1bf73ef5e4db52ac6ac28f00c3852dbd164197/buildout.eggtractor-0.6.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "f137b4bc0218e90ab12f15f58accdf8e", "sha256": "a7f630f42f196b6f8aacba3b337e7f1f549ee27080c5928eb44b85d31637e52c" }, "downloads": -1, "filename": "buildout.eggtractor-0.6.tar.gz", "has_sig": false, "md5_digest": "f137b4bc0218e90ab12f15f58accdf8e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8417, "upload_time": "2008-10-29T17:35:05", "url": "https://files.pythonhosted.org/packages/70/6c/e435172da4100d3f5bdbeb1bf73ef5e4db52ac6ac28f00c3852dbd164197/buildout.eggtractor-0.6.tar.gz" } ] }