[sylvain] r51083 - in buildout/infrae.maildrophost/branches/infrae.maildrophost-1.x: . docs infrae/maildrophost

[email protected] Fri, 20 Sep 2013 13:07:31 +0200 (CEST)
Newsgroups gmane.comp.web.zope.silva.cvs
Message-ID <[email protected]>
Author: sylvain
Date: Fri Sep 20 13:07:31 2013
New Revision: 51083

Added:
   buildout/infrae.maildrophost/branches/infrae.maildrophost-1.x/MANIFEST.in
Modified:
   buildout/infrae.maildrophost/branches/infrae.maildrophost-1.x/docs/HISTORY.txt
   buildout/infrae.maildrophost/branches/infrae.maildrophost-1.x/infrae/maildrophost/__init__.py
   buildout/infrae.maildrophost/branches/infrae.maildrophost-1.x/setup.py
Log:
Add an option to not create directories.


Added: buildout/infrae.maildrophost/branches/infrae.maildrophost-1.x/MANIFEST.in
==============================================================================
--- (empty file)
+++ buildout/infrae.maildrophost/branches/infrae.maildrophost-1.x/MANIFEST.in	Fri Sep 20 13:07:31 2013
@@ -0,0 +1,3 @@
+recursive-include infrae *.py
+recursive-include docs *.txt
+include README.txt

Modified: buildout/infrae.maildrophost/branches/infrae.maildrophost-1.x/docs/HISTORY.txt
==============================================================================
--- buildout/infrae.maildrophost/branches/infrae.maildrophost-1.x/docs/HISTORY.txt	(original)
+++ buildout/infrae.maildrophost/branches/infrae.maildrophost-1.x/docs/HISTORY.txt	Fri Sep 20 13:07:31 2013
@@ -2,6 +2,12 @@
 History
 =======
 
+1.2.1 (2013-09-20)
+------------------
+
+* Add an option ``dont_create_directories`` to disable the creation of
+  directories.
+
 1.2 (2009-02-13)
 ----------------
 

Modified: buildout/infrae.maildrophost/branches/infrae.maildrophost-1.x/infrae/maildrophost/__init__.py
==============================================================================
--- buildout/infrae.maildrophost/branches/infrae.maildrophost-1.x/infrae/maildrophost/__init__.py	(original)
+++ buildout/infrae.maildrophost/branches/infrae.maildrophost-1.x/infrae/maildrophost/__init__.py	Fri Sep 20 13:07:31 2013
@@ -3,7 +3,7 @@
 # See also LICENSE.txt
 # $Id$
 
-import os, re, shutil, tempfile, urllib2, urlparse
+import os, shutil, tempfile, urllib2, urlparse
 import zc.buildout, zc.recipe.egg
 import setuptools
 
@@ -28,6 +28,9 @@
             version = options.get('version')
             self.url = URL % (version, version)
 
+        self.dont_create_directories = options.get(
+            'dont_create_directories',
+            'no').lower() in set(['yes', 'on' , 'true'])
         self.egg = zc.recipe.egg.Egg(buildout, options['recipe'], options)
         self.mail_dir = self.options.get('mail_dir', None)
         if not self.mail_dir:
@@ -66,7 +69,6 @@
         finally:
             shutil.rmtree(tmp)
 
-
         return self.update()
 
     def _build_config(self):
@@ -74,16 +76,15 @@
         directory used by the maildrop server.
         """
 
-        if not os.path.exists(self.mail_dir):
-            os.makedirs(self.mail_dir)
-
         spool_dir = self.options.get(
             'spool_dir', None) or os.path.join(self.mail_dir, 'spool')
-        if not os.path.exists(spool_dir):
-            os.makedirs(spool_dir)
-
         pid_file = self.options.get(
             'pid_file', None) or os.path.join(self.mail_dir, 'maildrop.pid')
+        if not self.dont_create_directories:
+            if not os.path.exists(self.mail_dir):
+                os.makedirs(self.mail_dir)
+            if not os.path.exists(spool_dir):
+                os.makedirs(spool_dir)
 
         config_option = dict(
             smtp_host=self.options.get('smtp_host', 'localhost'),
@@ -113,7 +114,6 @@
     def _build_script(self):
         """Create the startup script in the bin directory.
         """
-
         requirements, ws = self.egg.working_set(['infrae.maildrophost'])
         pidfile=self.options.get(
             'pid_file', None) or os.path.join(self.mail_dir, 'maildrop.pid')
@@ -128,7 +128,6 @@
     def update(self):
         """Update the maildrophost server
         """
-
         try:
             self._build_config()
             self._build_script()

Modified: buildout/infrae.maildrophost/branches/infrae.maildrophost-1.x/setup.py
==============================================================================
--- buildout/infrae.maildrophost/branches/infrae.maildrophost-1.x/setup.py	(original)
+++ buildout/infrae.maildrophost/branches/infrae.maildrophost-1.x/setup.py	Fri Sep 20 13:07:31 2013
@@ -7,7 +7,7 @@
 
 name = "infrae.maildrophost"
 setup(name = name,
-      version = "1.2",
+      version = "1.2.1",
       author = "Sylvain Viollon",
       author_email = "[email protected]",
       description = "Recipe to install and setup maildrophost server",