zc.recipe.cmmi


Namezc.recipe.cmmi JSON
Version 4.0 PyPI version JSON
download
home_pagehttp://github.com/zopefoundation/zc.recipe.cmmi
SummaryZC Buildout recipe for configure/make/make install
upload_time2023-07-07 06:30:34
maintainer
docs_urlNone
authorJim Fulton
requires_python>=3.7
licenseZPL 2.1
keywords zc.buildout buildout recipe cmmi configure make install
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            ==============================================================
 Recipe installing a download via configure/make/make install
==============================================================

The configure-make-make-install recipe automates installation of
configure-based source distribution into buildouts.

.. contents::


Options
=======

url
   The URL of a source archive to download

configure-command
   The name of the configure script.

   The option defaults to ``./configure``.

configure-options
   Basic configure options.

   Defaults to a ``--prefix`` option that points to the part directory.

extra_options
   A string of extra options to pass to configure in *addition to* the
   base options.

environment
   Optional environment variable settings of the forme NAME=VALUE.

   Newlines are ignored. Spaces may be included in environment values
   as long as they can't be mistaken for environment settings.  So::

      environment = FOO=bar
                    baz

   Sets the environment variable FOO, but::

      environment = FOO=bar xxx=baz

   Sets 2 environment values, FOO and xxx.

patch
   The name of an optional patch file to apply to the distribution.

patch_options
   Options to supply to the patch command (if a patch file is used).

   This defaults to ``-p0``

shared
   Share the build accross buildouts.

autogen
   The name of a script to run to generate a configure script.

source-directory-contains
   The name of a file in the distribution's source directory.

   This is used by the recipe to determine if it has found the source
   directory. It defaults top "configure".


.. note::

    This recipe is not expected to work in a Microsoft Windows environment.

=================
 Release History
=================

4.0 (2023-07-07)
================

- Drop support for Python 2.7, 3.5, 3.6.

- Add support for Python 3.9, 3.10, 3.11.


3.0.0 (2019-03-30)
==================

- Drop support for Python 3.4.

- Add support for Python 3.7 and 3.8a2.

- Flake8 the code.


2.0.0 (2017-06-21)
==================

- Add support for Python 3.4, 3.5, 3.6 and PyPy.

- Automated testing is enabled on Travis CI.

1.3.6 (2014-04-14)
==================

- Fixed: Strings were incorrectly compared using "is not ''" rather than !=

- Fixed: Spaces weren't allowed in the installation location.

1.3.5 (2011-08-06)
==================

- Fixed: Spaces weren't allowed in environment variables.

- Fixed: Added missing option reference documentation.


1.3.4 (2011-01-18)
==================

- Fixed a bug in location book-keeping that caused shared builds to be deleted
  from disk when a part didn't need them anymore. (#695977)

- Made tests pass with both zc.buildout 1.4 and 1.5, lifted the upper version
  bound on zc.buildout. (#695732)

1.3.3 (2010-11-10)
==================

- Remove the temporary build directory when cmmi succeeds.

- Specify that the zc.buildout version be <1.5.0b1, as the recipe is
  currently not compatible with zc.buildout 1.5.

1.3.2 (2010-08-09)
==================

- Remove the build directory for a shared build when the source cannot be
  downloaded.

- Declared a test dependency on zope.testing.


1.3.1 (2009-09-10)
==================

- Declare dependency on zc.buildout 1.4 or later. This dependency was introduced
  in version 1.3.


1.3 (2009-09-03)
================

- Use zc.buildout's download API. As this allows MD5 checking, added the
  md5sum and patch-md5sum options.

- Added options for changing the name of the configure script and
  overriding the ``--prefix`` parameter.

- Moved the core "configure; make; make install" command sequence to a
  method that can be overridden in other recipes, to support packages
  whose installation process is slightly different.

1.2.1 (2009-08-12)
==================

Bug fix: keep track of reused shared builds.


1.2.0 (2009-05-18)
==================

Enabled using a shared directory for completed builds.

1.1.6 (2009-03-17)
==================

Moved 'zc' package from root of checkout into 'src', to prevent testrunner
from finding eggs installed locally by buildout.

Removed deprecations under Python 2.6.

1.1.5 (2008-11-07)
==================

- Added to the README.txt file a link to the SVN repository, so that Setuptools
  can automatically find the development version when asked to install the
  "-dev" version of zc.recipe.cmmi.

- Applied fix for bug #261367 i.e. changed open() of file being downloaded to
  binary, so that errors like the following no longer occur under Windows.

  uncompress = self.decompress.decompress(buf)
  error: Error -3 while decompressing: invalid distance too far back

1.1.4 (2008-06-25)
==================

Add support to autogen configure files.

1.1.3 (2008-06-03)
==================

Add support for updating the environment.

1.1.2 (2008-02-28)
==================

- Check if the ``location`` folder exists before creating it.

After 1.1.0
===========

Added support for patches to be downloaded from a url rather than only using
patches on the filesystem

1.1.0
=====

Added support for:

 - download-cache: downloaded files are cached in the 'cmmi' subdirectory of
   the cache cache keys are hashes of the url that the file was downloaded from
   cache information recorded in the cache.ini file within each directory

 - offline mode: cmmi will not go online if the package is not in the cache

 - variable location: build files other than in the parts directory if required

 - additional logging/output

1.0.2 (2007-06-03)
==================

- Added support for patches.

- Tests fixed (buildout's output changed)

1.0.1 (2006-11-22)
==================

- Added missing zip_safe flag.

1.0 (2006-11-22)
================

Initial release.

======================
Detailed Documentation
======================

We have an archive with a demo foo tar ball and publish it by http in order
to see  offline effects:

    >>> ls(distros)
    -  bar.tgz
    -  baz.tgz
    -  foo.tgz

    >>> distros_url = start_server(distros)

Let's update a sample buildout to installs it:

    >>> write('buildout.cfg',
    ... """
    ... [buildout]
    ... parts = foo
    ...
    ... [foo]
    ... recipe = zc.recipe.cmmi
    ... url = %sfoo.tgz
    ... """ % distros_url)

We used the url option to specify the location of the archive.

If we run the buildout, the configure script in the archive is run.
It creates a make file which is also run:

    >>> print(system('bin/buildout').strip())
    Installing foo.
    foo: Downloading http://localhost/foo.tgz
    foo: Unpacking and configuring
    configuring foo --prefix=/sample-buildout/parts/foo
    echo building foo
    building foo
    echo installing foo
    installing foo

The recipe also creates the parts directory:

    >>> import os.path
    >>> os.path.isdir(join(sample_buildout, "parts", "foo"))
    True

If we run the buildout again, the update method will be called, which
does nothing:

    >>> print(system('bin/buildout').strip())
    Updating foo.

You can supply extra configure options:

    >>> write('buildout.cfg',
    ... """
    ... [buildout]
    ... parts = foo
    ...
    ... [foo]
    ... recipe = zc.recipe.cmmi
    ... url = %sfoo.tgz
    ... extra_options = -a -b c
    ... """ % distros_url)

    >>> print(system('bin/buildout').strip())
    Uninstalling foo.
    Installing foo.
    foo: Downloading http://localhost/foo.tgz
    foo: Unpacking and configuring
    configuring foo --prefix=/sample-buildout/parts/foo -a -b c
    echo building foo
    building foo
    echo installing foo
    installing foo

The recipe sets the location option, which can be read by other
recipes, to the location where the part is installed:

    >>> cat('.installed.cfg')
    [buildout]
    installed_develop_eggs =
    parts = foo
    <BLANKLINE>
    [foo]
	...
    location = /sample_buildout/parts/foo
	...

It may be necessary to set some environment variables when running configure
or make. This can be done by adding an environment statement:

    >>> write('buildout.cfg',
    ... """
    ... [buildout]
    ... parts = foo
    ...
    ... [foo]
    ... recipe = zc.recipe.cmmi
    ... url = %sfoo.tgz
    ... environment =
    ...   CFLAGS=-I/usr/lib/postgresql7.4/include
    ... """ % distros_url)


    >>> print(system('bin/buildout').strip())
    Uninstalling foo.
    Installing foo.
    foo: Downloading http://localhost/foo.tgz
    foo: Unpacking and configuring
    foo: Updating environment: CFLAGS=-I/usr/lib/postgresql7.4/include
    configuring foo --prefix=/sample_buildout/parts/foo
    echo building foo
    building foo
    echo installing foo
    installing foo

Sometimes it's necessary to patch the sources before building a package.
You can specify the name of the patch to apply and (optional) patch options:

First of all let's write a patchfile:

    >>> import sys
    >>> mkdir('patches')
    >>> write('patches/config.patch',
    ... """--- configure
    ... +++ /dev/null
    ... @@ -1,13 +1,13 @@
    ...  #!%s
    ...  import sys
    ... -print("configuring foo " + ' '.join(sys.argv[1:]))
    ... +print("configuring foo patched " + ' '.join(sys.argv[1:]))
    ...
    ...  Makefile_template = '''
    ...  all:
    ... -\techo building foo
    ... +\techo building foo patched
    ...
    ...  install:
    ... -\techo installing foo
    ... +\techo installing foo patched
    ...  '''
    ...
    ...  with open('Makefile', 'w') as f:
    ...      _ = f.write(Makefile_template)
    ...
    ... """ % sys.executable)

Now let's create a buildout.cfg file. Note: If no patch option is beeing
passed, -p0 is appended by default.

    >>> write('buildout.cfg',
    ... """
    ... [buildout]
    ... parts = foo
    ...
    ... [foo]
    ... recipe = zc.recipe.cmmi
    ... url = %sfoo.tgz
    ... patch = ${buildout:directory}/patches/config.patch
    ... patch_options = -p0
    ... """ % distros_url)

    >>> print(system('bin/buildout').strip())
    Uninstalling foo.
    Installing foo.
    foo: Downloading http://localhost/foo.tgz
    foo: Unpacking and configuring
    patching file configure
    ...
    configuring foo patched --prefix=/sample_buildout/parts/foo
    echo building foo patched
    building foo patched
    echo installing foo patched
    installing foo patched

It is possible to autogenerate the configure files:

    >>> write('buildout.cfg',
    ... """
    ... [buildout]
    ... parts = foo
    ...
    ... [foo]
    ... recipe = zc.recipe.cmmi
    ... url = %s/bar.tgz
    ... autogen = autogen.sh
    ... """ % distros_url)

    >>> print(system('bin/buildout').strip())
    Uninstalling foo.
    Installing foo.
    foo: Downloading http://localhost//bar.tgz
    foo: Unpacking and configuring
    foo: auto generating configure files
    configuring foo --prefix=/sample_buildout/parts/foo
    echo building foo
    building foo
    echo installing foo
    installing foo

It is also possible to support configure commands other than "./configure":

    >>> write('buildout.cfg',
    ... """
    ... [buildout]
    ... parts = foo
    ...
    ... [foo]
    ... recipe = zc.recipe.cmmi
    ... url = %s/baz.tgz
    ... source-directory-contains = configure.py
    ... configure-command = ./configure.py
    ... configure-options =
    ...     --bindir=bin
    ... """ % distros_url)

    >>> print(system('bin/buildout').strip())
    Uninstalling foo.
    Installing foo.
    foo: Downloading http://localhost//baz.tgz
    foo: Unpacking and configuring
    configuring foo --bindir=bin
    echo building foo
    building foo
    echo installing foo
    installing foo

When downloading a source archive or a patch, we can optionally make sure of
its authenticity by supplying an MD5 checksum that must be matched. If it
matches, we'll not be bothered with the check by buildout's output:

    >>> from hashlib import md5
    >>> with open(join(distros, 'foo.tgz'), 'rb') as f:
    ...     foo_md5sum = md5(f.read()).hexdigest()

    >>> write('buildout.cfg',
    ... """
    ... [buildout]
    ... parts = foo
    ...
    ... [foo]
    ... recipe = zc.recipe.cmmi
    ... url = %sfoo.tgz
    ... md5sum = %s
    ... """ % (distros_url, foo_md5sum))

    >>> print(system('bin/buildout').strip())
    Uninstalling foo.
    Installing foo.
    foo: Downloading http://localhost/foo.tgz
    foo: Unpacking and configuring
    configuring foo --prefix=/sample_buildout/parts/foo
    echo building foo
    building foo
    echo installing foo
    installing foo

But if the archive doesn't match the checksum, the recipe refuses to install:

    >>> write('buildout.cfg',
    ... """
    ... [buildout]
    ... parts = foo
    ...
    ... [foo]
    ... recipe = zc.recipe.cmmi
    ... url = %sbar.tgz
    ... md5sum = %s
    ... patch = ${buildout:directory}/patches/config.patch
    ... """ % (distros_url, foo_md5sum))

    >>> print(system('bin/buildout').strip())
    Uninstalling foo.
    Installing foo.
    foo: Downloading http://localhost:20617/bar.tgz
    While:
      Installing foo.
    Error: MD5 checksum mismatch downloading 'http://localhost/bar.tgz'

Similarly, a checksum mismatch for the patch will cause the buildout run to be
aborted:

    >>> write('buildout.cfg',
    ... """
    ... [buildout]
    ... parts = foo
    ...
    ... [foo]
    ... recipe = zc.recipe.cmmi
    ... url = %sfoo.tgz
    ... patch = ${buildout:directory}/patches/config.patch
    ... patch-md5sum = %s
    ... """ % (distros_url, foo_md5sum))

    >>> print(system('bin/buildout').strip())
    Installing foo.
    foo: Downloading http://localhost:21669/foo.tgz
    foo: Unpacking and configuring
    While:
      Installing foo.
    Error: MD5 checksum mismatch for local resource at '/.../sample-buildout/patches/config.patch'.

    >>> write('buildout.cfg',
    ... """
    ... [buildout]
    ... parts = foo
    ...
    ... [foo]
    ... recipe = zc.recipe.cmmi
    ... url = %sfoo.tgz
    ... patch = ${buildout:directory}/patches/config.patch
    ... """ % (distros_url))

If the build fails, the temporary directory where the tarball was unpacked
is logged to stdout, and left intact for debugging purposes.

    >>> write('patches/config.patch', "dgdgdfgdfg")

    >>> res =  system('bin/buildout')
    >>> print(res)
    Installing foo.
    foo: Downloading http://localhost/foo.tgz
    foo: Unpacking and configuring
    patch unexpectedly ends in middle of line
    foo: cmmi failed: /.../...buildout-foo
    patch: **** Only garbage was found in the patch input.
    While:
      Installing foo.
    <BLANKLINE>
    An internal error occurred due to a bug in either zc.buildout or in a
    recipe being used:
    ...
    subprocess.CalledProcessError: Command 'patch -p0 < ...' returned non-zero exit status ...
    <BLANKLINE>

    >>> import re
    >>> import os.path
    >>> import shutil
    >>> path = re.search('foo: cmmi failed: (.*)', res).group(1)
    >>> os.path.exists(path)
    True
    >>> shutil.rmtree(path)

After a successful build, such temporary directories are removed.

    >>> import glob
    >>> import tempfile

    >>> old_tempdir = tempfile.gettempdir()
    >>> tempdir = tempfile.tempdir = tempfile.mkdtemp(suffix='.buildout.build')
    >>> dirs = glob.glob(os.path.join(tempdir, '*buildout-foo'))

    >>> write('buildout.cfg',
    ... """
    ... [buildout]
    ... parts = foo
    ...
    ... [foo]
    ... recipe = zc.recipe.cmmi
    ... url = %sfoo.tgz
    ... """ % (distros_url,))

    >>> print(system("bin/buildout"))
    Installing foo.
    foo: Downloading http://localhost:21445/foo.tgz
    foo: Unpacking and configuring
    configuring foo --prefix=/sample_buildout/parts/foo
    echo building foo
    building foo
    echo installing foo
    installing foo
    <BLANKLINE>

    >>> new_dirs = glob.glob(os.path.join(tempdir, '*buildout-foo'))
    >>> len(dirs) == len(new_dirs) == 0
    True
    >>> tempfile.tempdir = old_tempdir

==============
Download Cache
==============
The recipe supports use of a download cache in the same way
as zc.buildout. See downloadcache.txt for details


            

Raw data

            {
    "_id": null,
    "home_page": "http://github.com/zopefoundation/zc.recipe.cmmi",
    "name": "zc.recipe.cmmi",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "zc.buildout buildout recipe cmmi configure make install",
    "author": "Jim Fulton",
    "author_email": "jim@zope.com",
    "download_url": "https://files.pythonhosted.org/packages/75/19/8b70889d8a02d9c9a09102d0f17b771c88cf1733641a6da723187d8721be/zc.recipe.cmmi-4.0.tar.gz",
    "platform": null,
    "description": "==============================================================\n Recipe installing a download via configure/make/make install\n==============================================================\n\nThe configure-make-make-install recipe automates installation of\nconfigure-based source distribution into buildouts.\n\n.. contents::\n\n\nOptions\n=======\n\nurl\n   The URL of a source archive to download\n\nconfigure-command\n   The name of the configure script.\n\n   The option defaults to ``./configure``.\n\nconfigure-options\n   Basic configure options.\n\n   Defaults to a ``--prefix`` option that points to the part directory.\n\nextra_options\n   A string of extra options to pass to configure in *addition to* the\n   base options.\n\nenvironment\n   Optional environment variable settings of the forme NAME=VALUE.\n\n   Newlines are ignored. Spaces may be included in environment values\n   as long as they can't be mistaken for environment settings.  So::\n\n      environment = FOO=bar\n                    baz\n\n   Sets the environment variable FOO, but::\n\n      environment = FOO=bar xxx=baz\n\n   Sets 2 environment values, FOO and xxx.\n\npatch\n   The name of an optional patch file to apply to the distribution.\n\npatch_options\n   Options to supply to the patch command (if a patch file is used).\n\n   This defaults to ``-p0``\n\nshared\n   Share the build accross buildouts.\n\nautogen\n   The name of a script to run to generate a configure script.\n\nsource-directory-contains\n   The name of a file in the distribution's source directory.\n\n   This is used by the recipe to determine if it has found the source\n   directory. It defaults top \"configure\".\n\n\n.. note::\n\n    This recipe is not expected to work in a Microsoft Windows environment.\n\n=================\n Release History\n=================\n\n4.0 (2023-07-07)\n================\n\n- Drop support for Python 2.7, 3.5, 3.6.\n\n- Add support for Python 3.9, 3.10, 3.11.\n\n\n3.0.0 (2019-03-30)\n==================\n\n- Drop support for Python 3.4.\n\n- Add support for Python 3.7 and 3.8a2.\n\n- Flake8 the code.\n\n\n2.0.0 (2017-06-21)\n==================\n\n- Add support for Python 3.4, 3.5, 3.6 and PyPy.\n\n- Automated testing is enabled on Travis CI.\n\n1.3.6 (2014-04-14)\n==================\n\n- Fixed: Strings were incorrectly compared using \"is not ''\" rather than !=\n\n- Fixed: Spaces weren't allowed in the installation location.\n\n1.3.5 (2011-08-06)\n==================\n\n- Fixed: Spaces weren't allowed in environment variables.\n\n- Fixed: Added missing option reference documentation.\n\n\n1.3.4 (2011-01-18)\n==================\n\n- Fixed a bug in location book-keeping that caused shared builds to be deleted\n  from disk when a part didn't need them anymore. (#695977)\n\n- Made tests pass with both zc.buildout 1.4 and 1.5, lifted the upper version\n  bound on zc.buildout. (#695732)\n\n1.3.3 (2010-11-10)\n==================\n\n- Remove the temporary build directory when cmmi succeeds.\n\n- Specify that the zc.buildout version be <1.5.0b1, as the recipe is\n  currently not compatible with zc.buildout 1.5.\n\n1.3.2 (2010-08-09)\n==================\n\n- Remove the build directory for a shared build when the source cannot be\n  downloaded.\n\n- Declared a test dependency on zope.testing.\n\n\n1.3.1 (2009-09-10)\n==================\n\n- Declare dependency on zc.buildout 1.4 or later. This dependency was introduced\n  in version 1.3.\n\n\n1.3 (2009-09-03)\n================\n\n- Use zc.buildout's download API. As this allows MD5 checking, added the\n  md5sum and patch-md5sum options.\n\n- Added options for changing the name of the configure script and\n  overriding the ``--prefix`` parameter.\n\n- Moved the core \"configure; make; make install\" command sequence to a\n  method that can be overridden in other recipes, to support packages\n  whose installation process is slightly different.\n\n1.2.1 (2009-08-12)\n==================\n\nBug fix: keep track of reused shared builds.\n\n\n1.2.0 (2009-05-18)\n==================\n\nEnabled using a shared directory for completed builds.\n\n1.1.6 (2009-03-17)\n==================\n\nMoved 'zc' package from root of checkout into 'src', to prevent testrunner\nfrom finding eggs installed locally by buildout.\n\nRemoved deprecations under Python 2.6.\n\n1.1.5 (2008-11-07)\n==================\n\n- Added to the README.txt file a link to the SVN repository, so that Setuptools\n  can automatically find the development version when asked to install the\n  \"-dev\" version of zc.recipe.cmmi.\n\n- Applied fix for bug #261367 i.e. changed open() of file being downloaded to\n  binary, so that errors like the following no longer occur under Windows.\n\n  uncompress = self.decompress.decompress(buf)\n  error: Error -3 while decompressing: invalid distance too far back\n\n1.1.4 (2008-06-25)\n==================\n\nAdd support to autogen configure files.\n\n1.1.3 (2008-06-03)\n==================\n\nAdd support for updating the environment.\n\n1.1.2 (2008-02-28)\n==================\n\n- Check if the ``location`` folder exists before creating it.\n\nAfter 1.1.0\n===========\n\nAdded support for patches to be downloaded from a url rather than only using\npatches on the filesystem\n\n1.1.0\n=====\n\nAdded support for:\n\n - download-cache: downloaded files are cached in the 'cmmi' subdirectory of\n   the cache cache keys are hashes of the url that the file was downloaded from\n   cache information recorded in the cache.ini file within each directory\n\n - offline mode: cmmi will not go online if the package is not in the cache\n\n - variable location: build files other than in the parts directory if required\n\n - additional logging/output\n\n1.0.2 (2007-06-03)\n==================\n\n- Added support for patches.\n\n- Tests fixed (buildout's output changed)\n\n1.0.1 (2006-11-22)\n==================\n\n- Added missing zip_safe flag.\n\n1.0 (2006-11-22)\n================\n\nInitial release.\n\n======================\nDetailed Documentation\n======================\n\nWe have an archive with a demo foo tar ball and publish it by http in order\nto see  offline effects:\n\n    >>> ls(distros)\n    -  bar.tgz\n    -  baz.tgz\n    -  foo.tgz\n\n    >>> distros_url = start_server(distros)\n\nLet's update a sample buildout to installs it:\n\n    >>> write('buildout.cfg',\n    ... \"\"\"\n    ... [buildout]\n    ... parts = foo\n    ...\n    ... [foo]\n    ... recipe = zc.recipe.cmmi\n    ... url = %sfoo.tgz\n    ... \"\"\" % distros_url)\n\nWe used the url option to specify the location of the archive.\n\nIf we run the buildout, the configure script in the archive is run.\nIt creates a make file which is also run:\n\n    >>> print(system('bin/buildout').strip())\n    Installing foo.\n    foo: Downloading http://localhost/foo.tgz\n    foo: Unpacking and configuring\n    configuring foo --prefix=/sample-buildout/parts/foo\n    echo building foo\n    building foo\n    echo installing foo\n    installing foo\n\nThe recipe also creates the parts directory:\n\n    >>> import os.path\n    >>> os.path.isdir(join(sample_buildout, \"parts\", \"foo\"))\n    True\n\nIf we run the buildout again, the update method will be called, which\ndoes nothing:\n\n    >>> print(system('bin/buildout').strip())\n    Updating foo.\n\nYou can supply extra configure options:\n\n    >>> write('buildout.cfg',\n    ... \"\"\"\n    ... [buildout]\n    ... parts = foo\n    ...\n    ... [foo]\n    ... recipe = zc.recipe.cmmi\n    ... url = %sfoo.tgz\n    ... extra_options = -a -b c\n    ... \"\"\" % distros_url)\n\n    >>> print(system('bin/buildout').strip())\n    Uninstalling foo.\n    Installing foo.\n    foo: Downloading http://localhost/foo.tgz\n    foo: Unpacking and configuring\n    configuring foo --prefix=/sample-buildout/parts/foo -a -b c\n    echo building foo\n    building foo\n    echo installing foo\n    installing foo\n\nThe recipe sets the location option, which can be read by other\nrecipes, to the location where the part is installed:\n\n    >>> cat('.installed.cfg')\n    [buildout]\n    installed_develop_eggs =\n    parts = foo\n    <BLANKLINE>\n    [foo]\n\t...\n    location = /sample_buildout/parts/foo\n\t...\n\nIt may be necessary to set some environment variables when running configure\nor make. This can be done by adding an environment statement:\n\n    >>> write('buildout.cfg',\n    ... \"\"\"\n    ... [buildout]\n    ... parts = foo\n    ...\n    ... [foo]\n    ... recipe = zc.recipe.cmmi\n    ... url = %sfoo.tgz\n    ... environment =\n    ...   CFLAGS=-I/usr/lib/postgresql7.4/include\n    ... \"\"\" % distros_url)\n\n\n    >>> print(system('bin/buildout').strip())\n    Uninstalling foo.\n    Installing foo.\n    foo: Downloading http://localhost/foo.tgz\n    foo: Unpacking and configuring\n    foo: Updating environment: CFLAGS=-I/usr/lib/postgresql7.4/include\n    configuring foo --prefix=/sample_buildout/parts/foo\n    echo building foo\n    building foo\n    echo installing foo\n    installing foo\n\nSometimes it's necessary to patch the sources before building a package.\nYou can specify the name of the patch to apply and (optional) patch options:\n\nFirst of all let's write a patchfile:\n\n    >>> import sys\n    >>> mkdir('patches')\n    >>> write('patches/config.patch',\n    ... \"\"\"--- configure\n    ... +++ /dev/null\n    ... @@ -1,13 +1,13 @@\n    ...  #!%s\n    ...  import sys\n    ... -print(\"configuring foo \" + ' '.join(sys.argv[1:]))\n    ... +print(\"configuring foo patched \" + ' '.join(sys.argv[1:]))\n    ...\n    ...  Makefile_template = '''\n    ...  all:\n    ... -\\techo building foo\n    ... +\\techo building foo patched\n    ...\n    ...  install:\n    ... -\\techo installing foo\n    ... +\\techo installing foo patched\n    ...  '''\n    ...\n    ...  with open('Makefile', 'w') as f:\n    ...      _ = f.write(Makefile_template)\n    ...\n    ... \"\"\" % sys.executable)\n\nNow let's create a buildout.cfg file. Note: If no patch option is beeing\npassed, -p0 is appended by default.\n\n    >>> write('buildout.cfg',\n    ... \"\"\"\n    ... [buildout]\n    ... parts = foo\n    ...\n    ... [foo]\n    ... recipe = zc.recipe.cmmi\n    ... url = %sfoo.tgz\n    ... patch = ${buildout:directory}/patches/config.patch\n    ... patch_options = -p0\n    ... \"\"\" % distros_url)\n\n    >>> print(system('bin/buildout').strip())\n    Uninstalling foo.\n    Installing foo.\n    foo: Downloading http://localhost/foo.tgz\n    foo: Unpacking and configuring\n    patching file configure\n    ...\n    configuring foo patched --prefix=/sample_buildout/parts/foo\n    echo building foo patched\n    building foo patched\n    echo installing foo patched\n    installing foo patched\n\nIt is possible to autogenerate the configure files:\n\n    >>> write('buildout.cfg',\n    ... \"\"\"\n    ... [buildout]\n    ... parts = foo\n    ...\n    ... [foo]\n    ... recipe = zc.recipe.cmmi\n    ... url = %s/bar.tgz\n    ... autogen = autogen.sh\n    ... \"\"\" % distros_url)\n\n    >>> print(system('bin/buildout').strip())\n    Uninstalling foo.\n    Installing foo.\n    foo: Downloading http://localhost//bar.tgz\n    foo: Unpacking and configuring\n    foo: auto generating configure files\n    configuring foo --prefix=/sample_buildout/parts/foo\n    echo building foo\n    building foo\n    echo installing foo\n    installing foo\n\nIt is also possible to support configure commands other than \"./configure\":\n\n    >>> write('buildout.cfg',\n    ... \"\"\"\n    ... [buildout]\n    ... parts = foo\n    ...\n    ... [foo]\n    ... recipe = zc.recipe.cmmi\n    ... url = %s/baz.tgz\n    ... source-directory-contains = configure.py\n    ... configure-command = ./configure.py\n    ... configure-options =\n    ...     --bindir=bin\n    ... \"\"\" % distros_url)\n\n    >>> print(system('bin/buildout').strip())\n    Uninstalling foo.\n    Installing foo.\n    foo: Downloading http://localhost//baz.tgz\n    foo: Unpacking and configuring\n    configuring foo --bindir=bin\n    echo building foo\n    building foo\n    echo installing foo\n    installing foo\n\nWhen downloading a source archive or a patch, we can optionally make sure of\nits authenticity by supplying an MD5 checksum that must be matched. If it\nmatches, we'll not be bothered with the check by buildout's output:\n\n    >>> from hashlib import md5\n    >>> with open(join(distros, 'foo.tgz'), 'rb') as f:\n    ...     foo_md5sum = md5(f.read()).hexdigest()\n\n    >>> write('buildout.cfg',\n    ... \"\"\"\n    ... [buildout]\n    ... parts = foo\n    ...\n    ... [foo]\n    ... recipe = zc.recipe.cmmi\n    ... url = %sfoo.tgz\n    ... md5sum = %s\n    ... \"\"\" % (distros_url, foo_md5sum))\n\n    >>> print(system('bin/buildout').strip())\n    Uninstalling foo.\n    Installing foo.\n    foo: Downloading http://localhost/foo.tgz\n    foo: Unpacking and configuring\n    configuring foo --prefix=/sample_buildout/parts/foo\n    echo building foo\n    building foo\n    echo installing foo\n    installing foo\n\nBut if the archive doesn't match the checksum, the recipe refuses to install:\n\n    >>> write('buildout.cfg',\n    ... \"\"\"\n    ... [buildout]\n    ... parts = foo\n    ...\n    ... [foo]\n    ... recipe = zc.recipe.cmmi\n    ... url = %sbar.tgz\n    ... md5sum = %s\n    ... patch = ${buildout:directory}/patches/config.patch\n    ... \"\"\" % (distros_url, foo_md5sum))\n\n    >>> print(system('bin/buildout').strip())\n    Uninstalling foo.\n    Installing foo.\n    foo: Downloading http://localhost:20617/bar.tgz\n    While:\n      Installing foo.\n    Error: MD5 checksum mismatch downloading 'http://localhost/bar.tgz'\n\nSimilarly, a checksum mismatch for the patch will cause the buildout run to be\naborted:\n\n    >>> write('buildout.cfg',\n    ... \"\"\"\n    ... [buildout]\n    ... parts = foo\n    ...\n    ... [foo]\n    ... recipe = zc.recipe.cmmi\n    ... url = %sfoo.tgz\n    ... patch = ${buildout:directory}/patches/config.patch\n    ... patch-md5sum = %s\n    ... \"\"\" % (distros_url, foo_md5sum))\n\n    >>> print(system('bin/buildout').strip())\n    Installing foo.\n    foo: Downloading http://localhost:21669/foo.tgz\n    foo: Unpacking and configuring\n    While:\n      Installing foo.\n    Error: MD5 checksum mismatch for local resource at '/.../sample-buildout/patches/config.patch'.\n\n    >>> write('buildout.cfg',\n    ... \"\"\"\n    ... [buildout]\n    ... parts = foo\n    ...\n    ... [foo]\n    ... recipe = zc.recipe.cmmi\n    ... url = %sfoo.tgz\n    ... patch = ${buildout:directory}/patches/config.patch\n    ... \"\"\" % (distros_url))\n\nIf the build fails, the temporary directory where the tarball was unpacked\nis logged to stdout, and left intact for debugging purposes.\n\n    >>> write('patches/config.patch', \"dgdgdfgdfg\")\n\n    >>> res =  system('bin/buildout')\n    >>> print(res)\n    Installing foo.\n    foo: Downloading http://localhost/foo.tgz\n    foo: Unpacking and configuring\n    patch unexpectedly ends in middle of line\n    foo: cmmi failed: /.../...buildout-foo\n    patch: **** Only garbage was found in the patch input.\n    While:\n      Installing foo.\n    <BLANKLINE>\n    An internal error occurred due to a bug in either zc.buildout or in a\n    recipe being used:\n    ...\n    subprocess.CalledProcessError: Command 'patch -p0 < ...' returned non-zero exit status ...\n    <BLANKLINE>\n\n    >>> import re\n    >>> import os.path\n    >>> import shutil\n    >>> path = re.search('foo: cmmi failed: (.*)', res).group(1)\n    >>> os.path.exists(path)\n    True\n    >>> shutil.rmtree(path)\n\nAfter a successful build, such temporary directories are removed.\n\n    >>> import glob\n    >>> import tempfile\n\n    >>> old_tempdir = tempfile.gettempdir()\n    >>> tempdir = tempfile.tempdir = tempfile.mkdtemp(suffix='.buildout.build')\n    >>> dirs = glob.glob(os.path.join(tempdir, '*buildout-foo'))\n\n    >>> write('buildout.cfg',\n    ... \"\"\"\n    ... [buildout]\n    ... parts = foo\n    ...\n    ... [foo]\n    ... recipe = zc.recipe.cmmi\n    ... url = %sfoo.tgz\n    ... \"\"\" % (distros_url,))\n\n    >>> print(system(\"bin/buildout\"))\n    Installing foo.\n    foo: Downloading http://localhost:21445/foo.tgz\n    foo: Unpacking and configuring\n    configuring foo --prefix=/sample_buildout/parts/foo\n    echo building foo\n    building foo\n    echo installing foo\n    installing foo\n    <BLANKLINE>\n\n    >>> new_dirs = glob.glob(os.path.join(tempdir, '*buildout-foo'))\n    >>> len(dirs) == len(new_dirs) == 0\n    True\n    >>> tempfile.tempdir = old_tempdir\n\n==============\nDownload Cache\n==============\nThe recipe supports use of a download cache in the same way\nas zc.buildout. See downloadcache.txt for details\n\n",
    "bugtrack_url": null,
    "license": "ZPL 2.1",
    "summary": "ZC Buildout recipe for configure/make/make install",
    "version": "4.0",
    "project_urls": {
        "Homepage": "http://github.com/zopefoundation/zc.recipe.cmmi"
    },
    "split_keywords": [
        "zc.buildout",
        "buildout",
        "recipe",
        "cmmi",
        "configure",
        "make",
        "install"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9275b7a6bb6937e8a75ab4975634b7b58bfb7ec039e788a14bc60c542f69553e",
                "md5": "79d8635771d21c97482d2203295d0030",
                "sha256": "89e282ab280873f6492c942ced9330f7c9bf1984a2e492877f4a42befcb838bb"
            },
            "downloads": -1,
            "filename": "zc.recipe.cmmi-4.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "79d8635771d21c97482d2203295d0030",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 21944,
            "upload_time": "2023-07-07T06:30:32",
            "upload_time_iso_8601": "2023-07-07T06:30:32.071587Z",
            "url": "https://files.pythonhosted.org/packages/92/75/b7a6bb6937e8a75ab4975634b7b58bfb7ec039e788a14bc60c542f69553e/zc.recipe.cmmi-4.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "75198b70889d8a02d9c9a09102d0f17b771c88cf1733641a6da723187d8721be",
                "md5": "72e7bf29981f89d144c71689423fef6c",
                "sha256": "75c717974656a7b4a1111cafffd15f8854d50f6d7bdc3059f6c1b089ef4c1e27"
            },
            "downloads": -1,
            "filename": "zc.recipe.cmmi-4.0.tar.gz",
            "has_sig": false,
            "md5_digest": "72e7bf29981f89d144c71689423fef6c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 23416,
            "upload_time": "2023-07-07T06:30:34",
            "upload_time_iso_8601": "2023-07-07T06:30:34.443137Z",
            "url": "https://files.pythonhosted.org/packages/75/19/8b70889d8a02d9c9a09102d0f17b771c88cf1733641a6da723187d8721be/zc.recipe.cmmi-4.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-07-07 06:30:34",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "zopefoundation",
    "github_project": "zc.recipe.cmmi",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "tox": true,
    "lcname": "zc.recipe.cmmi"
}
        
Elapsed time: 0.08734s