- 1. ZopeSkel & Buildout Andriy Mylenkyy Quintagroup,
2008
2. ZopeSkel author: Daniel Nouri 3. Plan for ZopeSkel
4. Problem & Purposes
- Performing many routine work
- Lead to some mistakes -> debugging, fixing.
- Useful for:Administrators, Developers, Designers
5.
- paster create -t [template] PACK_NAME [var_1=val_1 var_2=val_2
...]
- -t TEMPLATE, --template=TEMPLATE
Command line options 6. Informative & other options
- --inspect-filesShows where the files in the given (already
created) directory came from
7. Example plone creating 8. Config file example
- namespace_package = plone
- description = Description of my test example
- long_description =Not found how enter
- description for several lines .. ?
9. --svn-repository test 10. Basic templates
- basic_package :A basic setuptools-enabled package. Actually
fill entered data in setup.py file.
- basic_namespace :A project with a namespace package. Created in
ZopeSkel, put package in a namespace, add more information in
README.txt, HISTORY.txt files. Uses asrequired_templatein many
other templates (plone, basic_zope,plone25> themes).
- nested_namespace :A project with two nested namespaces. Add
additional nested namespace in root namespace. Uses in plone-3
based templates (plone_app, plone3_portlet).
11. Plone/Content Templates
- basic_zope :A Zope project. Create Zope product structure with
zcml conffile, initalization file, if project is for Zope2. Add
doctests skeletons.
- plone :A Plone project. Usebasic_namespacetemplate, add
zip_safe var, extends documentation info for setup_tools package.
Package similar to basic_zope template.
- archetype :A Plone project that uses Archetypes.
Useplonetemplate. Prepare dir structure for content, browser view,
portlets, GS profiles. May be used for both plone2 and plone3
products .
- plone_app : A Plone App project. Usesnested_namespace .
Actually plone template, but put in nested namespace.
- plone3_portlet : A Plone 3 portlet.Usesnested_namespace .
Create skeletons for template and browser views for add/edit/render
portlet; register through zcml; add GS installation profile.
Actually create unit tests for new portlet.
12. Theme templates
- plone2_theme : A Theme Product for Plone 2.1 & Plone 2.5.
Create skin-product python package for put in Products directory.
Add QI-enabled installation with installation/uninstallation skin,
registering resource registries. Skin directory contains css
stiles. On creation ask for base skin. Added power
installation/uninstallation unit tests.
- plone2.5_theme :A Theme for Plone 2.5.Usesplonetemplate. Uses
GS for installation resources, skins. Allows installation with both
tools- QI and GS. Contains extended skin directory structure: for
images, styles, templates. No browser views.
- plone3_theme :A Theme for Plone 3.0.Usesplonetemplate. Create
browser directory with prepared interfaces and viewlet browser view
modules, images and stylesheets resources dirs. Register in
configure.zcml views and resources for skin-interface. Setup
implemented only with GS.
13. Buildout templates
- plone3_buildout : A buildout for Plone 3 projects. Create
directory structure for zc.buildout: src, products, var;
bootstrap.py, buildout.cfg files. Use followinf vars on buildout
creation: (zope2_install, plone_products_install), (zope_user,
zope_password, http_port, debug_mode, verbose_security).
- plone2.5_buildout : A buildout for Plone 2.5 projects.
Usesplone3_buildout . Differences from plone3 only in installation
plone from plone-2.5 archive (not from recipe, as in plone-3)
- plone_hosting : Plonebuildout with ZEO and any Plone version.
Use vars: zope_password, http_port, zeo_port, proxy_port, plone
(version). Linke plone-3 buildout, but addbindir with control shell
script. Use zeo and conditionally varnish recipes for setup
zeoserver/varnish. Varnish installation control by proxy_port var.
On creating perform bootstrap and run buildout.
- recipe : A recipe project for zc.buildout.
- silva_buildout : A buildout for Silva projects
14. A ddcontent -local command
- Currently used only forArchetypetemplate
- In 1.9 version implemented 5 local templates: portlet, view,
zcmlmeta(register new directive), contenttype, atschema.
- Extend standard template mechanism with_insertsuffix
15. Template example
- Add some templates to template dir.
- update entry_points:paste.paster_create_template
-
- paster create -t base_package mytemplate
-
- cat mytemplate/__init__.py
-
- from zopeskel.base import BaseTemplate
-
- class MyTemplate(BaseTemplate):
-
- summary = Template Example
16. Notes for template developing
- Templatemust inheritfrom paste.script.template.Template
class
- Must declare:summary, _template_dirvars.
- For using ZopeSkel'local commandinclude
egg_plugins=['ZopeSkel']
- required_templates list of templates, which use by this
one
- vars declare variables for templates
- use_cheetah variable defines what template mechanism used
for.
17. Notes for template developing 2
- There are 2 main entry points for template:
-
- check_vars(vars, command)
- There are 2 utility methods:
- Subtempates for localcommands registered
forzopeskel.zopeskel_sub_templateentry point
18. BUILDOUT (zc.buildout) author: Jim Fulton 19. Plan for
Buildout
- Installation/reinstallation/uninstallation
- Buildout configuration file
- Options of [buildout] section
20. Basic information
- Glue many parts in one buildout
- Unify developing/testing/production sandbox
- Use eggs or setuptools distributed products
21. Buildout creation. Simple steps
- create main directory structure
- b)python bootstrap.py init
- 2. From created bin directory use buildout script.
- bin/buildout create buildout
22. Buildout structure bin/buildout buildout.cfg zc.buildout
setuptools Base products bootstrap.py part 1 part 2 part ..
Directory structure eggs bin (scripts) develop-eggs src parts 23.
buildout script:options
- Usage: buildout [options] [assignments] [command [command
arguments]]
- -c config_file -path to the configuration file. Defaults
buildout.cfg. Can be passed as url, but than buildout:directory=
[current directory]must be pointed
- -UDon't read user defaults, specified in
~/.buildout/default.cfg file.
- -o (-O)Run in off-line(not off-line) mode. Equivalent to
buildout:offline=true
- -n (-N)Run in newest (non-newest) mode. Equivalent to
buildout:newest=true (false). Default-newest, and buildout will try
to find the newest versions of distributions available that satisfy
its requirements.
- -DDebug errors. On error - the post-mortem debugger will be
started.
- -v( -q)Increase(decrease) the level of verbosity by 10.Can be
used multiple times.
24. buildout script :assignments
- Usage: buildout [options] [assignments] [command [command
arguments]]
- provide configuration options that override those given in the
configuration file.
- bin/buildout -No plone:user=member:secret
25. buildout script:commands
- Usage : buildout [options] [assignments] [command [command
arguments]]
- install [parts]-Install parts. If no command arguments are
given, then the parts specified by the buildout parts option will
be installed along with all of their dependencies. Otherwise,
specified parts will be installed.
- bootstrap-Create a new buildout in the current working
directory, copying the buildout and setuptools eggs and, creating a
basic directory structure and a buildout-local buildout
script.
- init-Initialize a buildout, creating a buildout.cfg file if it
doesn't exist and then performing the same actions as for the
buildout command.
- setup script [setup command and options]-Run a given setup
script arranging that setuptools is in the script's path and that
it has been imported so that setuptools-provided commands (like
bdist_egg). The script can be given either as a script path or a
path to a directory containing a setup.py script.
26. Install/Reinstall/Uninstall
- .installed.cfgfile creates on buildout run.
- On subsequent call compares data from .installed.cfg and
results options of recipe's constructor
- How to make decision about uninstallation and
reinstallation:
-
- If the configuration has changed, or if the recipe has
changed
-
- looks only at the part's options
- Parts are also uninstalled if they are no-longer used
27. Buildout configuration file
- Main and required configure block is[buildout]
- Parts define contents and installation order for buildout
- Every part managed byrecipe
28. [buildout] options.common
- parts :define name and order of installation steps, different
part names must be unique.
- find-links :define list of urls for looking for eggs. Cheese
Shop is default last repository for seeking.
- eggs :list of eggs for downloading & installation
- develop :path to development eggs location. Path relative or
absolute. Point to directory or file (setup.py). Installed before
building any parts, as they may provide locally-defined recipes
needed by the parts.
- extends :point to other configuration file, which used in this
one (partially or completely)
- index :the URLs of an index server for eggs finding
29. [buildout] options.rarely used
- download-cache :path to local dir to be used as a download
cache
- i nstall-from-cache : signal that packages should be installed
only from the download cache. Used only with previous option
- prefer-final:by default search newest releases, not filnal.
prefer-final = true get final, if satisfy criteria
- use-dependency-link :iffalsethan seek for package
dependencyonly in find-links urls
- executable :specify a python interpreter other than system
default
- python : section name, where defined python interpreter.
Default: buildout
- versions : name of version section. This section contain
options for each distribution name whose version is to be
fixed.
30. [buildout] optionsDirectories & logging
- Available customization options:DEFAULTS
-
-
-
- develop-eggs-directory./develop-eggs
-
-
-
- installed :file path./.installed.cfg
-
- log-level : DEBUG,INFO , WARNING, ERROR, CRITICAL .. or
integer
-
- verbocity:adjust log-level
-
- log-format : '%(name)s: %(message)s'
31. Recipe description
32. Recipe class
- constructor: responsible for updating a parts options.
-
- Arguments : buildout object, part name, options dictionary
- install: responsible for creating part.
-
- Return:path string or iterable containing paths to be removed
if a part is uninstalled.
- update: same with install, but use for updating.
-
- Return:Can also return None.
- Registertozc.buildout entry_point .
33. Recipe. More on Uninstall
- Problem:need more than simply remove created items.
- uninstall recipe-simply callable
-
- Arguments:-name of the part;-part's options
- Registeruninstall recipes, using thezc.buildout.uninstall entry
point .
-
- Uninstallation recipe accesses files and directories created by
a recipe before they are deleted
34. Useful options
-
- Allow extend configuration file with another one
-
- Things to note aboutextends :
-
-
- Multiple files could be listed
-
-
- Relative file names are interpreted relative to the directory
containing the referencing configuration file
-
-
- Configuration file could be passed as url:
-
-
-
- extends = http://some.url.com/some_buildout.cfg
-
-
-
- http://some.url2.com/some_buildout2.cfg
- User defaults : ~/.buildout/default.cfg. Read before reading
configuration file. -U command line option can be used to suppress
this.
35. zc.buildout.testing
- Depend on zope.testing package
- buildoutSetUp(test)- function. Used as doctest setup
function.
-
- Creates sample buildout that can be used by tests
-
- changing the current working directory to the
sample_buildout
-
- adds a number of names to the test namespace
- buildoutTearDown(test) tear down everything set up by
buildoutSetUp
- Normalizations ready for use filters to normalize output in
doctests. Used in zope.testing.renormalizing function:
-
- normalize_path, normalize_egg_py : python version and platform
indicator in eggs), normalize_script in windows there are .exe, .py
extensions. Normalize to unix-like style (without extensions)
36. plone.recipe.plone
-
- zope2-url : calculated good zope version
-
- eggs: added to list of core plone eggs
-
- location: calculated from part's name
andbuldout'sparts-directory
37. plone.recipe.zope2install
-
- url point to zope archive. Useful ${plone.zope2-url}
-
- svn : if not set, andurlset-you can set zope-directory option
in[buildout]section, which will be used for
calculatelocationoption. In this caseshared-zopeoption set
totruefor prevent erasing this directory on unistallation.
-
- Ifshared-zopeoption set totruereturn empty list for prevent
erasing zope-directory on unistallation.
- On update:If present svn option update and rebuild
38. plone.recipe.zope2instance
- Updateactually perform install if something changed.
-
- zope2-location:${zope2:location} used for create zope
instance
-
- user:username:userpassword
-
- eggs, find-links, index:for eggs find, download
-
- zope-conf:path to zope.conf file.
-
- ip-address, http-address(port)
-
- products, extra-paths, var(directory)
-
- verbose-security, debug-mode
-
- zeo-{client, address, cache-size, storage, var}
39. plone.recipe.distros
- Designed for:archives installation
-
- urls:list of archives for download and extracted
-
- nested-packages:list of archive' names (last url part), which
content should be extracted.
-
- version-suffix-packages:list of archive' names (last url part),
which suffixes should be removed (hyphen is treated as suffix
separator).