[Checkins] SVN: gocept.zope3instance/trunk/ - Added ability to
create the log_dir, run_dir, etc. from this recipe
Christian Theune
ct at gocept.com
Thu Jul 26 03:29:13 EDT 2007
Log message for revision 78344:
- Added ability to create the log_dir, run_dir, etc. from this recipe
- Refactored dependency on zope.testing into an extra.
--This line, and those below, will be ignored--
M buildout.cfg
M src/gocept/zope3instance/__init__.py
M setup.py
Changed:
U gocept.zope3instance/trunk/buildout.cfg
U gocept.zope3instance/trunk/setup.py
U gocept.zope3instance/trunk/src/gocept/zope3instance/__init__.py
-=-
Modified: gocept.zope3instance/trunk/buildout.cfg
===================================================================
--- gocept.zope3instance/trunk/buildout.cfg 2007-07-26 06:48:06 UTC (rev 78343)
+++ gocept.zope3instance/trunk/buildout.cfg 2007-07-26 07:29:12 UTC (rev 78344)
@@ -5,4 +5,4 @@
[test]
recipe = zc.recipe.testrunner
-eggs = gocept.zope3instance
+eggs = gocept.zope3instance [test]
Modified: gocept.zope3instance/trunk/setup.py
===================================================================
--- gocept.zope3instance/trunk/setup.py 2007-07-26 06:48:06 UTC (rev 78343)
+++ gocept.zope3instance/trunk/setup.py 2007-07-26 07:29:12 UTC (rev 78344)
@@ -3,7 +3,7 @@
name = "gocept.zope3instance"
setup(
name = name,
- version = "2.0a1",
+ version = "2.0a2",
author = "Christian Theune",
author_email = "ct at gocept.com",
description = "zc.buildout recipe for defining a Zope 3 instance",
@@ -27,8 +27,8 @@
'zope.app.server',
'zope.app.tree',
'zope.app.zcmlfiles',
- 'zope.testing',
],
+ extras_require=dict(test=['zope.testing']),
dependency_links = ['http://amy.gocept.com/~ctheune/eggs/'],
entry_points = {
'zc.buildout': [
Modified: gocept.zope3instance/trunk/src/gocept/zope3instance/__init__.py
===================================================================
--- gocept.zope3instance/trunk/src/gocept/zope3instance/__init__.py 2007-07-26 06:48:06 UTC (rev 78343)
+++ gocept.zope3instance/trunk/src/gocept/zope3instance/__init__.py 2007-07-26 07:29:12 UTC (rev 78344)
@@ -63,6 +63,7 @@
def install(self):
options = self.options
+ destructible_paths = set()
extra = options.get('extra-paths', '')
options['extra-paths'] = extra
@@ -75,12 +76,17 @@
for dir in ['log_dir', 'run_dir', 'subprogram_dir', 'config_dir']:
if not options.has_key(dir):
options[dir] = dest
+ if not os.path.exists(options[dir]):
+ make_tree_dir(options[dir])
+ destructible_paths.add(options['subprogram_dir'])
+ destructible_paths.add(options['config_dir'])
+
options['site_zcml_path'] = os.path.join(options['config_dir'], 'site.zcml')
- # XXX In theory we could just delete the parts directory here, if it
- # exists already. Or not?
- os.mkdir(dest)
+ if not os.path.exists(dest):
+ os.mkdir(dest)
+ destructible_paths.add(dest)
requirements, ws = self.egg.working_set(['gocept.zope3instance'])
@@ -124,7 +130,9 @@
self.installSkeleton(options['skeleton'].split(),
options['config_dir'],
options)
- return dest, os.path.join(options['bin-directory'], self.name)
+ destructible_paths.add(os.path.join(options['bin-directory'],
+ self.name))
+ return tuple(destructible_paths)
def installSkeleton(self, sources, dest, options):
@@ -190,3 +198,13 @@
file(new_name, 'w').write(new_contents)
os.remove(in_file)
+
+
+def make_tree_dir(path):
+ """Create a directory, even if that implies creating multiple levels of
+ directories.
+ """
+ tail, head = os.path.split(path)
+ if not os.path.exists(tail):
+ make_tree_dir(tail)
+ os.mkdir(path)
More information about the Checkins
mailing list