[Checkins] SVN: z3c.recipe.filetemplate/branches/gary-support-system-python/ update to use newest version of my zc.buildout branch
Gary Poster
gary.poster at canonical.com
Fri Sep 4 09:58:56 EDT 2009
Log message for revision 103541:
update to use newest version of my zc.buildout branch
Changed:
_U z3c.recipe.filetemplate/branches/gary-support-system-python/
U z3c.recipe.filetemplate/branches/gary-support-system-python/CHANGES.txt
U z3c.recipe.filetemplate/branches/gary-support-system-python/z3c/recipe/filetemplate/README.txt
U z3c.recipe.filetemplate/branches/gary-support-system-python/z3c/recipe/filetemplate/__init__.py
-=-
Property changes on: z3c.recipe.filetemplate/branches/gary-support-system-python
___________________________________________________________________
Modified: svn:externals
- bootstrap svn://svn.zope.org/repos/main/zc.buildout/trunk/bootstrap
zc.buildout svn+ssh://svn.zope.org/repos/main/zc.buildout/branches/gary-support-system-python
+ zc.buildout svn+ssh://svn.zope.org/repos/main/zc.buildout/branches/gary-support-system-python-3
bootstrap svn://svn.zope.org/repos/main/zc.buildout/trunk/bootstrap
Modified: z3c.recipe.filetemplate/branches/gary-support-system-python/CHANGES.txt
===================================================================
--- z3c.recipe.filetemplate/branches/gary-support-system-python/CHANGES.txt 2009-09-04 13:53:49 UTC (rev 103540)
+++ z3c.recipe.filetemplate/branches/gary-support-system-python/CHANGES.txt 2009-09-04 13:58:55 UTC (rev 103541)
@@ -5,18 +5,31 @@
2.1.0 (Unreleased)
==================
+Requires zc.buildout 1.5.0 or greater.
+
--------
Features
--------
-- Support the new zc.buildout 1.4.0+ include-site-packages option.
+- Support the new zc.buildout 1.5.0+ include-site-packages option.
-- Use the new zc.buildout 1.4.0+ path sorting algorithm, which puts
+- Use the new zc.buildout 1.5.0+ path sorting algorithm, which puts
site-package dependency paths after the other dependency paths (but before
extra paths, as before). This can reduce or eliminate problems with
packages in site-packages causing other dependencies to be masked with the
versions in site-packages.
+- In addition to ``os-paths``, ``string-paths``, and ``space-paths``,
+ templates can now also use ``os-stdlib-paths``, ``os-egg-paths``,
+ ``os-dir-paths``, and their ``string-``* and ``space-``* parallels.
+ ``stdlib-paths`` are the paths for the executable's standard library.
+ ``egg-paths`` are the paths to the standalone eggs for the dependencies.
+ ``dir-paths`` are the paths to directories such as ``site-packages`` and
+ directories added via ``extra-paths``; if added to the sys.path via
+ direct manipulation of the sys.path list in Python, you usually should
+ call ``site.addsitedir`` for each path in dir-paths to make sure that
+ .pth files are processed.
+
- Support escaping "${...}" with "$${...}" in templates. This is particularly
useful for *NIX shell scripts.
Modified: z3c.recipe.filetemplate/branches/gary-support-system-python/z3c/recipe/filetemplate/README.txt
===================================================================
--- z3c.recipe.filetemplate/branches/gary-support-system-python/z3c/recipe/filetemplate/README.txt 2009-09-04 13:53:49 UTC (rev 103540)
+++ z3c.recipe.filetemplate/branches/gary-support-system-python/z3c/recipe/filetemplate/README.txt 2009-09-04 13:58:55 UTC (rev 103541)
@@ -301,20 +301,58 @@
Specifying paths
================
-You can specify eggs and extra-paths in the recipe. If you do, three
-predefined options will be available in the recipe's options for the template.
-If "paths" are the non-zip paths, and "all_paths" are all paths, then the
-options would be defined roughly as given here:
+You can specify eggs and extra-paths in the recipe. If you do, several
+predefined options will be available in the recipe's options for the
+template. These are the combination of two sets. First, consider
+"stdlib_paths" to be the paths for the standard library, "egg_paths" to
+be the paths for the paths for standalone eggs, "dir_paths" to be the
+paths for directories that might contain .pth files (like site-packages
+or directories added with extra-paths), and "all_paths" to be the
+combination of all three in the order of egg_paths, dir_paths, and
+stdlib_paths. Then combine those with three variants: "os" paths,
+joined by os.pathsep; "string" paths, quoted paths separated by strings,
+suitable for Python lists; and "space" paths, joined by a space. The
+results of the combination are defined roughly as given here.
``os-paths``
- ``(os.pathsep).join(paths)``
+ ``(os.pathsep).join(all_paths)``
``string-paths``
``', '.join(repr(p) for p in all_paths)``
``space-paths``
- ``' '.join(paths)``
+ ``' '.join(all_paths)``
+``os-stdlib-paths``
+ ``(os.pathsep).join(stdlib_paths)``
+
+``string-stdlib-paths``
+ ``', '.join(repr(p) for p in stdlib_paths)``
+
+``space-stdlib-paths``
+ ``' '.join(stdlib_paths)``
+
+``os-egg-paths``
+ ``(os.pathsep).join(egg_paths)``
+
+``string-egg-paths``
+ ``', '.join(repr(p) for p in egg_paths)``
+
+``space-egg-paths``
+ ``' '.join(egg_paths)``
+
+``os-dir-paths``
+ ``(os.pathsep).join(dir_paths)``
+
+``string-dir-paths``
+ ``', '.join(repr(p) for p in dir_paths)``
+
+``space-dir-paths``
+ ``' '.join(dir_paths)``
+
+(Note that you can work with the different path lists in different ways
+with the interpreted options described in the section below.)
+
For instance, consider this example.
>>> write(sample_buildout, 'buildout.cfg',
@@ -343,6 +381,33 @@
... ---
... Space paths:
... ${space-paths}
+ ... ---
+ ... OS stdlib paths:
+ ... ${os-stdlib-paths}
+ ... ---
+ ... String stdlib paths:
+ ... ${string-stdlib-paths}
+ ... ---
+ ... Space stdlib paths:
+ ... ${space-stdlib-paths}
+ ... ---
+ ... OS egg paths:
+ ... ${os-egg-paths}
+ ... ---
+ ... String egg paths:
+ ... ${string-egg-paths}
+ ... ---
+ ... Space egg paths:
+ ... ${space-egg-paths}
+ ... ---
+ ... OS dir paths:
+ ... ${os-dir-paths}
+ ... ---
+ ... String dir paths:
+ ... ${string-dir-paths}
+ ... ---
+ ... Space dir paths:
+ ... ${space-dir-paths}
... """)
>>> print system(buildout)
@@ -402,6 +467,33 @@
---
Space paths:
...demo... ...demoneeded... .../sample-buildout/foo ...
+ ---
+ OS stdlib paths:
+ ...:...
+ ---
+ String stdlib paths:
+ '...', ...
+ ---
+ Space stdlib paths:
+ ... ...
+ ---
+ OS egg paths:
+ ...demo...:...demoneeded...
+ ---
+ String egg paths:
+ '...demo...', '...demoneeded...'
+ ---
+ Space egg paths:
+ ...demo... ...demoneeded...
+ ---
+ OS dir paths:
+ .../sample-buildout/foo:...
+ ---
+ String dir paths:
+ '.../sample-buildout/foo', ...
+ ---
+ Space dir paths:
+ .../sample-buildout/foo ...
Defining options in Python
==========================
@@ -414,6 +506,27 @@
multi-line expression (see ``first-interpreted-option`` and
``message-reversed-is-egassem``).
+Useful values available in the evaluation context include the following.
+
+``name``
+ Section name.
+``options``
+ The options for the current section.
+``buildout``
+ The buildout object.
+``stdlib_paths``
+ The list of the paths in the standard library.
+``egg_paths``
+ The list of standalone egg paths.
+``dir_paths``
+ The list of paths that might contain eggs, other packages or modules, or
+ .pth files.
+``all_paths``
+ A concatenation of all of the previously mentioned paths in the order of
+ egg_paths, dir_paths, and stdlib_paths.
+``paths``
+ A shorthand for ``all_paths``.
+
>>> write(sample_buildout, 'buildout.cfg',
... """
... [buildout]
@@ -428,12 +541,17 @@
... silly-range = repr(range(5))
... first-interpreted-option
... message-reversed-is-egassem
+ ... my-name = name
+ ... paths-are-equivalent
+ ...
... first-interpreted-option =
... options['interpreted-options'].split()[0].strip()
... message-reversed-is-egassem=
... ''.join(
... reversed(
... buildout['buildout']['parts']))
+ ... paths-are-equivalent=
+ ... repr((egg_paths + dir_paths + stdlib_paths) == paths)
... not-interpreted=hello world
...
... find-links = %(server)s
@@ -448,6 +566,8 @@
... silly-range: ${silly-range}
... first-interpreted-option: ${first-interpreted-option}
... message-reversed-is-egassem: ${message-reversed-is-egassem}
+ ... my-name: ${my-name}
+ ... paths-are-equivalent: ${paths-are-equivalent}
... """)
>>> print system(buildout)
@@ -461,4 +581,5 @@
silly-range: [0, 1, 2, 3, 4]
first-interpreted-option: duplicate-os-paths=(os.pathsep).join(paths)
message-reversed-is-egassem: egassem
-
+ my-name: message
+ paths-are-equivalent: True
Modified: z3c.recipe.filetemplate/branches/gary-support-system-python/z3c/recipe/filetemplate/__init__.py
===================================================================
--- z3c.recipe.filetemplate/branches/gary-support-system-python/z3c/recipe/filetemplate/__init__.py 2009-09-04 13:53:49 UTC (rev 103540)
+++ z3c.recipe.filetemplate/branches/gary-support-system-python/z3c/recipe/filetemplate/__init__.py 2009-09-04 13:58:55 UTC (rev 103541)
@@ -44,6 +44,7 @@
for key, value in defaults.items():
self.options.setdefault(key, value)
# set up paths for eggs, if given
+ all_paths = []
if 'eggs' in self.options:
relative_paths = self.options.get(
'relative-paths',
@@ -60,15 +61,22 @@
include_site_packages = options.get(
'include-site-packages',
buildout['buildout']['include-site-packages'])
- all_paths = zc.buildout.easy_install.get_path(
+ stdlib, egg_paths, dir_paths = zc.buildout.easy_install.get_path(
ws, self.options['executable'], self.eggs.extra_paths,
include_site_packages)
+ all_paths.extend(egg_paths)
+ all_paths.extend(dir_paths)
+ all_paths.extend(stdlib)
else:
- all_paths = []
- paths = [path for path in all_paths if not path.endswith('.zip')]
- self.options['os-paths'] = (os.pathsep).join(paths)
- self.options['string-paths'] = ', '.join(repr(p) for p in all_paths)
- self.options['space-paths'] = ' '.join(paths)
+ egg_paths = dir_paths = stdlib = []
+ for (path_name, paths) in (('paths', all_paths),
+ ('stdlib-paths', stdlib),
+ ('egg-paths', egg_paths),
+ ('dir-paths', dir_paths)):
+ self.options['os-%s' % (path_name,)] = (os.pathsep).join(paths)
+ self.options['string-%s' % (path_name,)] = ', '.join(
+ repr(p) for p in paths)
+ self.options['space-%s' % (path_name,)] = ' '.join(paths)
# get and check the files to be created
self.filenames = self.options.get('files', '*').split()
self.source_dir = self.options.get('source-directory', '').strip()
@@ -163,7 +171,9 @@
if interpreted:
globs = {'__builtins__': __builtins__, 'os': os, 'sys': sys}
locs = {'name': name, 'options': options, 'buildout': buildout,
- 'paths': paths, 'all_paths': all_paths}
+ 'paths': all_paths, 'all_paths': all_paths,
+ 'stdlib_paths': stdlib, 'egg_paths': egg_paths,
+ 'dir_paths': dir_paths}
for value in interpreted.split('\n'):
if value:
value = value.split('=', 1)
More information about the checkins
mailing list