{ "info": { "author": "Jim Fulton", "author_email": "jim@zope.com", "bugtrack_url": null, "classifiers": [], "description": ".. contents::\n\nCreating Source Releases from Buildouts\n=======================================\n\nThe zc.sourcerelease package provides a script,\nbuildout-source-release, that generates a source release from a\nbuildout. The source release, is in the form of a gzipped tar archive\n[#zip_in_future]_. The generated source release can be used as the\nbasis for higher-level releases, such as RPMs or\nconfigure-make-make-install releases.\n\nThe source releases includes data that would normally be installed in\na download cache, such as Python distributions, or downloads performed\nby the zc.recipe.cmmi recipe. If a buildout uses a recipe that\ndownloads data but does not store the downloaded data in the buildout\ndownload cache, then the data will not be included in the source\nrelease and will have to be downloaded when the source release is\ninstalled.\n\nThe source release includes a Python install script. It is not\nexecutable and must be run with the desired Python, which must be the\nsame version of Python used when making the release. The install\nscript runs the buildout in place. This means that the source release\nwill need to be extracted to and the install script run in the final install\nlocation [#separate_install_step]_. While the install script can be\nused directly, it will more commonly be used by system-packaging\n(e.g. RPM) build scripts or make files.\n\nInstallation\n------------\n\nYou can install the buildout-source-release script with easy install::\n\n easy_install zc.sourcerelease\n\nor you can install it into a buildout using zc.buildout.\n\nUsage\n-----\n\nTo create a source release, simply run the buildout-source-release\nscript, passing a file URL or a subversion URL\n[#other_source_code_control_systems]_ and the name of the\nconfiguration file to use. File URLs are useful for testing and can\nbe used with non-subversion source-code control systems.\n\nLet's look at an example. We have a server with some distributions on\nit.\n\n >>> index_content = get(link_server)\n >>> if 'distribute' in index_content:\n ... lines = index_content.splitlines()\n ... distribute_line = lines.pop(1)\n ... lines.insert(4, distribute_line)\n ... index_content = '\\n'.join(lines)\n >>> print index_content,\n \n index/
\n sample1-1.0.zip
\n sample2-1.0.zip
\n setuptools-0.6-py2.4.egg
\n zc.buildout-1.0-py2.4.egg
\n zc.buildout-99.99-pyN.N.egg
\n zc.recipe.egg-1.0-py2.4.egg
\n \n\nWe have the buildout-source-release installed in a local bin\ndirectory. We'll create another buildout that we'll use for our\nsource release.\n\n >>> mkdir('sample')\n >>> sample = join(sample_buildout, 'sample')\n >>> write(sample, 'buildout.cfg',\n ... '''\n ... [buildout]\n ... parts = sample\n ... find-links = %(link_server)s\n ...\n ... [sample]\n ... recipe = zc.recipe.egg\n ... eggs = sample1\n ... ''' % globals())\n\nWe'll run the release script against this sample directory:\n\n >>> print system(join('bin', 'buildout-source-release')\n ... +' file://'+sample+' buildout.cfg'),\n ... # doctest: +ELLIPSIS\n Creating source release in sample.tgz\n ...\n\nWe end up with a tar file:\n\n >>> ls('.')\n - .installed.cfg\n d bin\n - buildout.cfg\n d develop-eggs\n d eggs\n d parts\n d sample\n - sample.tgz\n\nIf we want to give the file a custom name, in this case something other than\nsample.tgz, we can use the '-n' or '--name' option to specify one:\n\n >>> print system(join('bin', 'buildout-source-release')\n ... +' file://'+sample+' buildout.cfg -n custom_name_one'),\n ... # doctest: +ELLIPSIS\n Creating source release in custom_name_one.tgz\n ...\n\n >>> print system(join('bin', 'buildout-source-release')\n ... +' file://'+sample+' buildout.cfg --name custom_name_two'),\n ... # doctest: +ELLIPSIS\n Creating source release in custom_name_two.tgz\n ...\n\n >>> ls('.')\n - .installed.cfg\n d bin\n - buildout.cfg\n - custom_name_one.tgz\n - custom_name_two.tgz\n d develop-eggs\n d eggs\n d parts\n d sample\n - sample.tgz\n\nLet's continue with the example using sample.tgz. Extract the tar file to a\ntemporary directory:\n\n >>> mkdir('test')\n >>> import tarfile\n >>> tf = tarfile.open('sample.tgz', 'r:gz')\n >>> for name in tf.getnames():\n ... tf.extract(name, 'test')\n >>> tf.close()\n\n >>> ls('test')\n d sample\n\n >>> ls('test', 'sample')\n - buildout.cfg\n d eggs\n - install.py\n d release-distributions\n\nThe extracted sample directory has eggs for buildout and setuptools:\n\n >>> ls('test', 'sample', 'eggs')\n - setuptools-0.6c7-py2.4.egg\n d zc.buildout-99.99-py2.4.egg\n\nNote that version 99.99 of zc.buildout was used because it was the\nmost recent version on the link server. This happens to be different\nthan the version of buildout used by the source-release script.\n\nIt has a release-distributions directory containing distributions\nneeded to install the buildout:\n\n >>> ls('test', 'sample', 'release-distributions', 'dist')\n - sample1-1.0.zip\n - sample2-1.0.zip\n - zc.buildout-99.99-pyN.N.egg\n - zc.recipe.egg-1.0.0b6-py2.4.egg\n\n(There normally aren't distributions for buildout and setuptools, etc.\nbecause these are pre-installed in the eggs directory of the source\nrelease. In this case, we have a release for zc.buildout because it\nwas downloaded from the link server. Anything that we downloaded is\nincluded.)\n\nSo, now that we've extracted the source release we built, we can try\nto install it. To do this, we'll to run the installer. Before we do,\nhowever, we'll remove the data used by the link server:\n\n >>> import os\n >>> mkdir('sample_eggs_aside')\n >>> for p in os.listdir(sample_eggs):\n ... os.rename(join(sample_eggs, p), join('sample_eggs_aside', p))\n >>> print get(link_server),\n \n \n\nThis way, we know that when we run the source release, the\ndistributions will come from the release, not from the link\nserver. Now, let's run the installer:\n\n >>> import sys\n\n >>> print system(sys.executable+' '+join('test', 'sample', 'install.py')),\n ... # doctest: +ELLIPSIS\n Creating directory ...\n\n\nRunning the installer simply builds out the saved buildout, using the\nrelease-distribution as the source for installable eggs. In our case,\nwe get a sample script that we can run:\n\n >>> print system(join('test', 'sample', 'bin', 'sample1')),\n Hello. My name is sample1\n\nNote that the sample bin directory doesn't contain a buildout script:\n\n >>> ls('test', 'sample', 'bin')\n - sample1\n\nIf we want one, we can run the install script again with an argument\nof 'bootstrap'.\n\n >>> print system(sys.executable+\n ... ' '+join('test', 'sample', 'install.py bootstrap')),\n Generated script '/sample-buildout/test/sample/bin/buildout'.\n\n >>> ls('test', 'sample', 'bin')\n - buildout\n - sample1\n\nNote that the install script is a specialized buildout script, so\nother buildout options can be provided, although this shouldn't\nnormally be necessary.\n\nOften, we'll use file URLs for testing, but store the buildouts to be\nreleased in a source code repository like subversion. We've created a\nsimple sample in subversion. Let's try to install it:\n\n >>> print system(join('bin', 'buildout-source-release')+' '+\n ... 'svn://svn.zope.org/repos/main/zc.sourcerelease/svnsample'+\n ... ' release.cfg'),\n ... # doctest: +ELLIPSIS\n Creating source release in svnsample.tgz\n ... The referenced section, 'repos', was not defined.\n\nThe svnsample config, release.cfg, has::\n\n find-links = ${repos:svnsample}\n\nHere, the expectation is that the value will be provided by a user's\ndefault.cfg. We'll provide a value that points to our link\nserver. First, we'll put the sample eggs back on the link server:\n\n >>> for p in os.listdir('sample_eggs_aside'):\n ... os.rename(join('sample_eggs_aside', p), join(sample_eggs, p))\n >>> remove('sample_eggs_aside')\n\n >>> print system(join('bin', 'buildout-source-release')+' '+\n ... 'svn://svn.zope.org/repos/main/zc.sourcerelease/svnsample'+\n ... ' release.cfg'+\n ... ' repos:svnsample='+link_server),\n ... # doctest: +ELLIPSIS\n Creating source release in svnsample.tgz\n ...\n\n >>> ls('.')\n - .installed.cfg\n d bin\n - buildout.cfg\n - custom_name_one.tgz\n - custom_name_two.tgz\n d develop-eggs\n d eggs\n d parts\n d sample\n - sample.tgz\n - svnsample.tgz\n d test\n\n >>> mkdir('svntest')\n >>> import tarfile\n >>> tf = tarfile.open('svnsample.tgz', 'r:gz')\n >>> for name in tf.getnames():\n ... tf.extract(name, 'svntest')\n >>> tf.close()\n\n >>> print system(sys.executable\n ... +' '+join('svntest', 'svnsample', 'install.py')),\n ... # doctest: +ELLIPSIS\n Creating directory ...\n\n >>> print system(join('svntest', 'svnsample', 'bin', 'sample')),\n sample from svn called\n\nYou can specify a different configuration file of course. Let's\ncreate one with an error as it contains an absolute path for the\neggs-directory.\n\n >>> write(sample, 'wrong.cfg',\n ... '''\n ... [buildout]\n ... parts = sample\n ... find-links = %(link_server)s\n ... eggs-directory = /somewhere/shared-eggs\n ...\n ... [sample]\n ... recipe = zc.recipe.egg\n ... eggs = sample1\n ... ''' % globals())\n\nWe'll run the release script against this configuration file:\n\n >>> print system(join('bin', 'buildout-source-release')\n ... +' file://'+sample+' wrong.cfg'),\n ... # doctest: +ELLIPSIS\n Creating source release in sample.tgz\n Invalid eggs directory (perhaps not a relative path) /somewhere/shared-eggs\n\n.. [#zip_in_future] It is possible that an option will be added in the\n future to generate zip files rather than tar archives.\n\n.. [#separate_install_step] In the future, it is likely that we'll\n also support a model in which the install script can install to a\n separate location. Buildouts will have to take this into account,\n providing for copying necessary files, other than just scripts and\n eggs, into the destination directory.\n\n.. [#other_source_code_control_systems] Other source\n code control systems may be supported in the future. In the mean\n time, you can check a project out to a directory and then use a file\n URL to get the buildout-source-release script to use it.\n\nRelease History\n===============\n\n0.4.0 (2012-12-17)\n------------------\n\n- Added distribute support.\n- Symbolic links in projects are preserved.\n\n\n0.3.1 (2009-09-25)\n------------------\n\nFixed a latent bug that was exposed by recent changes to zc.buildout.\n\nThe bug causes installation scripts included in source releases to fail.\n\n0.3.0 (2008-11-21)\n------------------\n\nNew Features\n++++++++++++\n\nYou can now use a --name (or -n) option to specify the name for a\ngenerated release.\n\nBugs Fixed\n++++++++++\n\nHaving an absolute eggs-directory in buildout.cfg will now give an\nerror instead of running forever trying to find a relative path.\n\n0.2 (2007-10-25)\n----------------\n\nNew Features\n++++++++++++\n\nAdded support for passing buildout option settings as command-line\noptions when building sources to supply values normally provided by\n~/.buildout/default.cfg.\n\nBugs Fixed\n++++++++++\n\nNon-standard eggs-directory settings weren't handled correctly.\n\n0.1 (2007-10-24)\n----------------\n\nInitial release\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://www.python.org/pypi/zc.sourcerelease", "keywords": null, "license": "ZPL 2.1", "maintainer": null, "maintainer_email": null, "name": "zc.sourcerelease", "package_url": "https://pypi.org/project/zc.sourcerelease/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/zc.sourcerelease/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://www.python.org/pypi/zc.sourcerelease" }, "release_url": "https://pypi.org/project/zc.sourcerelease/0.4.0/", "requires_dist": null, "requires_python": null, "summary": "Utility script to create source releases from buildouts", "version": "0.4.0" }, "last_serial": 802208, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "7341aa79322eafcc9282b8a71939af9f", "sha256": "f82cd5085424129de6f0a2be09ebb8bab13cb4fe94a9ed3dc7ef75de23e2a56e" }, "downloads": -1, "filename": "zc.sourcerelease-0.1.tar.gz", "has_sig": false, "md5_digest": "7341aa79322eafcc9282b8a71939af9f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7220, "upload_time": "2007-10-24T22:34:40", "url": "https://files.pythonhosted.org/packages/e7/b8/cb5d5ea810157bb1b6bbaf1cdcbd07d39cb90e0b722c034b32f24071e90b/zc.sourcerelease-0.1.tar.gz" } ], "0.2": [ { "comment_text": "", "digests": { "md5": "4b501d3e83c03b79dcd4e7589f3bdfc9", "sha256": "3ca73d9981028a70884dd88fa7a2b1c01b025fd224b45231652e954007137dab" }, "downloads": -1, "filename": "zc.sourcerelease-0.2.tar.gz", "has_sig": false, "md5_digest": "4b501d3e83c03b79dcd4e7589f3bdfc9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8197, "upload_time": "2007-10-25T20:37:26", "url": "https://files.pythonhosted.org/packages/d2/22/a764960a35f685ea06b949e95709ca7a9b1619cf816f0d3bf9647d21720b/zc.sourcerelease-0.2.tar.gz" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "bb0a9013c0795a49ea120ced75f1442f", "sha256": "ed63dd1a479f268d6d64b63c9976787c1e24ddec480315de50913210932a71f0" }, "downloads": -1, "filename": "zc.sourcerelease-0.3.0.tar.gz", "has_sig": false, "md5_digest": "bb0a9013c0795a49ea120ced75f1442f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8958, "upload_time": "2008-11-21T22:02:19", "url": "https://files.pythonhosted.org/packages/81/86/592faf3203d3b7981126f3cad3b17b853c9c5512cfa12a8a25c865bfb53c/zc.sourcerelease-0.3.0.tar.gz" } ], "0.3.1": [ { "comment_text": "", "digests": { "md5": "c67a87e1cc180ce2f50e3559467cfdf0", "sha256": "525046cda250884c77d3b15f3cb8c3437e3ab3480e28ad50bdb244ddd64894fd" }, "downloads": -1, "filename": "zc.sourcerelease-0.3.1.tar.gz", "has_sig": false, "md5_digest": "c67a87e1cc180ce2f50e3559467cfdf0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9218, "upload_time": "2009-09-25T17:29:24", "url": "https://files.pythonhosted.org/packages/26/4a/b70483768699b48ba4849bf69d5266cdb2b23fe169abc651fc620a4d9745/zc.sourcerelease-0.3.1.tar.gz" } ], "0.4.0": [ { "comment_text": "", "digests": { "md5": "7d756a7d039afd2a7a2fe02817317330", "sha256": "13c9766c1d9d6276a4d5be0960a7c2a19a94693948ff860d45979485d5e32eea" }, "downloads": -1, "filename": "zc.sourcerelease-0.4.0.tar.gz", "has_sig": false, "md5_digest": "7d756a7d039afd2a7a2fe02817317330", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10510, "upload_time": "2012-12-18T15:20:04", "url": "https://files.pythonhosted.org/packages/04/17/10c423c86ae7f71923c1bb7159e54660ab2e23bf0cdcf96bac1116a5fcc0/zc.sourcerelease-0.4.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "7d756a7d039afd2a7a2fe02817317330", "sha256": "13c9766c1d9d6276a4d5be0960a7c2a19a94693948ff860d45979485d5e32eea" }, "downloads": -1, "filename": "zc.sourcerelease-0.4.0.tar.gz", "has_sig": false, "md5_digest": "7d756a7d039afd2a7a2fe02817317330", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10510, "upload_time": "2012-12-18T15:20:04", "url": "https://files.pythonhosted.org/packages/04/17/10c423c86ae7f71923c1bb7159e54660ab2e23bf0cdcf96bac1116a5fcc0/zc.sourcerelease-0.4.0.tar.gz" } ] }