mail[Wesnoth-commits] r37271 - in /trunk/data/tools: wesnoth/campaignserver_client.py wesnoth_addon_manager


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by elias on July 27, 2009 - 16:20:
Author: elias
Date: Mon Jul 27 16:20:33 2009
New Revision: 37271

URL: http://svn.gna.org/viewcvs/wesnoth?rev=37271&view=rev
Log:
[wesnoth_addon_manager] Really remove campaign. Also remove old-style 
top-level campaign.cfg.

Modified:
    trunk/data/tools/wesnoth/campaignserver_client.py
    trunk/data/tools/wesnoth_addon_manager

Modified: trunk/data/tools/wesnoth/campaignserver_client.py
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/data/tools/wesnoth/campaignserver_client.py?rev=37271&r1=37270&r2=37271&view=diff
==============================================================================
--- trunk/data/tools/wesnoth/campaignserver_client.py (original)
+++ trunk/data/tools/wesnoth/campaignserver_client.py Mon Jul 27 16:20:33 2009
@@ -431,7 +431,6 @@
         path is the path under which it will be placed.
         """
 
-        shutil.rmtree(path, True)
         try:
             os.mkdir(path)
         except OSError:

Modified: trunk/data/tools/wesnoth_addon_manager
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/data/tools/wesnoth_addon_manager?rev=37271&r1=37270&r2=37271&view=diff
==============================================================================
--- trunk/data/tools/wesnoth_addon_manager (original)
+++ trunk/data/tools/wesnoth_addon_manager Mon Jul 27 16:20:33 2009
@@ -9,7 +9,7 @@
 add-ons.
 """
 
-import sys, os.path, re, time, glob
+import sys, os.path, re, time, glob, shutil
 from subprocess import Popen
 import wesnoth.wmldata as wmldata
 import wesnoth.wmlparser as wmlparser
@@ -122,9 +122,18 @@
             file(name, "w").write(mythread.data)
         else:
             decoded = cs.decode(mythread.data)
+            dirname = os.path.join(cdir, name)
+            oldcfg_path = os.path.join(cdir, name + ".cfg")
+
+            # Try to remove old campaign in case it exists.
+            shutil.rmtree(dirname, True)
+            try: os.remove(oldcfg_path)
+            except OSError: pass
+
             print "Unpacking %s..." % name
             cs.unpackdir(decoded, cdir, verbose = options.verbose)
-            dirname = os.path.join(cdir, name)
+            
+
             info = os.path.join(dirname, "_info.cfg")
             try:
                 f = file(info, "w")
@@ -140,7 +149,6 @@
                 try: os.mkdir(options.tar)
                 except OSError: pass
                 tarname = options.tar + "/" + name + ".tar.bz2"
-                oldcfg_path = os.path.join(cdir, name + ".cfg")
                 if os.path.isfile(oldcfg_path):
                     oldcfg = name + ".cfg"
                     if options.verbose:
@@ -354,8 +362,8 @@
                     elif sversion == lversion:
                         sys.stdout.write(" # " + dirname + " - is version " +
                             sversion + (" but you have revision %s not %s." +
-                           " (The add-on got re-uploaded.)\n") %
-                           (lrev, srev))
+                            " (The add-on got re-uploaded.)\n") %
+                            (lrev, srev))
                         if srev > lrev: # server reset?
                             if options.update:
                                 get(dirname, sversion, srev, cdir)




Related Messages


Powered by MHonArc, Updated Mon Jul 27 16:41:20 2009