[sylvain] r51035 - in buildout/infrae.maildrophost/trunk: docs infrae/maildrophost

[email protected]
Newsgroups gmane.comp.web.zope.silva.cvs
Message-ID <[email protected]>
Author: sylvain
Date: Mon Aug 19 12:20:43 2013
New Revision: 51035

Modified:
   buildout/infrae.maildrophost/trunk/docs/HISTORY.txt
   buildout/infrae.maildrophost/trunk/infrae/maildrophost/__init__.py
   buildout/infrae.maildrophost/trunk/infrae/maildrophost/ctl.py
Log:
Update HISTORY, remove useless code.



Modified: buildout/infrae.maildrophost/trunk/docs/HISTORY.txt
==============================================================================
--- buildout/infrae.maildrophost/trunk/docs/HISTORY.txt	(original)
+++ buildout/infrae.maildrophost/trunk/docs/HISTORY.txt	Mon Aug 19 12:20:43 2013
@@ -5,7 +5,10 @@
 2.1 (unreleased)
 ----------------
 
-* ...
+* Update recipe to include the deamon script itself and update it to
+  work with Python 2.6 and 2.7. This script used to require Python 2.4.
+
+* Update the start/stop script to be more reliable with the help of `psutil`_.
 
 2.0 (2012-08-23)
 ----------------
@@ -56,3 +59,5 @@
 
 * First release, download and install MaildropHost product, make a
   ``config.py`` and create simple script for start and stop purpose.
+
+.. psutil: https://pypi.python.org/pypi/psutil

Modified: buildout/infrae.maildrophost/trunk/infrae/maildrophost/__init__.py
==============================================================================
--- buildout/infrae.maildrophost/trunk/infrae/maildrophost/__init__.py	(original)
+++ buildout/infrae.maildrophost/trunk/infrae/maildrophost/__init__.py	Mon Aug 19 12:20:43 2013
@@ -69,8 +69,7 @@
     def _build_script(self):
         """Create the startup script in the bin directory.
         """
-        requirements, ws = self.egg.working_set(['infrae.maildrophost',
-                                                 'Products.MaildropHost'])
+        requirements, ws = self.egg.working_set(['infrae.maildrophost',])
 
         return zc.buildout.easy_install.scripts(
             [(self.name, 'infrae.maildrophost.ctl', 'main')],

Modified: buildout/infrae.maildrophost/trunk/infrae/maildrophost/ctl.py
==============================================================================
--- buildout/infrae.maildrophost/trunk/infrae/maildrophost/ctl.py	(original)
+++ buildout/infrae.maildrophost/trunk/infrae/maildrophost/ctl.py	Mon Aug 19 12:20:43 2013
@@ -5,9 +5,10 @@
 
 import os
 import sys
-import pkg_resources
 import psutil
 
+SCRIPT = os.path.join(os.path.dirname(__file__), 'maildrop.py')
+
 
 def is_process_running(pid):
     """Return if a process with a given PID is actually running
@@ -43,16 +44,7 @@
 def maildrop_start(configuration, pidfile):
     """Start maildrophost.
     """
-    requirement = list(pkg_resources.parse_requirements(
-        'Products.MaildropHost'))[0]
-
-    distribution = pkg_resources.working_set.find(requirement)
-    if distribution is None:
-        print>>sys.stderr, 'Could not find MaildropHost egg.'
-        sys.exit(1)
-
-    script = os.path.join(os.path.dirname(__file__), 'maildrop.py')
-    if not os.path.isfile(script):
+    if not os.path.isfile(SCRIPT):
         print>>sys.stderr, 'Could not find MaildropHost server script.'
         sys.exit(1)
 
@@ -63,7 +55,7 @@
     ## if there's no running process then start one
     pid = maildrop_pid(pidfile)
     if not is_process_running(pid):
-        psutil.Popen([sys.executable, script, configuration])
+        psutil.Popen([sys.executable, SCRIPT, configuration])
         print>>sys.stdout, 'MaildropHost STARTED.'
     else:
         print>>sys.stderr, 'MaildropHost is already running with PID %s.' % pid
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.