[Python-checkins] r43392 - sandbox/trunk/welease/welease.glade sandbox/trunk/welease/welease.py

anthony.baxter python-checkins at python.org
Tue Mar 28 11:30:04 CEST 2006


Author: anthony.baxter
Date: Tue Mar 28 11:30:03 2006
New Revision: 43392

Modified:
   sandbox/trunk/welease/welease.glade
   sandbox/trunk/welease/welease.py
Log:
check local rev and repos rev match. 
hook up abort button.


Modified: sandbox/trunk/welease/welease.glade
==============================================================================
--- sandbox/trunk/welease/welease.glade	(original)
+++ sandbox/trunk/welease/welease.glade	Tue Mar 28 11:30:03 2006
@@ -322,7 +322,7 @@
 	      <child>
 		<widget class="GtkLabel" id="checkReleaseLabel">
 		  <property name="visible">True</property>
-		  <property name="label" translatable="yes">&lt;b&gt;Not Ok&lt;/b&gt;</property>
+		  <property name="label" translatable="yes">&lt;b&gt;Not Done&lt;/b&gt;</property>
 		  <property name="use_underline">False</property>
 		  <property name="use_markup">True</property>
 		  <property name="justify">GTK_JUSTIFY_LEFT</property>
@@ -350,7 +350,7 @@
 	      <child>
 		<widget class="GtkLabel" id="makeTagLabel">
 		  <property name="visible">True</property>
-		  <property name="label" translatable="yes">&lt;b&gt;Not Ok&lt;/b&gt;</property>
+		  <property name="label" translatable="yes">&lt;b&gt;Not Done&lt;/b&gt;</property>
 		  <property name="use_underline">False</property>
 		  <property name="use_markup">True</property>
 		  <property name="justify">GTK_JUSTIFY_LEFT</property>
@@ -378,7 +378,7 @@
 	      <child>
 		<widget class="GtkLabel" id="exportSvnLabel">
 		  <property name="visible">True</property>
-		  <property name="label" translatable="yes">&lt;b&gt;Not Ok&lt;/b&gt;</property>
+		  <property name="label" translatable="yes">&lt;b&gt;Not Done&lt;/b&gt;</property>
 		  <property name="use_underline">False</property>
 		  <property name="use_markup">True</property>
 		  <property name="justify">GTK_JUSTIFY_LEFT</property>
@@ -406,7 +406,7 @@
 	      <child>
 		<widget class="GtkLabel" id="buildTarballsLabel">
 		  <property name="visible">True</property>
-		  <property name="label" translatable="yes">&lt;b&gt;Not Ok&lt;/b&gt;</property>
+		  <property name="label" translatable="yes">&lt;b&gt;Not Done&lt;/b&gt;</property>
 		  <property name="use_underline">False</property>
 		  <property name="use_markup">True</property>
 		  <property name="justify">GTK_JUSTIFY_LEFT</property>

Modified: sandbox/trunk/welease/welease.py
==============================================================================
--- sandbox/trunk/welease/welease.py	(original)
+++ sandbox/trunk/welease/welease.py	Tue Mar 28 11:30:03 2006
@@ -23,14 +23,15 @@
 # TODO:
 #   Fix the scrolling in the output box
 #   Move configuration out to a .weleasewc (and maybe a prefs panel? naaah)
-#   Make the 'Abort' button work
 #   Add a *lot* more checks to the Check Release stage.
 
 # Check Release steps:
+# XXX = not implemented yet.
 # 
 # Checks Include/patchlevel.h (fatal if wrong)
 # Checks for uncommitted changes in the checkout (nonfatal)
 # Checks Lib/idlelib/idlever.py (fatal)
+# Checks the revision in the checkout is the same as repository HEAD (fatal)
 # Checks Misc/NEWS and Lib/idlelib/NEWS.txt (nonfatal) [XXX]
 # Checks PCbuild/BUILDno.txt ? [XXX]
 # Checks Tools/msi/msi.py ? [XXX]
@@ -73,6 +74,7 @@
 
 class WeleaseWindow:
     currentBranch = 'trunk'
+    currentProcess = None
     warnDefer = None
 
     def __init__(self):
@@ -138,7 +140,9 @@
         self.currentBranch = model[active][0]
 
     def on_currentCommandAbort_clicked(self, e):
-        self.warnPopup("Sorry 'Abort' not implemented yet")
+        if self.currentProcess is not None:
+            self.currentProcess.signalProcess('KILL')
+            self._clearCurrentProcess(None)
 
     def do_command(self, cmdargs, capture=False):
         pprint_cmd = ''
@@ -153,19 +157,22 @@
             pp = ProcessCapture(self.logger)
         else:
             pp = ProcessOutput(self.logger)
-        reactor.spawnProcess(pp, cmdargs[0], cmdargs, buildEnv())
+        self.currentProcess = reactor.spawnProcess(pp, cmdargs[0], cmdargs, 
+                                                   buildEnv())
         ccmdtext = self.xml.get_widget('currentCommandText')
         abortButton = self.xml.get_widget('currentCommandAbort')
         abortButton.set_sensitive(True)
         ccmdtext.set_text(pprint_cmd)
-        def clear_ccmd(x):
-            ccmdtext.set_text('')
-            abortButton.set_sensitive(False)
-            return x
         d = pp.defer
-        d.addCallback(clear_ccmd)
+        d.addCallback(self._clearCurrentProcess)
         return d
 
+    def _clearCurrentProcess(self, x):
+        self.currentProcess = None
+        self.xml.get_widget('currentCommandText').set_text('')
+        self.xml.get_widget('currentCommandAbort').set_sensitive(False)
+        return x
+
     def on_checkReleaseButton_clicked(self, e):
         if not self.currentBranch:
             return
@@ -230,6 +237,41 @@
             int(pyver[1]) - 3  != int(idlever[1]) or 
             pyver[2] != idlever[2]):
             return self.warnPopup('Lib/idlelib/idlever.py is not correct')
+        self.checkReleaseGetSvnRevisions()
+
+    def checkReleaseGetSvnRevisions(self):
+        checkout = CheckoutPaths[self.currentBranch]
+        reposurl = SvnPaths[self.currentBranch]
+        d = self.do_command(["svn", "info", reposurl, checkout], capture=True)
+        d.addCallback(self.checkReleaseCurrentSvn)
+
+    def checkReleaseCurrentSvn(self, (stdout,stderr)):
+        # Examine the "svn info" output, compare the revisions.
+        checkout = CheckoutPaths[self.currentBranch]
+        reposurl = SvnPaths[self.currentBranch]
+        crev = localrev = reposrev = None
+        for line in stdout.splitlines():
+            line = line.strip().split(':', 1)
+            #print line
+            if line[0] == "Path":
+                #print "Path:", line[1]
+                if line[1].strip() in (os.path.basename(reposurl), reposurl):
+                    crev = 'remote'
+                elif line[1].strip() == checkout:
+                    crev = 'local'
+            if line[0] == "Revision":
+                r = line[1].strip()
+                if crev == 'remote':
+                    reposrev = r
+                elif crev == 'local':
+                    localrev = r
+                else:
+                    print "revision is for neither local nor remote??"
+                crev = None
+        if localrev != reposrev:
+            return self.warnPopup('SVN checkout is not current\n' +
+                                  checkout + '\n' +
+                                  'repos: %s, local: %s'%(reposrev, localrev))
         self.checkReleaseCheckNewsFiles()
     
     def checkReleaseCheckNewsFiles(self):
@@ -362,7 +404,7 @@
 
     def processEnded(self, status_object):
         exitval = status_object.value.exitCode
-        self.output.write("[process ended with exitcode %d]\n"%(exitval))
+        self.output.write("[process ended with exitcode %s]\n"%(exitval))
         self.triggerDeferred(exitval)
 
     def triggerDeferred(self, exitval):


More information about the Python-checkins mailing list