[Checkins] SVN: z3c.recipe.staticlxml/trunk/ The recipe checks for an existing egg before doing expensive
Reinout van Rees
reinout at vanrees.org
Wed Mar 11 06:54:27 EDT 2009
Log message for revision 97834:
The recipe checks for an existing egg before doing expensive
download/compiles. Previously, the check was implicitly done *after*
compiling libmxl/libxslt. The egg name is printed with a warning to delete
it if this isn't a proper static egg.
Also removed some unused imports.
Expanded the README, documenting this change.
Changed:
U z3c.recipe.staticlxml/trunk/CHANGES.txt
U z3c.recipe.staticlxml/trunk/src/z3c/recipe/staticlxml/README.txt
U z3c.recipe.staticlxml/trunk/src/z3c/recipe/staticlxml/__init__.py
-=-
Modified: z3c.recipe.staticlxml/trunk/CHANGES.txt
===================================================================
--- z3c.recipe.staticlxml/trunk/CHANGES.txt 2009-03-11 09:54:45 UTC (rev 97833)
+++ z3c.recipe.staticlxml/trunk/CHANGES.txt 2009-03-11 10:54:26 UTC (rev 97834)
@@ -1,6 +1,11 @@
trunk
=====
+- The recipe checks for an existing egg before doing expensive
+ download/compiles. Previously, the check was implicitly done *after*
+ compiling libmxl/libxslt. The egg name is printed with a warning to delete
+ it if this isn't a proper static egg. [reinout]
+
- Fixed readme typos. [seletz]
0.4 (2009-02-18)
Modified: z3c.recipe.staticlxml/trunk/src/z3c/recipe/staticlxml/README.txt
===================================================================
--- z3c.recipe.staticlxml/trunk/src/z3c/recipe/staticlxml/README.txt 2009-03-11 09:54:45 UTC (rev 97833)
+++ z3c.recipe.staticlxml/trunk/src/z3c/recipe/staticlxml/README.txt 2009-03-11 10:54:26 UTC (rev 97834)
@@ -73,4 +73,11 @@
This will build a ``static`` version of the ``lxml`` egg, that is, it won't have
any dependencies on ``libxml2`` and ``libxslt``.
+The egg is installed in your buildout's egg directory (it is *not* installed
+as a development egg). If you have a global ``eggs-directory`` configured in
+your ``~/.buildout/default.cfg``, the static lxml egg is thus placed in that
+global egg directory.
+If you specified a specific version for the lxml egg, the egg directory is
+checked for an existing lxml egg. If found, it is used as-is. Specifying
+``force = true`` of course means that this check isn't performed.
Modified: z3c.recipe.staticlxml/trunk/src/z3c/recipe/staticlxml/__init__.py
===================================================================
--- z3c.recipe.staticlxml/trunk/src/z3c/recipe/staticlxml/__init__.py 2009-03-11 09:54:45 UTC (rev 97833)
+++ z3c.recipe.staticlxml/trunk/src/z3c/recipe/staticlxml/__init__.py 2009-03-11 10:54:26 UTC (rev 97834)
@@ -5,14 +5,11 @@
import os
import pkg_resources
import logging
-import subprocess
from fnmatch import fnmatch
-import distutils.core
from distutils import sysconfig
from zc.buildout import UserError
-from zc.buildout import easy_install
from zc.recipe.egg.custom import Custom
@@ -127,7 +124,31 @@
def install(self):
options = self.options
+ install_location = self.buildout['buildout']['eggs-directory']
+ # Only do expensive download/compilation when there's no existing egg.
+ path = [install_location]
+ req_string = self.options['egg'] # 'lxml' or 'lxml == 2.0.9'
+ version_req = self.buildout['versions']['lxml']
+ if version_req:
+ # [versions] wins and is often the place where it is specified.
+ req_string = 'lxml == %s' % version_req
+ req = pkg_resources.Requirement.parse(req_string)
+ matching_dists = [d for d in pkg_resources.Environment(path)['lxml']
+ if d in req]
+ if matching_dists and not self.force:
+ # We have found existing lxml eggs that match our requirements.
+ # If we specified an exact version, we'll trust that the matched
+ # egg is good. We don't currently accept matches for not-pinned
+ # versions as that would mean lots of code duplication with
+ # easy_install (handling newest=t/f and so).
+ specs = req.specs
+ if len(specs) == 1 and specs[0][0] == '==':
+ self.logger.info("Using existing %s. Delete it if that one "
+ "isn't statically compiled.",
+ matching_dists[0].location)
+ return ()
+
# build dependent libs if requested
if self.build_xml2:
self.build_libxml2()
@@ -170,7 +191,7 @@
self.lxml_custom = Custom(self.buildout, self.name, self.options)
self.lxml_custom.environment = self.lxml_build_env()
- self.lxml_custom.options["_d"] = self.buildout['buildout']['eggs-directory']
+ self.lxml_custom.options["_d"] = install_location
self.logger.info("Building lxml ...")
self.lxml_dest = self.lxml_custom.install()
@@ -178,7 +199,6 @@
return ()
def get_ldshared(self):
- import distutils.sysconfig
LDSHARED = sysconfig.get_config_vars().get("LDSHARED")
self.logger.debug("LDSHARED=%s" % LDSHARED)
if "darwin" in sys.platform:
More information about the Checkins
mailing list