[Checkins] SVN: projectsupport/trunk/ Modified develop.py to look to setup.cfg.in for default settings; updated README to mention setup.cfg.in.

Nathan Yergler nathan at yergler.net
Sun Mar 19 20:54:46 EST 2006


Log message for revision 66078:
  Modified develop.py to look to setup.cfg.in for default settings; updated README to mention setup.cfg.in.

Changed:
  U   projectsupport/trunk/README.txt
  U   projectsupport/trunk/src/workspace/develop.py

-=-
Modified: projectsupport/trunk/README.txt
===================================================================
--- projectsupport/trunk/README.txt	2006-03-19 17:42:16 UTC (rev 66077)
+++ projectsupport/trunk/README.txt	2006-03-20 01:54:45 UTC (rev 66078)
@@ -7,7 +7,7 @@
 develop.py
 ~~~~~~~~~~
 
-The develop.py script is used to create a sandbox from a zope project
+The develop.py script is used to create a workspace from a zope project
 checkout.  The script installs the development dependencies for the
 project in a library folder, and any binary scripts in a scripts
 folder.
@@ -16,9 +16,14 @@
 Configuring Development Dependencies
 ------------------------------------
 
-The script reads ``setup.cfg`` to read development dependencies.  When
-develop.py is run, it will add additional entries to setup.cfg
-specifying the library and scripts folders.  The minimal setup.cfg for
+The script reads ``setup.cfg`` to read development dependencies.  In the
+event that setup.cfg does not exist, the script will look for setup.cfg.in
+and copy it to setup.cfg.  Keeping setup.cfg.in in source control is 
+preferrable to setup.cfg, as develop.py will scribble path information on
+the resulting setup.cfg file.
+
+When develop.py is run, it will add additional entries to setup.cfg
+specifying the library and scripts folders.  The minimal setup.cfg[.in] for
 a project with development dependencies contains a single section with
 a single entry.  For example:
 

Modified: projectsupport/trunk/src/workspace/develop.py
===================================================================
--- projectsupport/trunk/src/workspace/develop.py	2006-03-19 17:42:16 UTC (rev 66077)
+++ projectsupport/trunk/src/workspace/develop.py	2006-03-20 01:54:45 UTC (rev 66078)
@@ -18,6 +18,7 @@
 
 import os
 import sys
+import shutil
 import optparse
 import ConfigParser
 import urllib2
@@ -50,10 +51,21 @@
                    '--script-dir', bindir,
                    '-U', 'setuptools'])
 
+def initSetupCfg(setup_file, template_file='setup.cfg.in'):
+    """Check if the setup_file (setup.cfg) exists; if it doesn't, and
+    setup.cfg.in does, copy setup.cfg.in to setup.cfg to serve as a
+    template."""
+
+    if not(os.path.exists(setup_file)) and os.path.exists(template_file):
+        shutil.copyfile(template_file, setup_file)
+        
 def updateSetupCfg(setup_file, opts):
     """Update or create a setup.cfg (setup_file) for working on this
     project."""
 
+    # initialize the setup file if necessary
+    initSetupCfg(setup_file)
+    
     # load the existing version
     setup_cfg = ConfigParser.ConfigParser()
     setup_cfg.read(setup_file)
@@ -95,8 +107,8 @@
     if not setup_cfg.has_option('egg_info', 'tag_build'):
         setup_cfg.set('egg_info', 'tag_build', '.dev')
 
-    if not setup_cfg.has_option('egg_info', 'tag_revision'):
-        setup_cfg.set('egg_info', 'tag_revision', '1')
+    if not setup_cfg.has_option('egg_info', 'tag_svn_revision'):
+        setup_cfg.set('egg_info', 'tag_svn_revision', '1')
 
     # store the updated version
     setup_cfg.write(file(setup_file, 'w'))



More information about the Checkins mailing list