Commit af2511a0 authored by Gary Poster's avatar Gary Poster

tweak instructions

parent 975ecd57
...@@ -84,19 +84,28 @@ Recipes to Support a System Python`_ for instructions on how to update ...@@ -84,19 +84,28 @@ Recipes to Support a System Python`_ for instructions on how to update
recipes yourself. recipes yourself.
Templates for creating Python scripts with the z3c.recipe.filetemplate Templates for creating Python scripts with the z3c.recipe.filetemplate
recipe can be easily changed to support a system Python. Use recipe can be easily changed to support a system Python.
z3c.recipe.scripts to generate a script or interpreter with the
dependencies you want. This will create a directory in ``parts`` that - If you don't care about supporting relative paths, simply using a
has a site.py and sitecustomize.py. Now, in your Python template, have generated interpreter with the eggs you want should be sufficient, as
a shebang line that makes Python start with -S: it was before. For instance, if the interpreter is named "py", use
``#!${buildout:executable} -S`` will work on many modern ``#!${buildout:bin-directory/py}`` or ``#!/usr/bin/env
distributions, for instance. Then include the following snippet at the top of ${buildout:bin-directory/py}``).
the file (after ``${python-relative-path-setup}`` if you are using the
relative path support). This assumes that the scripts generated were from a - If you do care about relative paths, (``relative-paths = true`` in
Buildout configuration section labeled "scripts". your buildout configuration), then z3c.recipe.scripts does require a
bit more changes, as is usual for the relative path support in that
:: package. First, use z3c.recipe.scripts to generate a script or
interpreter with the dependencies you want. This will create a
directory in ``parts`` that has a site.py and sitecustomize.py. Then,
begin your script as in the snippet below. The example assumes that
the z3c.recipe.scripts generated were from a Buildout configuration
section labeled "scripts": adjust accordingly.
::
#!${buildout:executable} -S
${python-relative-path-setup}
import sys import sys
sys.path.insert(0, ${scripts:parts-directory|path-repr}) sys.path.insert(0, ${scripts:parts-directory|path-repr})
import site import site
......
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