Ayuda con buildout

Mikel Larreategi mlarreategi en codesyntax.com
Jue Sep 24 08:52:18 CEST 2009


Luis Miguel Morillas(e)k dio:
> 
> Ups. Lo siento, he hecho un copia/pega demasiado rápido del buildout.cfg.
> 
> El que estoy usando es este:
> 
> #####  fichero buildout.cfg
> 
> [buildout]
> develop = amara_hg
> parts = amara2
> 
> [amara2]
> recipe = zc.recipe.egg
> interpreter = amara_py
> eggs = Amara
> 
> #### fin fichero
> 
> En el directorio amara_hg hay un clone del repositorio que usamos.
> 
> Problema 1:
> Por lo que veo construye el .egg en
> ./amara_hg/dist/Amara-2.0a3-py2.6-linux-i686.egg , pero luego el
> intérprete creado (bin/amara_py en mi caso) no lo importa . El archivo
> develop-eggs/Amara.egg-link  creado contiene
> /home/lm/src/buildouts/AmaraBuildSrc/amara_hg, no una referencia al
> .egg.  ¿Por qué no puede enlazar el egg creado?

He hecho una prueba haciendo a mano un hg clone del repositorio que 
indicas en el buildout del "Problema 2" y a mí me funciona bien.

Por mucho que construya el egg en un directorio interno el enlace que se 
hace cuando tienes un develop-egg se hace al directorio en el que está 
el código fuente.

Con el buildout que indicas arriba y haciendo un hg clone 
http://bitbucket.org/uche/amara/ amara_hg en la carpeta donde está 
buildout.cfg obtengo lo siguiente::

erral en lindari:/tmp/am$ python2.5 bootstrap.py
Creating directory '/tmp/am/bin'.
Creating directory '/tmp/am/parts'.
Creating directory '/tmp/am/develop-eggs'.
Generated script '/tmp/am/bin/buildout'.
erral en lindari:/tmp/am$ ./bin/buildout -vv
Installing 'zc.buildout', 'setuptools'.
We have the best distribution that satisfies 'zc.buildout'.
Picked: zc.buildout = 1.4.1
We have the best distribution that satisfies 'setuptools'.
Picked: setuptools = 0.6c9
Develop: '/tmp/am/amara_hg'
in: '/tmp/am/amara_hg'
/tmp/tmpfCmArU develop -mxN -d /tmp/am/develop-eggs/tmpGSz-Vhbuild
running develop
Checking .pth file support in /tmp/am/develop-eggs/tmpGSz-Vhbuild
/usr/bin/python2.5 -E -c pass
running egg_info
writing Amara.egg-info/PKG-INFO
writing top-level names to Amara.egg-info/top_level.txt
writing dependency_links to Amara.egg-info/dependency_links.txt
file demo/scrapesniff.py (for module amara.tools.scrapesniff) not found
reading manifest file 'Amara.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching 'MANIFEST'
warning: no files found matching 'amara/xpath/parser/xpath.bgen'
warning: no files found matching 
'amara/xpath/parser/xpath_grammar.bgen.frag'
warning: no files found matching 
'amara/xpath/parser/xpath_lexer_defines.bgen.frag'
warning: no files found matching 
'amara/xpath/parser/xpath_lexer_patterns.bgen.frag'
warning: no files found matching 
'amara/xpath/parser/xpath_modules.bgen.frag'
warning: no files found matching 'amara/xpath/parser/xpath_tokens.bgen.frag'
warning: no files found matching 'amara/xslt/expressions/avt.bgen'
warning: no files found matching 'amara/xslt/xpatterns/xpattern.bgen'
warning: no files found matching 'amara/src/expat/COPYING'
warning: no files found matching 'amara/src/expat/README'
writing manifest file 'Amara.egg-info/SOURCES.txt'
running build_ext
copying build/lib.linux-i686-2.5/amara/_xmlstring.so -> lib
copying build/lib.linux-i686-2.5/amara/_expat.so -> lib
copying build/lib.linux-i686-2.5/amara/_domlette.so -> lib
copying build/lib.linux-i686-2.5/amara/writers/_xmlstream.so -> lib/writers
copying build/lib.linux-i686-2.5/amara/writers/treewriter.so -> lib/writers
copying build/lib.linux-i686-2.5/amara/xpath/_datatypes.so -> lib/xpath
copying build/lib.linux-i686-2.5/amara/xpath/locationpaths/_axes.so -> 
lib/xpath/locationpaths
copying build/lib.linux-i686-2.5/amara/xpath/locationpaths/_nodetests.so 
-> lib/xpath/locationpaths
copying build/lib.linux-i686-2.5/amara/xpath/locationpaths/_paths.so -> 
lib/xpath/locationpaths
copying build/lib.linux-i686-2.5/amara/xpath/parser/_xpathparser.so -> 
lib/xpath/parser
copying build/lib.linux-i686-2.5/amara/xslt/expressions/_avt.so -> 
lib/xslt/expressions
copying build/lib.linux-i686-2.5/amara/xslt/functions/_functions.so -> 
lib/xslt/functions
copying build/lib.linux-i686-2.5/amara/xslt/xpatterns/_parser.so -> 
lib/xslt/xpatterns
copying build/lib.linux-i686-2.5/amara/xslt/tree/_tree.so -> lib/xslt/tree
Creating /tmp/am/develop-eggs/tmpGSz-Vhbuild/Amara.egg-link (link to .)

Installed /tmp/am/amara_hg

Because this distribution was installed --multi-version, before you can
import modules from this package in an application, you will need to
'import pkg_resources' and then use a 'require()' call similar to one of
these examples, in order to select the desired version:

     pkg_resources.require("Amara")  # latest installed version
     pkg_resources.require("Amara==2.0a2")  # this exact version
     pkg_resources.require("Amara>=2.0a2")  # this version or higher


Note also that the installation directory must be on sys.path at runtime for
this to work.  (e.g. by being the application's script directory, by 
being on
PYTHONPATH, or by being added to sys.path by your code.)

Installing 'zc.recipe.egg'.
We have the best distribution that satisfies 'zc.recipe.egg'.
Picked: zc.recipe.egg = 1.2.2

Configuration data:
[amara2]
_b = /tmp/am/bin
_d = /tmp/am/develop-eggs
_e = /var/zope/downloads/eggs
bin-directory = /tmp/am/bin
develop-eggs-directory = /tmp/am/develop-eggs
eggs = Amara
eggs-directory = /var/zope/downloads/eggs
executable = /usr/bin/python2.5
interpreter = amara_py
recipe = zc.recipe.egg
[buildout]
bin-directory = /tmp/am/bin
develop = amara_hg
develop-eggs-directory = /tmp/am/develop-eggs
directory = /tmp/am
download-directory = /var/zope/downloads
eggs-directory = /var/zope/downloads/eggs
executable = /usr/bin/python2.5
installed = /tmp/am/.installed.cfg
log-format =
log-level = INFO
newest = true
offline = false
parts = amara2
parts-directory = /tmp/am/parts
python = buildout
verbosity = 20

Installing amara2.
Installing 'Amara'.
We have a develop egg: Amara 2.0a2
Generated interpreter '/tmp/am/bin/amara_py'.

Y si miro amara_py ahí está amara_hg:

erral en lindari:/tmp/am$ head bin/amara_py
#!/usr/bin/python2.5

import sys

sys.path[0:0] = [
   '/tmp/am/amara_hg',
   ]

_interactive = True
if len(sys.argv) > 1:
erral en lindari:/tmp/am$


> 
> Problema 2:
> Ahora quiero prepararlo también para que el usuario sólo tenga que
> ejecutar el buildout y éste haga el clone del repositorio. Pero la
> parte que tiene que construir el egg siempre intenta descargarlo con
> easy_install en lugar de usar el fuente descargado del repositorio por
> mercurialrecipe.
> 
> ### buildout.conf con mercurialrecipe
> 
> [buildout]
> parts = amara amara2
> 
> [amara]
> recipe = mercurialrecipe
> repository =  http://bitbucket.org/uche/amara/
> 
> [amara2]
> recipe = zc.recipe.egg
> interpreter = python
> eggs = Amara
> develop = ${amara:location}

Parece que la receta de mercualrecipe se llama MercurialRecipe, y esto 
es case-sensitive.

No puedes añadir como develop-eggs checkouts que hacen unas determinadas 
recetas, salvo que la propia receta te dé esa posibilidad, por lo que 
tendrás que utilizar la opción "extra-paths" de zc.recipe.egg para 
incluir el clone de amara en el intérprete que se genera:

[buildout]
parts = amara amara2

[amara]
recipe = MercurialRecipe
repository =  http://bitbucket.org/uche/amara/

[amara2]
recipe = zc.recipe.egg
interpreter = python
eggs =
extra-paths = ${amara:location}



Saludos,


Mikel


-- 
Mikel Larreategi
mlarreategi en codesyntax.com

CodeSyntax
Azitaingo Industrialdea 3 K
E-20600 Eibar
Tel: (+34) 943 82 17 80
_______________________________________________
Lista de correo Python-es 
http://listas.aditel.org/listinfo/python-es
FAQ: http://listas.aditel.org/faqpyes





Más información sobre la lista de distribución Python-es