{ "info": { "author": "Jim Fulton (forked by Chris McDonough)", "author_email": "chrism@plope.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Framework :: Buildout", "Intended Audience :: Developers", "License :: OSI Approved :: Zope Public License", "Topic :: Software Development :: Build Tools", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "********************************\nBuildout Egg-Installation Recipe\n********************************\n\n.. contents::\n\nThe egg-installation recipe is a customization of zc.recipe.egg that\nallows for by-default installs of dependent scripts. This uses\ncode by James Gardner from http://pypi.python.org/pypi/pylons_sandbox\nto perform the dependent-script installation.\n\n\n\n\nTo do\n*****\n\n- Some way to freeze the egg-versions used. This includes some way to\n record which versions were selected dynamially and then a way to\n require that the recorded versions be used in a later run.\n\nChange History\n**************\n\n0.3 (2009-03-31)\n================\n\n- Update for compatibility with zc.buildout 1.2.1\n\n0.2 (2008-05-25)\n================\n\n- Remove bogus dependency on virtualenv.\n\n0.1 (2008-02-29)\n================\n\n- Fork of zc.recipe.egg 1.0.0 which will install dependent scripts by \n default. Use \"dependent_scripts = false\" in the recipe to turn this\n behavior off.\n\n\nDetailed Documentation\n**********************\n\nInstallation of distributions as eggs\n=====================================\n\nThe repoze.recipe.egg:eggs recipe can be used to install various types if\ndistutils distributions as eggs. It takes a number of options:\n\neggs\n A list of eggs to install given as one or more setuptools\n requirement strings. Each string must be given on a separate\n line.\n\nfind-links\n A list of URLs, files, or directories to search for distributions.\n\nindex\n The URL of an index server, or almost any other valid URL. :)\n\n If not specified, the Python Package Index,\n http://cheeseshop.python.org/pypi, is used. You can specify an\n alternate index with this option. If you use the links option and\n if the links point to the needed distributions, then the index can\n be anything and will be largely ignored. In the examples, here,\n we'll just point to an empty directory on our link server. This\n will make our examples run a little bit faster.\n\npython\n The name of a section to get the Python executable from.\n If not specified, then the buildout python option is used. The\n Python executable is found in the executable option of the named\n section.\n\nWe have a link server that has a number of distributions:\n\n >>> print get(link_server),\n \n demo-0.1-py2.3.egg
\n demo-0.2-py2.3.egg
\n demo-0.3-py2.3.egg
\n demo-0.4c1-py2.3.egg
\n demoneeded-1.0.zip
\n demoneeded-1.1.zip
\n demoneeded-1.2c1.zip
\n extdemo-1.4.zip
\n index/
\n other-1.0-py2.3.egg
\n \n\nWe have a sample buildout. Let's update it's configuration file to\ninstall the demo package.\n\n >>> write(sample_buildout, 'buildout.cfg',\n ... \"\"\"\n ... [buildout]\n ... parts = demo\n ...\n ... [demo]\n ... recipe = repoze.recipe.egg:eggs\n ... eggs = demo<0.3\n ... find-links = %(server)s\n ... index = %(server)s/index\n ... \"\"\" % dict(server=link_server))\n\nIn this example, we limited ourselves to revisions before 0.3. We also\nspecified where to find distributions using the find-links option.\n\nLet's run the buildout:\n\n >>> import os\n >>> print system(buildout),\n Installing demo.\n Getting distribution for 'demo<0.3'.\n Got demo 0.2.\n Getting distribution for 'demoneeded'.\n Got demoneeded 1.2c1.\n\nNow, if we look at the buildout eggs directory:\n\n >>> ls(sample_buildout, 'eggs')\n - demo-0.2-py2.3.egg\n - demoneeded-1.2c1-py2.3.egg\n - setuptools-0.6-py2.3.egg\n - zc.buildout-1.0-py2.3.egg\n\nWe see that we got an egg for demo that met the requirement, as well\nas the egg for demoneeded, which demo requires. (We also see an egg\nlink for the recipe in the develop-eggs directory. This egg link was\nactually created as part of the sample buildout setup. Normally, when\nusing the recipe, you'll get a regular egg installation.)\n\nScript generation\n-----------------\n\nThe demo egg defined a script, but we didn't get one installed:\n\n >>> ls(sample_buildout, 'bin')\n - buildout\n\nIf we want scripts provided by eggs to be installed, we should use the \nscripts recipe:\n\n >>> write(sample_buildout, 'buildout.cfg',\n ... \"\"\"\n ... [buildout]\n ... parts = demo\n ...\n ... [demo]\n ... recipe = repoze.recipe.egg:scripts\n ... eggs = demo<0.3\n ... find-links = %(server)s\n ... index = %(server)s/index\n ... \"\"\" % dict(server=link_server))\n\n >>> print system(buildout),\n Uninstalling demo.\n Installing demo.\n Generated script '/sample-buildout/bin/demo'.\n\nNow we also see the script defined by the dmo script:\n\n >>> ls(sample_buildout, 'bin')\n - buildout\n - demo\n\nThe scripts recipe defines some additional options:\n\nentry-points\n A list of entry-point identifiers of the form name=module#attrs,\n name is a script name, module is a module name, and a attrs is a\n (possibly dotted) name of an object wihin the module. This option\n is useful when working with distributions that don't declare entry\n points, such as distributions not written to work with setuptools.\n\nscripts\n Control which scripts are generated. The value should be a list of\n zero or more tokens. Each token is either a name, or a name\n followed by an '=' and a new name. Only the named scripts are\n generated. If no tokens are given, then script generation is\n disabled. If the option isn't given at all, then all scripts\n defined by the named eggs will be generated.\n\ninterpreter\n The name of a script to generate that allows access to a Python\n interpreter that has the path set based on the eggs installed.\n\nextra-paths\n Extra paths to include in a generates script.\n\ninitialization\n Specify some Python initialization code. This is very limited. In\n particular, be aware that leading whitespace is stripped from the\n code given.\n\narguments\n Specify some arguments to be passed to entry points as Python source.\n\nLet's add an interpreter option:\n\n >>> write(sample_buildout, 'buildout.cfg',\n ... \"\"\"\n ... [buildout]\n ... parts = demo\n ...\n ... [demo]\n ... recipe = repoze.recipe.egg\n ... eggs = demo<0.3\n ... find-links = %(server)s\n ... index = %(server)s/index\n ... interpreter = py-demo\n ... \"\"\" % dict(server=link_server))\n\nNote that we ommitted the entry point name from the recipe\nspecification. We were able to do this because the scripts recipe if\nthe default entry point for the repoze.recipe.egg egg.\n\n >>> print system(buildout),\n Uninstalling demo.\n Installing demo.\n Generated script '/sample-buildout/bin/demo'.\n Generated interpreter '/sample-buildout/bin/py-demo'.\n\nNow we also get a py-demo script for giving us a Python prompt with\nthe path for demo and any eggs it depends on included in sys.path.\nThis is useful for debugging and testing.\n\n >>> ls(sample_buildout, 'bin')\n - buildout\n - demo\n - py-demo\n\nIf we run the demo script, it prints out some minimal data:\n\n >>> print system(join(sample_buildout, 'bin', 'demo')),\n 2 2\n\nThe value it prints out happens to be some values defined in the\nmodules installed.\n\nWe can also run the py-demo script. Here we'll just print out\nthe bits if the path added to reflect the eggs:\n\n >>> print system(join(sample_buildout, 'bin', 'py-demo'),\n ... \"\"\"import os, sys\n ... for p in sys.path:\n ... if 'demo' in p:\n ... print os.path.basename(p)\n ...\n ... \"\"\").replace('>>> ', '').replace('... ', ''),\n ... # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE\n demo-0.2-py2.4.egg\n demoneeded-1.2c1-py2.4.egg\n\nEgg updating\n------------\n\nThe recipe normally gets the most recent distribution that satisfies the\nspecification. It won't do this is the buildout is either in\nnon-newest mode or in offline mode. To see how this works, we'll\nremove the restriction on demo:\n\n >>> write(sample_buildout, 'buildout.cfg',\n ... \"\"\"\n ... [buildout]\n ... parts = demo\n ...\n ... [demo]\n ... recipe = repoze.recipe.egg\n ... find-links = %(server)s\n ... index = %(server)s/index\n ... \"\"\" % dict(server=link_server))\n\nand run the buildout in non-newest mode:\n\n >>> print system(buildout+' -N'),\n Uninstalling demo.\n Installing demo.\n Generated script '/sample-buildout/bin/demo'.\n\nNote that we removed the eggs option, and the eggs defaulted to the\npart name. Because we removed the eggs option, the demo was\nreinstalled.\n\nWe'll also run the buildout in off-line mode:\n\n >>> print system(buildout+' -o'),\n Updating demo.\n\nWe didn't get an update for demo:\n\n >>> ls(sample_buildout, 'eggs')\n - demo-0.2-py2.3.egg\n - demoneeded-1.2c1-py2.3.egg\n - setuptools-0.6-py2.3.egg\n - zc.buildout-1.0-py2.3.egg\n\nIf we run the buildout on the default online and newest modes, \nwe'll get an update for demo:\n\n >>> print system(buildout),\n Updating demo.\n Getting distribution for 'demo'.\n Got demo 0.4c1.\n Generated script '/sample-buildout/bin/demo'.\n\nThen we'll get a new demo egg:\n\n >>> ls(sample_buildout, 'eggs')\n - demo-0.2-py2.3.egg\n - demo-0.4c1-py2.3.egg\n - demoneeded-1.2c1-py2.3.egg\n - setuptools-0.6-py2.4.egg\n - zc.buildout-1.0-py2.4.egg\n\nThe script is updated too:\n\n >>> print system(join(sample_buildout, 'bin', 'demo')),\n 4 2\n\nControlling script generation\n-----------------------------\n\nYou can control which scripts get generated using the scripts option.\nFor example, to suppress scripts, use the scripts option without any\narguments:\n\n >>> write(sample_buildout, 'buildout.cfg',\n ... \"\"\"\n ... [buildout]\n ... parts = demo\n ...\n ... [demo]\n ... recipe = repoze.recipe.egg\n ... find-links = %(server)s\n ... index = %(server)s/index\n ... scripts =\n ... \"\"\" % dict(server=link_server))\n\n\n >>> print system(buildout),\n Uninstalling demo.\n Installing demo.\n\n >>> ls(sample_buildout, 'bin')\n - buildout\n\nYou can also control the name used for scripts:\n\n >>> write(sample_buildout, 'buildout.cfg',\n ... \"\"\"\n ... [buildout]\n ... parts = demo\n ...\n ... [demo]\n ... recipe = repoze.recipe.egg\n ... find-links = %(server)s\n ... index = %(server)s/index\n ... scripts = demo=foo\n ... \"\"\" % dict(server=link_server))\n\n >>> print system(buildout),\n Uninstalling demo.\n Installing demo.\n Generated script '/sample-buildout/bin/foo'.\n\n >>> ls(sample_buildout, 'bin')\n - buildout\n - foo\n\nSpecifying extra script paths\n-----------------------------\n\nIf we need to include extra paths in a script, we can use the\nextra-paths option:\n\n >>> write(sample_buildout, 'buildout.cfg',\n ... \"\"\"\n ... [buildout]\n ... parts = demo\n ...\n ... [demo]\n ... recipe = repoze.recipe.egg\n ... find-links = %(server)s\n ... index = %(server)s/index\n ... scripts = demo=foo\n ... extra-paths =\n ... /foo/bar\n ... /spam/eggs\n ... \"\"\" % dict(server=link_server))\n\n >>> print system(buildout),\n Uninstalling demo.\n Installing demo.\n Generated script '/sample-buildout/bin/foo'.\n\nLet's look at the script that was generated:\n\n >>> cat(sample_buildout, 'bin', 'foo') # doctest: +NORMALIZE_WHITESPACE\n #!/usr/local/bin/python2.4\n \n import sys\n sys.path[0:0] = [\n '/sample-buildout/eggs/demo-0.4c1-py2.4.egg',\n '/sample-buildout/eggs/demoneeded-1.2c1-py2.4.egg',\n '/foo/bar',\n '/spam/eggs',\n ]\n \n import eggrecipedemo\n \n if __name__ == '__main__':\n eggrecipedemo.main()\n\nSpecifying initialialization code and arguments\n-----------------------------------------------\n\nSometimes, we ned to do more than just calling entry points. We can\nuse the initialialization and arguments options to specify extra code\nto be included in generated scripts:\n\n\n >>> write(sample_buildout, 'buildout.cfg',\n ... \"\"\"\n ... [buildout]\n ... parts = demo\n ...\n ... [demo]\n ... recipe = repoze.recipe.egg\n ... find-links = %(server)s\n ... index = %(server)s/index\n ... scripts = demo=foo\n ... extra-paths =\n ... /foo/bar\n ... /spam/eggs\n ... initialization = a = (1, 2\n ... 3, 4)\n ... arguments = a, 2\n ... \"\"\" % dict(server=link_server))\n\n >>> print system(buildout),\n Uninstalling demo.\n Installing demo.\n Generated script '/sample-buildout/bin/foo'.\n\n >>> cat(sample_buildout, 'bin', 'foo') # doctest: +NORMALIZE_WHITESPACE\n #!/usr/local/bin/python2.4\n \n import sys\n sys.path[0:0] = [\n '/sample-buildout/eggs/demo-0.4c1-py2.4.egg',\n '/sample-buildout/eggs/demoneeded-1.2c1-py2.4.egg',\n '/foo/bar',\n '/spam/eggs',\n ]\n \n a = (1, 2\n 3, 4)\n \n import eggrecipedemo\n \n if __name__ == '__main__':\n eggrecipedemo.main(a, 2)\n\nHere we see that the initialization code we specified was added after\nsetting the path. Note, as mentioennd above, that leading whitespace\nhas been stripped. Similarly, the argument code we specified was\nadded in the entry point call (to main).\n\nSpecifying entry points\n-----------------------\n\nScripts can be generated for entry points declared explicitly. We can\ndeclare entry points using the entry-points option:\n\n >>> write(sample_buildout, 'buildout.cfg',\n ... \"\"\"\n ... [buildout]\n ... parts = demo\n ...\n ... [demo]\n ... recipe = repoze.recipe.egg\n ... find-links = %(server)s\n ... index = %(server)s/index\n ... extra-paths =\n ... /foo/bar\n ... /spam/eggs\n ... entry-points = alt=eggrecipedemo:alt other=foo.bar:a.b.c\n ... \"\"\" % dict(server=link_server))\n\n >>> print system(buildout),\n Uninstalling demo.\n Installing demo.\n Generated script '/sample-buildout/bin/demo'.\n Generated script '/sample-buildout/bin/alt'.\n Generated script '/sample-buildout/bin/other'.\n\n >>> ls(sample_buildout, 'bin')\n - alt\n - buildout\n - demo\n - other\n\n >>> cat(sample_buildout, 'bin', 'other')\n #!/usr/local/bin/python2.4\n \n import sys\n sys.path[0:0] = [\n '/sample-buildout/eggs/demo-0.4c1-py2.4.egg',\n '/sample-buildout/eggs/demoneeded-1.2c1-py2.4.egg',\n '/foo/bar',\n '/spam/eggs',\n ]\n \n import foo.bar\n \n if __name__ == '__main__':\n foo.bar.a.b.c()\n\nOffline mode\n------------\n\nIf the buildout offline option is set to \"true\", then no attempt will\nbe made to contact an index server:\n\n >>> write(sample_buildout, 'buildout.cfg',\n ... \"\"\"\n ... [buildout]\n ... parts = demo\n ... offline = true\n ...\n ... [demo]\n ... recipe = repoze.recipe.egg\n ... index = eek!\n ... scripts = demo=foo\n ... \"\"\" % dict(server=link_server))\n\n >>> print system(buildout),\n Uninstalling demo.\n Installing demo.\n Generated script '/sample-buildout/bin/foo'.\n\nControlling which Python to use\n-------------------------------\n\nThe following assumes that you have Python 2.3 installed.\n\nWe can specify the python to use by specifying the name of a section\nto read the Python executable from. The default is the section\ndefined by the python buildout option.\n\nWe have a link server:\n\n >>> print get(link_server),\n \n demo-0.1-py2.3.egg
\n demo-0.2-py2.3.egg
\n demo-0.3-py2.3.egg
\n demo-0.4c1-py2.3.egg
\n demoneeded-1.0.zip
\n demoneeded-1.1.zip
\n demoneeded-1.2c1.zip
\n extdemo-1.4.zip
\n index/
\n other-1.0-py2.3.egg
\n \n\nWe have a sample buildout. Let's update it's configuration file to\ninstall the demo package using Python 2.3. \n\n >>> write(sample_buildout, 'buildout.cfg',\n ... \"\"\"\n ... [buildout]\n ... parts = demo\n ... eggs-directory = eggs\n ... index = http://www.python.org/pypi/\n ...\n ... [python2.3]\n ... executable = %(python23)s\n ...\n ... [demo]\n ... recipe = repoze.recipe.egg\n ... eggs = demo <0.3\n ... find-links = %(server)s\n ... python = python2.3\n ... interpreter = py-demo\n ... \"\"\" % dict(server=link_server, python23=python2_3_executable))\n\nNow, if we run the buildout:\n\n >>> import os\n >>> os.chdir(sample_buildout)\n >>> buildout = os.path.join(sample_buildout, 'bin', 'buildout')\n >>> print system(buildout),\n Installing demo.\n Getting distribution for 'demo<0.3'.\n Got demo 0.2.\n Getting distribution for 'demoneeded'.\n Getting distribution for 'setuptools'.\n Got setuptools 0.6.\n Got demoneeded 1.2c1.\n Generated script '/sample-buildout/bin/demo'.\n Generated interpreter '/sample-buildout/bin/py-demo'.\n\nwe'll get the Python 2.3 eggs for demo and demoneeded:\n\n >>> ls(sample_buildout, 'eggs')\n - demo-0.2-py2.3.egg\n - demoneeded-1.2c1-py2.3.egg\n d setuptools-0.6-py2.3.egg\n d setuptools-0.6-py2.4.egg\n - zc.buildout-1.0-py2.4.egg\n \nAnd the generated scripts invoke Python 2.3:\n\n >>> import sys\n >>> if sys.platform == 'win32':\n ... script_name = 'demo-script.py'\n ... else:\n ... script_name = 'demo'\n >>> f = open(os.path.join(sample_buildout, 'bin', script_name))\n >>> f.readline().strip() == '#!' + python2_3_executable\n True\n >>> print f.read(), # doctest: +NORMALIZE_WHITESPACE\n \n import sys\n sys.path[0:0] = [\n '/sample-buildout/eggs/demo-0.2-py2.3.egg',\n '/sample-buildout/eggs/demoneeded-1.2c1-py2.3.egg',\n ]\n \n import eggrecipedemo\n \n if __name__ == '__main__':\n eggrecipedemo.main()\n\n >>> if sys.platform == 'win32':\n ... f = open(os.path.join(sample_buildout, 'bin', 'py-demo-script.py'))\n ... else:\n ... f = open(os.path.join(sample_buildout, 'bin', 'py-demo'))\n >>> f.readline().strip() == '#!' + python2_3_executable\n True\n >>> print f.read(), # doctest: +NORMALIZE_WHITESPACE\n import sys\n \n sys.path[0:0] = [\n '/sample-buildout/eggs/demo-0.2-py2.3.egg',\n '/sample-buildout/eggs/demoneeded-1.2c1-py2.3.egg',\n ]\n \n _interactive = True\n if len(sys.argv) > 1:\n import getopt\n _options, _args = getopt.getopt(sys.argv[1:], 'ic:')\n _interactive = False\n for (_opt, _val) in _options:\n if _opt == '-i':\n _interactive = True\n elif _opt == '-c':\n exec _val\n \n if _args:\n sys.argv[:] = _args\n execfile(sys.argv[0])\n \n if _interactive:\n import code\n code.interact(banner=\"\", local=globals())\n\n >>> f.close()\n\nCreating eggs with extensions neededing custom build settings\n=============================================================\n\nSometimes, It's necessary to provide extra control over how an egg is\ncreated. This is commonly true for eggs with extension modules that\nneed to access libraries or include files.\n\nThe repoze.recipe.egg:custom recipe can be used to define an egg with\ncustom build parameters. The currently defined parameters are:\n\ninclude-dirs\n A new-line separated list of directories to search for include\n files.\n\nlibrary-dirs\n A new-line separated list of directories to search for libraries\n to link with.\n\nrpath\n A new-line separated list of directories to search for dynamic libraries\n at run time.\n\ndefine\n A comma-separated list of names of C preprocessor variables to\n define.\n\nundef\n A comman separated list of names of C preprocessor variables to\n undefine.\n\nlibraries\n The name of an additional library to link with. Due to limitations\n in distutils and desprite the option name, only a single library\n can be specified.\n\nlink-objects\n The name of an link object to link afainst. Due to limitations\n in distutils and desprite the option name, only a single link object\n can be specified.\n\ndebug\n Compile/link with debugging information\n\nforce\n Forcibly build everything (ignore file timestamps)\n\ncompiler\n Specify the compiler type\n\nswig\n The path to the swig executable\n\nswig-cpp \n Make SWIG create C++ files (default is C)\n\nswig-opts\n List of SWIG command line options\n\nIn addition, the following options can be used to specify the egg:\n\negg\n An specification for the egg to be created, to install given as a\n setuptools requirement string. This defaults to the part name.\n\nfind-links\n A list of URLs, files, or directories to search for distributions.\n\nindex\n The URL of an index server, or almost any other valid URL. :)\n\n If not specified, the Python Package Index,\n http://cheeseshop.python.org/pypi, is used. You can specify an\n alternate index with this option. If you use the links option and\n if the links point to the needed distributions, then the index can\n be anything and will be largely ignored. In the examples, here,\n we'll just point to an empty directory on our link server. This \n will make our examples run a little bit faster.\n\npython\n The name of a section to get the Python executable from.\n If not specified, then the buildout python option is used. The\n Python executable is found in the executable option of the named\n section. \n\nTo illustrate this, we'll define a buildout that builds an egg for a\npackage that has a simple extension module::\n\n #include \n #include \n\n static PyMethodDef methods[] = {};\n\n PyMODINIT_FUNC\n initextdemo(void)\n {\n PyObject *m;\n m = Py_InitModule3(\"extdemo\", methods, \"\");\n #ifdef TWO\n PyModule_AddObject(m, \"val\", PyInt_FromLong(2));\n #else\n PyModule_AddObject(m, \"val\", PyInt_FromLong(EXTDEMO));\n #endif\n }\n\nThe extension depends on a system-dependnt include file, extdemo.h,\nthat defines a constant, EXTDEMO, that is exposed by the extension.\n\nThe extension module is available as a source distribution,\nextdemo-1.4.tar.gz, on a distribution server.\n\nWe have a sample buildout that we'll add an include directory to with\nthe necessary include file:\n\n >>> mkdir('include')\n >>> write('include', 'extdemo.h',\n ... \"\"\"\n ... #define EXTDEMO 42\n ... \"\"\")\n\nWe'll also update the buildout configuration file to define a part for\nthe egg:\n\n >>> write(sample_buildout, 'buildout.cfg',\n ... \"\"\"\n ... [buildout]\n ... parts = extdemo\n ...\n ... [extdemo]\n ... recipe = repoze.recipe.egg:custom\n ... find-links = %(server)s\n ... index = %(server)s/index\n ... include-dirs = include\n ... \"\"\" % dict(server=link_server))\n\n >>> print system(buildout),\n Installing extdemo.\n zip_safe flag not set; analyzing archive contents...\n\nWe got the zip_safe warning because the source distribution we used\nwasn't setuptools based and thus didn't set the option.\n\nThe egg is created in the develop-eggs directory *not* the eggs\ndirectory because it depends on buildout-specific parameters and the\neggs directory can be shared across multiple buildouts.\n\n >>> ls(sample_buildout, 'develop-eggs')\n d extdemo-1.4-py2.4-unix-i686.egg\n - repoze.recipe.egg.egg-link\n\nNote that no scripts or dependencies are installed. To install\ndependencies or scripts for a custom egg, define another part and use\nthe repoze.recipe.egg recipe, listing the custom egg as one of the eggs to\nbe installed. The repoze.recipe.egg recipe will use the installed egg.\n\nLet's define a script that uses out ext demo:\n\n >>> mkdir('demo')\n >>> write('demo', 'demo.py',\n ... \"\"\"\n ... import extdemo\n ... def main():\n ... print extdemo.val\n ... \"\"\")\n\n >>> write('demo', 'setup.py',\n ... \"\"\"\n ... from setuptools import setup\n ... setup(name='demo')\n ... \"\"\")\n\n\n >>> write('buildout.cfg',\n ... \"\"\"\n ... [buildout]\n ... develop = demo\n ... parts = extdemo demo\n ...\n ... [extdemo]\n ... recipe = repoze.recipe.egg:custom\n ... find-links = %(server)s\n ... index = %(server)s/index\n ... include-dirs = include\n ...\n ... [demo]\n ... recipe = repoze.recipe.egg\n ... eggs = demo \n ... extdemo\n ... entry-points = demo=demo:main\n ... \"\"\" % dict(server=link_server))\n\n >>> print system(buildout),\n Develop: '/sample-buildout/demo'\n Updating extdemo.\n Installing demo.\n Generated script '/sample-buildout/bin/demo'.\n\nWhen we run the script, we'll 42 printed:\n\n >>> print system(join('bin', 'demo')),\n 42\n\nUpdating\n--------\n\nThe custom recipe will normally check for new source distributions\nthat meet the given specification. This can be suppressed using the\nbuildout non-newest and offline modes. We'll generate a new source\ndistribution for extdemo:\n\n >>> update_extdemo()\n\nIf we run the buildout in non-newest or offline modes:\n\n >>> print system(buildout+' -N'),\n Develop: '/sample-buildout/demo'\n Updating extdemo.\n Updating demo.\n\n >>> print system(buildout+' -o'),\n Develop: '/sample-buildout/demo'\n Updating extdemo.\n Updating demo.\n\nWe won't get an update.\n\n >>> ls(sample_buildout, 'develop-eggs')\n - demo.egg-link\n d extdemo-1.4-py2.4-unix-i686.egg\n - repoze.recipe.egg.egg-link\n\nBut if we run the buildout in the default on-line and newest modes, we\nwill:\n\n >>> print system(buildout),\n Develop: '/sample-buildout/demo'\n Updating extdemo.\n zip_safe flag not set; analyzing archive contents...\n Updating demo.\n Generated script '/sample-buildout/bin/demo'.\n\n >>> ls(sample_buildout, 'develop-eggs')\n - demo.egg-link\n d extdemo-1.4-py2.4-linux-i686.egg\n d extdemo-1.5-py2.4-linux-i686.egg\n - repoze.recipe.egg.egg-link\n\nControlling the version used\n----------------------------\n\nWe can specify a specific version using the egg option:\n\n >>> write('buildout.cfg',\n ... \"\"\"\n ... [buildout]\n ... develop = demo\n ... parts = extdemo demo\n ...\n ... [extdemo]\n ... recipe = repoze.recipe.egg:custom\n ... egg = extdemo ==1.4\n ... find-links = %(server)s\n ... index = %(server)s/index\n ... include-dirs = include\n ...\n ... [demo]\n ... recipe = repoze.recipe.egg\n ... eggs = demo \n ... extdemo ==1.4\n ... entry-points = demo=demo:main\n ... \"\"\" % dict(server=link_server))\n\n >>> print system(buildout+' -D'),\n Develop: '/sample-buildout/demo'\n Uninstalling demo.\n Uninstalling extdemo.\n Installing extdemo.\n zip_safe flag not set; analyzing archive contents...\n Installing demo.\n Generated script '/sample-buildout/bin/demo'.\n\n >>> ls(sample_buildout, 'develop-eggs')\n - demo.egg-link\n d extdemo-1.4-py2.4-linux-i686.egg\n - repoze.recipe.egg.egg-link\n\nControlling develop-egg generation\n==================================\n\nIf you want to provide custom build options for a develop egg, you can\nuse the develop recipe. The recipe has the following options:\n\npath\n The path to a setup script or directory containing a startup\n script. This is required.\n\ninclude-dirs\n A new-line separated list of directories to search for include\n files.\n\nlibrary-dirs\n A new-line separated list of directories to search for libraries\n to link with.\n\nrpath\n A new-line separated list of directories to search for dynamic libraries\n at run time.\n\ndefine\n A comma-separated list of names of C preprocessor variables to\n define.\n\nundef\n A comman separated list of names of C preprocessor variables to\n undefine.\n\nlibraries\n The name of an additional library to link with. Due to limitations\n in distutils and desprite the option name, only a single library\n can be specified.\n\nlink-objects\n The name of an link object to link afainst. Due to limitations\n in distutils and desprite the option name, only a single link object\n can be specified.\n\ndebug\n Compile/link with debugging information\n\nforce\n Forcibly build everything (ignore file timestamps)\n\ncompiler\n Specify the compiler type\n\nswig\n The path to the swig executable\n\nswig-cpp \n Make SWIG create C++ files (default is C)\n\nswig-opts\n List of SWIG command line options\n\npython\n The name of a section to get the Python executable from.\n If not specified, then the buildout python option is used. The\n Python executable is found in the executable option of the named\n section. \n\nTo illustrate this, we'll use a directory containing the extdemo\nexample from the earlier section:\n\n >>> ls(extdemo)\n - MANIFEST\n - MANIFEST.in\n - README\n - extdemo.c\n - setup.py\n\n >>> write('buildout.cfg',\n ... \"\"\"\n ... [buildout]\n ... develop = demo\n ... parts = extdemo demo\n ...\n ... [extdemo]\n ... setup = %(extdemo)s\n ... recipe = repoze.recipe.egg:develop\n ... include-dirs = include\n ... define = TWO\n ...\n ... [demo]\n ... recipe = repoze.recipe.egg\n ... eggs = demo \n ... extdemo\n ... entry-points = demo=demo:main\n ... \"\"\" % dict(extdemo=extdemo))\n\nNote that we added a define option to cause the preprocessor variable\nTWO to be defined. This will cause the module-variable, 'val', to be\nset with a value of 2.\n\n >>> print system(buildout),\n Develop: '/sample-buildout/demo'\n Uninstalling demo.\n Uninstalling extdemo.\n Installing extdemo.\n Installing demo.\n Generated script '/sample-buildout/bin/demo'.\n\nOur develop-eggs now includes an egg link for extdemo:\n\n >>> ls('develop-eggs')\n - demo.egg-link\n - extdemo.egg-link\n - repoze.recipe.egg.egg-link\n\nand the extdemo now has a built extension:\n\n >>> ls(extdemo)\n - MANIFEST\n - MANIFEST.in\n - README\n d build\n - extdemo.c\n d extdemo.egg-info\n - extdemo.so\n - setup.py\n\nBecause develop eggs take precedence over non-develop eggs, the demo\nscript will use the new develop egg:\n\n >>> print system(join('bin', 'demo')),\n 2\n\nEgg Recipe API for other Recipes\n================================\n\nIt is common for recipes to accept a collection of egg specifications\nand generate scripts based on the resulting working sets. The egg\nrecipe provides an API that other recipes can use.\n\nA recipe can reuse the egg recipe, supporting the eggs, find-links,\nindex, extra-paths, and python options. This is done by creating an\negg recipe instance in a recipes's contructor. In the recipe's\ninstall script, the egg-recipe instance's working_set method is used\nto collect the requested eggs and working set.\n\nTo illustrate, we create a sample recipe that is a very thin layer\naround the egg recipe:\n\n >>> mkdir(sample_buildout, 'sample')\n >>> write(sample_buildout, 'sample', 'sample.py', \n ... \"\"\"\n ... import logging, os\n ... import repoze.recipe.egg\n ...\n ... class Sample:\n ...\n ... def __init__(self, buildout, name, options):\n ... self.egg = repoze.recipe.egg.Scripts(buildout, name, options)\n ... self.name = name\n ... self.options = options\n ...\n ... def install(self):\n ... extras = self.options['extras'].split()\n ... requirements, ws = self.egg.working_set(extras)\n ... print 'Part:', self.name\n ... print 'Egg requirements:'\n ... for r in requirements:\n ... print r\n ... print 'Working set:'\n ... for d in ws:\n ... print d\n ... print 'extra paths:', self.egg.extra_paths\n ... return ()\n ...\n ... update = install\n ... \"\"\")\n\nHere we instantiated the egg recipe in the constructor, saving it in\nan attribute. This also initialized the options dictionary.\n\nIn our install method, we called the working_set method on the\ninstance we saved. The working_set method takes an optional sequence\nof extra requirements to be included in the working set.\n\n >>> write(sample_buildout, 'sample', 'setup.py',\n ... \"\"\"\n ... from setuptools import setup\n ... \n ... setup(\n ... name = \"sample\",\n ... entry_points = {'zc.buildout': ['default = sample:Sample']},\n ... install_requires = 'repoze.recipe.egg',\n ... )\n ... \"\"\")\n\n\n >>> write(sample_buildout, 'sample', 'README.txt', \" \")\n\n >>> write(sample_buildout, 'buildout.cfg',\n ... \"\"\"\n ... [buildout]\n ... develop = sample\n ... parts = sample-part\n ...\n ... [sample-part]\n ... recipe = sample\n ... eggs = demo<0.3\n ... find-links = %(server)s\n ... index = %(server)sindex\n ... extras = other\n ... \"\"\" % dict(server=link_server))\n\n >>> import os\n >>> os.chdir(sample_buildout)\n >>> buildout = os.path.join(sample_buildout, 'bin', 'buildout')\n >>> print system(buildout + ' -q'),\n Part: sample-part\n Egg requirements:\n demo<0.3\n Working set:\n demo 0.2\n other 1.0\n demoneeded 1.2c1\n extra paths: []\n\nWe can see that the options were augmented with additionl data\ncomputed by the egg recipe by looking at .installed.cfg:\n\n >>> cat(sample_buildout, '.installed.cfg')\n [buildout]\n installed_develop_eggs = /sample-buildout/develop-eggs/sample.egg-link\n parts = sample-part\n \n [sample-part]\n __buildout_installed__ = \n __buildout_signature__ = sample-6aWMvV2EJ9Ijq+bR8ugArQ==\n repoze.recipe.egg-cAsnudgkduAa/Fd+WJIM6Q==\n setuptools-0.6-py2.4.egg\n zc.buildout-+rYeCcmFuD1K/aB77XTj5A==\n _b = /sample-buildout/bin\n _d = /sample-buildout/develop-eggs\n _e = /sample-buildout/eggs\n bin-directory = /sample-buildout/bin\n develop-eggs-directory = /sample-buildout/develop-eggs\n eggs = demo<0.3\n eggs-directory = /sample-buildout/eggs\n executable = /usr/local/bin/python2.3\n extras = other\n find-links = http://localhost:27071/\n index = http://localhost:27071/index\n recipe = sample\n\nIf we use the extra-paths option:\n\n\n >>> write(sample_buildout, 'buildout.cfg',\n ... \"\"\"\n ... [buildout]\n ... develop = sample\n ... parts = sample-part\n ...\n ... [sample-part]\n ... recipe = sample\n ... eggs = demo<0.3\n ... find-links = %(server)s\n ... index = %(server)sindex\n ... extras = other\n ... extra-paths = /foo/bar\n ... /spam/eggs\n ... \"\"\" % dict(server=link_server))\n\nThen we'll see that reflected in the extra_paths attribute in the egg\nrecipe instance:\n\n >>> print system(buildout + ' -q'),\n Part: sample-part\n Egg requirements:\n demo<0.3\n Working set:\n demo 0.2\n other 1.0\n demoneeded 1.2c1\n extra paths: ['/foo/bar', '/spam/eggs']\n\n\nDownload\n*********", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://svn.repoze.org/repoze.recipe.egg/trunk/", "keywords": "development build", "license": "ZPL 2.1", "maintainer": null, "maintainer_email": null, "name": "repoze.recipe.egg", "package_url": "https://pypi.org/project/repoze.recipe.egg/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/repoze.recipe.egg/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://svn.repoze.org/repoze.recipe.egg/trunk/" }, "release_url": "https://pypi.org/project/repoze.recipe.egg/0.3/", "requires_dist": null, "requires_python": null, "summary": "Recipe for installing Python package distributions as eggs", "version": "0.3" }, "last_serial": 798824, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "6208746c330f2524e97670241b73b05f", "sha256": "8b78d3164504c8dd2b694d8bd58850487af9179145ddc1d2db4a90e5fdc09467" }, "downloads": -1, "filename": "repoze.recipe.egg-0.1.tar.gz", "has_sig": false, "md5_digest": "6208746c330f2524e97670241b73b05f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 26089, "upload_time": "2008-03-03T15:04:06", "url": "https://files.pythonhosted.org/packages/3b/6a/aa94a260d0837c94561eb0669a25fc8e4b819977ed74753cdfaa8cd159a7/repoze.recipe.egg-0.1.tar.gz" } ], "0.2": [ { "comment_text": "", "digests": { "md5": "8b5f3bb56fde427243f2647388e56505", "sha256": "8b6e9de1e8c8a9c7ef59cd8246244300b7c13e22d81b49d092ca9888204fd1c1" }, "downloads": -1, "filename": "repoze.recipe.egg-0.2.tar.gz", "has_sig": false, "md5_digest": "8b5f3bb56fde427243f2647388e56505", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 26196, "upload_time": "2009-02-14T19:56:54", "url": "https://files.pythonhosted.org/packages/85/e0/73a36aee22f9565a7a48f1ee4d1a9de3ad922d382bb5b755e45995a9aa1e/repoze.recipe.egg-0.2.tar.gz" } ], "0.3": [ { "comment_text": "", "digests": { "md5": "2d98a59562f7f647453e8b0e4a51da69", "sha256": "91a874502f9b8499d09fbb36930df1322ea300157c6e535f5f59d72d144fa3a2" }, "downloads": -1, "filename": "repoze.recipe.egg-0.3.tar.gz", "has_sig": false, "md5_digest": "2d98a59562f7f647453e8b0e4a51da69", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 26455, "upload_time": "2009-04-01T03:07:59", "url": "https://files.pythonhosted.org/packages/a9/33/9f9b442990d5935e92369efe93b03b6b8adea1018cbc781d5a1cc84883b7/repoze.recipe.egg-0.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "2d98a59562f7f647453e8b0e4a51da69", "sha256": "91a874502f9b8499d09fbb36930df1322ea300157c6e535f5f59d72d144fa3a2" }, "downloads": -1, "filename": "repoze.recipe.egg-0.3.tar.gz", "has_sig": false, "md5_digest": "2d98a59562f7f647453e8b0e4a51da69", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 26455, "upload_time": "2009-04-01T03:07:59", "url": "https://files.pythonhosted.org/packages/a9/33/9f9b442990d5935e92369efe93b03b6b8adea1018cbc781d5a1cc84883b7/repoze.recipe.egg-0.3.tar.gz" } ] }