Commit 459de3ca authored by Jim Fulton's avatar Jim Fulton Committed by GitHub

Lighten doc examples by using bobo rather than ZEO (#351)

* Use bobo rather than ZEO in tests of docs

To make the tests more lightweight, because bobo is much smaller.

To allow people without the ability to build extensions to follow along.

* Fixed: test index (used for testing docs) was set to wrong path

* I want to see which tests are being run
parent 62acdf1c
...@@ -51,4 +51,4 @@ clean: ...@@ -51,4 +51,4 @@ clean:
rm -rf $(BUILD_DIRS) $(PYTHON_BUILD_DIR) rm -rf $(BUILD_DIRS) $(PYTHON_BUILD_DIR)
test: test:
$(HERE)/bin/test -1 -v $(HERE)/bin/test -1 -vvv
...@@ -65,7 +65,7 @@ with a parts option. If we run Buildout: ...@@ -65,7 +65,7 @@ with a parts option. If we run Buildout:
TODO: fix upgrading so eggs is empty TODO: fix upgrading so eggs is empty
>>> nope('ZEO' in ls('eggs')) >>> nope('bobo' in ls('eggs'))
Four directories are created: Four directories are created:
...@@ -97,29 +97,29 @@ parameters to control how the part is built. ...@@ -97,29 +97,29 @@ parameters to control how the part is built.
Installing software Installing software
=================== ===================
In this tutorial, we're going to install a simple database server. In this tutorial, we're going to install a simple web server.
The details of the server aren't important. It just provides a useful The details of the server aren't important. It just provides a useful
example that illustrates a number of ways that Buildout can make example that illustrates a number of ways that Buildout can make
things easier. things easier.
We'll start by adding a part to install the server software. We'll We'll start by adding a part to install the server software. We'll
update our Buildout configuration to add a ``zeo`` part: update our Buildout configuration to add a ``bobo`` part:
.. code-block:: ini .. code-block:: ini
[buildout] [buildout]
parts = zeo parts = bobo
[zeo] [bobo]
recipe = zc.recipe.egg recipe = zc.recipe.egg
eggs = ZEO eggs = bobo
.. -> src .. -> src
>>> write(src, 'buildout.cfg') >>> write(src, 'buildout.cfg')
We added the part name, ``zeo`` to the ``parts`` option in the We added the part name, ``bobo`` to the ``parts`` option in the
``buildout`` section. We also added a ``zeo`` section with two ``buildout`` section. We also added a ``bobo`` section with two
options: options:
recipe recipe
...@@ -138,7 +138,7 @@ eggs ...@@ -138,7 +138,7 @@ eggs
addition, any scripts provided by the listed requirements (but not addition, any scripts provided by the listed requirements (but not
their dependencies) are installed in the ``bin`` directory. their dependencies) are installed in the ``bin`` directory.
If we run this [#gcc]_: If we run this:
.. code-block:: console .. code-block:: console
...@@ -153,7 +153,7 @@ Then a number of things will happen: ...@@ -153,7 +153,7 @@ Then a number of things will happen:
- ``zc.recipe.egg`` will be downloaded and installed in your ``eggs`` - ``zc.recipe.egg`` will be downloaded and installed in your ``eggs``
directory. directory.
- ``ZEO`` and its dependencies will be downloaded and installed. (ZEO - ``bobo`` and its dependencies will be downloaded and installed. (bobo
is a small Python database server.) is a small Python database server.)
After this, the eggs directory will look something like: After this, the eggs directory will look something like:
...@@ -162,46 +162,32 @@ Then a number of things will happen: ...@@ -162,46 +162,32 @@ Then a number of things will happen:
$ ls -l eggs $ ls -l eggs
total 0 total 0
drwxr-xr-x 4 jim staff 136 Feb 15 13:06 ZConfig-3.1.0-py3.5.egg drwxr-xr-x 4 jim staff 136 Feb 23 09:01 WebOb-1.7.1-py2.7.egg
drwxr-xr-x 4 jim staff 136 Feb 15 13:06 ZEO-5.0.4-py3.5.egg drwxr-xr-x 9 jim staff 306 Feb 23 09:10 bobo-2.3.0-py2.7.egg
drwxr-xr-x 4 jim staff 136 Feb 15 13:06 ZODB-5.2.0-py3.5.egg
drwxr-xr-x 4 jim staff 136 Feb 15 13:06 persistent-4.2.2-py3.5-macosx-10.10-x86_64.egg
drwxr-xr-x 5 jim staff 170 Feb 15 13:06 six-1.10.0-py3.5.egg
drwx------ 2 jim staff 68 Feb 15 13:06 tmpd_xxokys
drwxr-xr-x 4 jim staff 136 Feb 15 13:06 transaction-2.1.0-py3.5.egg
drwxr-xr-x 4 jim staff 136 Feb 15 13:06 zc.buildout-2.8.0-py3.5.egg
drwxr-xr-x 4 jim staff 136 Feb 15 13:06 zc.lockfile-1.2.1-py3.5.egg
drwxr-xr-x 4 jim staff 136 Feb 15 13:06 zc.recipe.egg-2.0.3-py3.5.egg
drwxr-xr-x 4 jim staff 136 Feb 15 13:06 zdaemon-4.2.0-py3.5.egg
drwxr-xr-x 4 jim staff 136 Feb 15 13:06 zodbpickle-0.6.0-py3.5-macosx-10.10-x86_64.egg
drwxr-xr-x 4 jim staff 136 Feb 15 13:06 zope.interface-4.3.3-py3.5-macosx-10.10-x86_64.egg
.. bobo in eggs:
.. ZEO in eggs: >>> yup([n for n in ls('eggs') if n.startswith('bobo-2.3.0-')])
>>> yup([n for n in ls('eggs') if n.startswith('ZEO-4.3.1-')]) - A ``bobo`` script will be installed in the ``bin`` directory:
- A number of scripts will be installed in the ``bin`` directory:
.. code-block:: console .. code-block:: console
$ ls -l bin $ ls -l bin
total 40 total 8
-rwxr-xr-x 1 jim staff 861 Feb 15 13:07 runzeo -rwxr-xr-x 1 jim staff 391 Feb 23 09:10 bobo
-rwxr-xr-x 1 jim staff 861 Feb 15 13:07 zeo-nagios
-rwxr-xr-x 1 jim staff 861 Feb 15 13:07 zeoctl
-rwxr-xr-x 1 jim staff 879 Feb 15 13:07 zeopack
One in particular, ``runzeo`` is used to run a ZEO server. This script is used to `run a bobo server
<http://bobo.readthedocs.io/en/latest/reference.html#the-bobo-server>`_.
.. Really? .. Really?
>>> yup('runzeo' in ls('bin')) >>> yup('bobo' in ls('bin'))
Generating configuration and custom scripts Generating configuration and custom scripts
=========================================== ===========================================
The ``runzeo`` program doesn't daemonize itself. Rather, it's meant to The ``bobo`` program doesn't daemonize itself. Rather, it's meant to
be used with a dedicated daemonizer like `zdaemon be used with a dedicated daemonizer like `zdaemon
<https://pypi.python.org/pypi/zdaemon>`_ or `supervisord <https://pypi.python.org/pypi/zdaemon>`_ or `supervisord
<http://supervisord.org/>`_. We'll use a `recipe to set up zdaemon <http://supervisord.org/>`_. We'll use a `recipe to set up zdaemon
...@@ -211,18 +197,18 @@ configuration becomes: ...@@ -211,18 +197,18 @@ configuration becomes:
.. code-block:: ini .. code-block:: ini
[buildout] [buildout]
parts = zeo server parts = bobo server
[zeo] [bobo]
recipe = zc.recipe.egg recipe = zc.recipe.egg
eggs = ZEO eggs = bobo
[server] [server]
recipe = zc.zdaemonrecipe recipe = zc.zdaemonrecipe
program = program =
${buildout:bin-directory}/runzeo ${buildout:bin-directory}/bobo
-f ${buildout:directory}/data.fs --static /=${buildout:directory}
-a 127.0.0.1:8200 --port 8200
.. -> src .. -> src
...@@ -307,7 +293,7 @@ If we run Buildout: ...@@ -307,7 +293,7 @@ If we run Buildout:
<runner> <runner>
daemon on daemon on
directory /Users/jim/t/0214/parts/server directory /Users/jim/t/0214/parts/server
program /Users/jim/t/0214/bin/runzeo -f /Users/jim/t/0214/data.fs -a 127.0.0.1:8200 program /Users/jim/t/0214/bin/bobo --static /=/Users/jim/t/0214 --port 8200
socket-name /Users/jim/t/0214/parts/server/zdaemon.sock socket-name /Users/jim/t/0214/parts/server/zdaemon.sock
transcript /Users/jim/t/0214/parts/server/transcript.log transcript /Users/jim/t/0214/parts/server/transcript.log
</runner> </runner>
...@@ -425,15 +411,15 @@ where you list them, as in: ...@@ -425,15 +411,15 @@ where you list them, as in:
.. code-block:: ini .. code-block:: ini
[zeo] [bobo]
recipe = zc.recipe.egg recipe = zc.recipe.egg
eggs = ZEO <5.0 eggs = bobo <5.0
.. -> src .. -> src
>>> prefix = """ >>> prefix = """
... [buildout] ... [buildout]
... parts = zeo ... parts = bobo
... """ ... """
>>> with open('buildout.cfg', 'w') as f: >>> with open('buildout.cfg', 'w') as f:
... _ = f.write(prefix) ... _ = f.write(prefix)
...@@ -442,39 +428,39 @@ where you list them, as in: ...@@ -442,39 +428,39 @@ where you list them, as in:
>>> import shutil >>> import shutil
>>> shutil.rmtree('eggs') >>> shutil.rmtree('eggs')
>>> run_buildout('buildout show-picked-versions=true') >>> run_buildout('buildout show-picked-versions=true')
>>> yup([n for n in ls('eggs') if n.startswith('ZEO-4.3.1-')]) >>> yup([n for n in ls('eggs') if n.startswith('bobo-2.3.0-')])
>>> yup('ZEO = 4.3.1' in read('out')) >>> yup('bobo = 2.3.0' in read('out'))
In this example, we've requested a version of ZEO less than 5.0. In this example, we've requested a version of bobo less than 5.0.
The more common way to pin version is using a ``versions`` section: The more common way to pin version is using a ``versions`` section:
.. code-block:: ini .. code-block:: ini
[buildout] [buildout]
parts = zeo server parts = bobo server
[zeo] [bobo]
recipe = zc.recipe.egg recipe = zc.recipe.egg
eggs = ZEO eggs = bobo
[server] [server]
recipe = zc.zdaemonrecipe recipe = zc.zdaemonrecipe
program = program =
${buildout:bin-directory}/runzeo ${buildout:bin-directory}/bobo
-f ${buildout:directory}/data.fs --static /=${buildout:directory}
-a 127.0.0.1:8200 --port 8200
[versions] [versions]
ZEO = 4.3.1 bobo = 2.3.0
.. -> src .. -> src
>>> write(src, 'buildout.cfg') >>> write(src, 'buildout.cfg')
>>> shutil.rmtree('eggs') >>> shutil.rmtree('eggs')
>>> run_buildout('buildout show-picked-versions=true') >>> run_buildout('buildout show-picked-versions=true')
>>> yup([n for n in ls('eggs') if n.startswith('ZEO-4.3.1-')]) >>> yup([n for n in ls('eggs') if n.startswith('bobo-2.3.0-')])
>>> nope('ZEO = 4.3.1' in read('out')) >>> nope('bobo = 2.3.0' in read('out'))
Larger projects may need to pin many versions, so it's common to put Larger projects may need to pin many versions, so it's common to put
versions in their own file: versions in their own file:
...@@ -483,18 +469,18 @@ versions in their own file: ...@@ -483,18 +469,18 @@ versions in their own file:
[buildout] [buildout]
extends = versions.cfg extends = versions.cfg
parts = zeo server parts = bobo server
[zeo] [bobo]
recipe = zc.recipe.egg recipe = zc.recipe.egg
eggs = ZEO eggs = bobo
[server] [server]
recipe = zc.zdaemonrecipe recipe = zc.zdaemonrecipe
program = program =
${buildout:bin-directory}/runzeo ${buildout:bin-directory}/bobo
-f ${buildout:directory}/data.fs --static /=${buildout:directory}
-a 127.0.0.1:8200 --port 8200
.. -> src .. -> src
...@@ -509,15 +495,15 @@ might look like: ...@@ -509,15 +495,15 @@ might look like:
.. code-block:: ini .. code-block:: ini
[versions] [versions]
ZEO = 4.3.1 bobo = 2.3.0
.. -> versions_cfg .. -> versions_cfg
>>> write(versions_cfg, 'versions.cfg') >>> write(versions_cfg, 'versions.cfg')
>>> shutil.rmtree('eggs') >>> shutil.rmtree('eggs')
>>> run_buildout('buildout show-picked-versions=true') >>> run_buildout('buildout show-picked-versions=true')
>>> yup([n for n in ls('eggs') if n.startswith('ZEO-4.3.1-')]) >>> yup([n for n in ls('eggs') if n.startswith('bobo-2.3.0-')])
>>> nope('ZEO = 4.3.1' in read('out')) >>> nope('bobo = 2.3.0' in read('out'))
We can use the ``update-versions-file`` option to ask Buildout to We can use the ``update-versions-file`` option to ask Buildout to
maintain our ``versions.cfg`` file for us: maintain our ``versions.cfg`` file for us:
...@@ -529,26 +515,26 @@ maintain our ``versions.cfg`` file for us: ...@@ -529,26 +515,26 @@ maintain our ``versions.cfg`` file for us:
show-picked-versions = true show-picked-versions = true
update-versions-file = versions.cfg update-versions-file = versions.cfg
parts = zeo server parts = bobo server
[zeo] [bobo]
recipe = zc.recipe.egg recipe = zc.recipe.egg
eggs = ZEO eggs = bobo
[server] [server]
recipe = zc.zdaemonrecipe recipe = zc.zdaemonrecipe
program = program =
${buildout:bin-directory}/runzeo ${buildout:bin-directory}/bobo
-f ${buildout:directory}/data.fs --static /=${buildout:directory}
-a 127.0.0.1:8200 --port 8200
.. -> src .. -> src
>>> write(src, 'buildout.cfg') >>> write(src, 'buildout.cfg')
>>> eq(versions_cfg, read('versions.cfg')) >>> eq(versions_cfg, read('versions.cfg'))
>>> run_buildout('buildout show-picked-versions=true') >>> run_buildout('buildout show-picked-versions=true')
>>> yup([n for n in ls('eggs') if n.startswith('ZEO-4.3.1-')]) >>> yup([n for n in ls('eggs') if n.startswith('bobo-2.3.0-')])
>>> yup('ZODB = ' in read('versions.cfg')) >>> yup('WebOb = ' in read('versions.cfg'))
With ``update-versions-file``, whenever Buildout gets the newest With ``update-versions-file``, whenever Buildout gets the newest
version for a requirement (subject to requirement constraints), it version for a requirement (subject to requirement constraints), it
...@@ -658,7 +644,7 @@ Fortunately, an application setup script can be minimal. Here's an ...@@ -658,7 +644,7 @@ Fortunately, an application setup script can be minimal. Here's an
example:: example::
from setuptools import setup from setuptools import setup
setup(name='main', install_requires = ['ZODB', 'six']) setup(name='main', install_requires = ['bobo', 'six'])
.. -> src .. -> src
...@@ -754,10 +740,7 @@ details, as well as let you know about features not touched on here. ...@@ -754,10 +740,7 @@ details, as well as let you know about features not touched on here.
rules. rules.
.. [#requirements-one-per-line] Requirements can have whitespace .. [#requirements-one-per-line] Requirements can have whitespace
characters as in ``ZEO <=5``, so they're separated by newlines. characters as in ``bobo <3``, so they're separated by newlines.
.. [#gcc] Currently, this example requires the ability to build
Python extensions and requires access to development tools.
.. [#if-same-environment] This assumes the same environment and that .. [#if-same-environment] This assumes the same environment and that
dependencies haven't changed. We'll explain further in the dependencies haven't changed. We'll explain further in the
......
...@@ -188,7 +188,7 @@ requirements on the command line after ``init``: ...@@ -188,7 +188,7 @@ requirements on the command line after ``init``:
.. code-block:: console .. code-block:: console
buildout init ZODB six buildout init bobo six
.. -> src .. -> src
...@@ -210,7 +210,7 @@ command above would generate a buildout configuration file: ...@@ -210,7 +210,7 @@ command above would generate a buildout configuration file:
recipe = zc.recipe.egg recipe = zc.recipe.egg
interpreter = py interpreter = py
eggs = eggs =
ZODB bobo
six six
.. -> src .. -> src
......
...@@ -93,7 +93,8 @@ setup( ...@@ -93,7 +93,8 @@ setup(
include_package_data = True, include_package_data = True,
entry_points = entry_points, entry_points = entry_points,
extras_require = dict( extras_require = dict(
test=['zope.testing', 'manuel', 'ZEO ==4.3.1', 'zc.zdaemonrecipe']), test=['zope.testing', 'manuel',
'bobo ==2.3.0', 'zdaemon', 'zc.zdaemonrecipe']),
zip_safe=False, zip_safe=False,
classifiers = [ classifiers = [
'Intended Audience :: Developers', 'Intended Audience :: Developers',
......
...@@ -3734,7 +3734,7 @@ def test_suite(): ...@@ -3734,7 +3734,7 @@ def test_suite():
" use-dependency-links=false" " use-dependency-links=false"
# Leaving this here so we can uncomment to see what's going on. # Leaving this here so we can uncomment to see what's going on.
#" log-format=%(asctime)s____%(levelname)s_%(message)s -vvv" #" log-format=%(asctime)s____%(levelname)s_%(message)s -vvv"
" index=" + os.path.join(ancestor(__file__, 4), 'doc') " index=" + os.path.join(ancestor(__file__, 4), 'eggs')
) )
def run_buildout_in_process(command='buildout'): def run_buildout_in_process(command='buildout'):
command = command.split(' ', 1) command = command.split(' ', 1)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment