[Checkins] SVN: Sandbox/philikon/zopeproject/trunk/ The eggs directory will no longer be written to ``buildout.cfg`` if

Philipp von Weitershausen philikon at philikon.de
Sat Sep 15 08:24:04 EDT 2007


Log message for revision 79672:
  The eggs directory will no longer be written to ``buildout.cfg`` if
  it is the same as the buildout default in ``~/.buidout/default.cfg``.
  

Changed:
  U   Sandbox/philikon/zopeproject/trunk/README.txt
  U   Sandbox/philikon/zopeproject/trunk/TODO.txt
  U   Sandbox/philikon/zopeproject/trunk/zopeproject/templates.py
  U   Sandbox/philikon/zopeproject/trunk/zopeproject/zope_deploy/buildout.cfg_tmpl

-=-
Modified: Sandbox/philikon/zopeproject/trunk/README.txt
===================================================================
--- Sandbox/philikon/zopeproject/trunk/README.txt	2007-09-15 11:33:06 UTC (rev 79671)
+++ Sandbox/philikon/zopeproject/trunk/README.txt	2007-09-15 12:24:04 UTC (rev 79672)
@@ -13,7 +13,8 @@
 initial administrator user.  It will also ask you where to put the
 Python packages ("eggs") that it downloads.  This way multiple
 projects created with ``zopeproject`` can share the same packages and
-won't have to download them each time.
+won't have to download them each time (see also `Sharing eggs among
+sandboxes`_ below).
 
 (Note: Depending on how they installed Python, Unix/Linux users may
 have to invoke ``easy_install`` with ``sudo``.  If that's not wanted
@@ -74,8 +75,32 @@
 When installing packages from source, Python should now use the MinGW
 compiler to build binaries.
 
-.. _MingW: http://www.mingw.org
+Sharing eggs among sandboxes
+----------------------------
 
+A great feature of `zc.buildout`_ is the ability to share downloaded
+Python packages ("eggs") between sandboxes.  This is achieved by
+placing all eggs in a central location.  zopeproject will ask for this
+location each time.  The setting will become part of ``buildout.cfg``.
+
+It could very well be that your shared eggs directory is different
+from the suggested default value, so it would be good to avoid having
+to type it in every time.  Furthermore, you may want to avoid having
+system-dependent paths appear in ``buildout.cfg`` because they hinder
+the repeatibility of the setup on other machines.
+
+A way to solve these problems is to configure a system-wide default
+eggs directory for buildout in ``~/.buildout/default.cfg``::
+
+  [buildout]
+  eggs-directory = /home/philipp/eggs
+
+zopeproject will understand that you have this default value and
+change its own default when asking you for the eggs directory.  If you
+just hit enter there (thereby accepting the default in
+``~/.buildout/default.cfg``), the generated ``buildout.cfg`` will not
+contain a reference to path.
+
 Command line options
 ====================
 
@@ -311,6 +336,10 @@
   "application" means something else, and ``app.py`` is commonly used
   for the application object).
 
+* The eggs directory will no longer be written to ``buildout.cfg`` if
+  it is the same as the buildout default in
+  ``~/.buidout/default.cfg``.
+
 0.3.2 (2007-07-17)
 ------------------
 
@@ -376,6 +405,7 @@
 .. _virtual-python: http://peak.telecommunity.com/DevCenter/EasyInstall#creating-a-virtual-python
 .. _workingenv: http://cheeseshop.python.org/pypi/workingenv.py
 .. _zc.buildout: http://cheeseshop.python.org/pypi/zc.buildout
+.. _MingW: http://www.mingw.org
 .. _PasteDeploy: http://pythonpaste.org/deploy/
 .. _listed on the Python Cheeseshop: http://cheeseshop.python.org/pypi?:action=browse&c=515
 .. _pdb: http://docs.python.org/lib/module-pdb.html

Modified: Sandbox/philikon/zopeproject/trunk/TODO.txt
===================================================================
--- Sandbox/philikon/zopeproject/trunk/TODO.txt	2007-09-15 11:33:06 UTC (rev 79671)
+++ Sandbox/philikon/zopeproject/trunk/TODO.txt	2007-09-15 12:24:04 UTC (rev 79672)
@@ -23,23 +23,6 @@
   checked in. Solution: zope.conf could be created by a simple
   buildout recipe.
 
-* Alter the way the eggs directory is added to buildout.cfg:
-
-  - check if there's a default setting in ~/.buildout/default.cfg
-
-  - if there's a default setting and the user simply takes that (by
-    pressing return), buildout.cfg won't get a eggs-directory setting
-    (but perhaps a comment instead mentioning that the default setting
-    will be used).
-
-  - if there's a default setting but the user chooses to enter a
-    different directory, buildout.cfg will have the necessary
-    eggs-directory setting.
-
-  - if there's no default setting, zopeproject/grokproject will
-    suggest a sensible eggs directory (e.g. ~/buildout-eggs) and
-    buildout.cfg will have the necessary eggs-directory setting.
-
 * Bring back bin/zopectl (fg, start/stop/status, debug)
 
 * Instead of a --svn-repository, make it a question (with the default

Modified: Sandbox/philikon/zopeproject/trunk/zopeproject/templates.py
===================================================================
--- Sandbox/philikon/zopeproject/trunk/zopeproject/templates.py	2007-09-15 11:33:06 UTC (rev 79671)
+++ Sandbox/philikon/zopeproject/trunk/zopeproject/templates.py	2007-09-15 12:24:04 UTC (rev 79672)
@@ -4,8 +4,9 @@
 from ConfigParser import ConfigParser
 from paste.script.templates import var, NoDefault, Template, BasicPackage
 
-def determine_eggs_dir():
-    HOME = os.path.expanduser('~')
+HOME = os.path.expanduser('~')
+
+def get_buildout_default_eggs_dir():
     default_cfg = os.path.join(HOME, '.buildout', 'default.cfg')
     if os.path.isfile(default_cfg):
         cfg = ConfigParser()
@@ -13,7 +14,12 @@
         if cfg.has_option('buildout', 'eggs-directory'):
             eggs_dir = cfg.get('buildout', 'eggs-directory').strip()
             if eggs_dir:
-                return eggs_dir
+                return os.path.expanduser(eggs_dir)
+
+def default_eggs_dir():
+    buildout_default = get_buildout_default_eggs_dir()
+    if buildout_default:
+        return buildout_default
     return os.path.join(HOME, 'buildout-eggs')
 
 class ZopeDeploy(Template):
@@ -25,12 +31,19 @@
         var('passwd', 'Password for the initial administrator user',
             default=NoDefault),
         var('eggs_dir', 'Location where zc.buildout will look for and place '
-            'packages', default=determine_eggs_dir())
+            'packages', default=default_eggs_dir())
         ]
 
     def check_vars(self, vars, cmd):
         vars = super(ZopeDeploy, self).check_vars(vars, cmd)
-        vars['eggs_dir'] = os.path.expanduser(vars['eggs_dir'])
+        buildout_default = get_buildout_default_eggs_dir()
+        input = os.path.expanduser(vars['eggs_dir'])
+        if input == buildout_default:
+            vars['eggs_dir'] = ('# eggs will be installed in the default '
+                                'buildout location (see '
+                                '~/.buildout/default.cfg)')
+        else:
+            vars['eggs_dir'] = 'eggs-directory = %s' % input
         return vars
 
 class ZopeApp(Template):

Modified: Sandbox/philikon/zopeproject/trunk/zopeproject/zope_deploy/buildout.cfg_tmpl
===================================================================
--- Sandbox/philikon/zopeproject/trunk/zopeproject/zope_deploy/buildout.cfg_tmpl	2007-09-15 11:33:06 UTC (rev 79671)
+++ Sandbox/philikon/zopeproject/trunk/zopeproject/zope_deploy/buildout.cfg_tmpl	2007-09-15 12:24:04 UTC (rev 79672)
@@ -2,8 +2,8 @@
 develop = .
 parts = app test
 find-links = http://download.zope.org/distribution/
-eggs-directory = ${eggs_dir}
 newest = ${newest}
+${eggs_dir}
 
 [app]
 recipe = zc.recipe.egg



More information about the Checkins mailing list