Make the upload of translations also works.

The wescamp integration should be ready now except for more testing.
This commit is contained in:
Mark de Wever 2007-11-17 15:46:41 +00:00
parent de0a7a2703
commit 0e99f4a0e8
3 changed files with 40 additions and 10 deletions

View file

@ -6,7 +6,7 @@ Version 1.3.10+svn:
* campaign server
* fixed a bug which broke uploads with a .cfg file next to the campaign
directory
* enhanced wescamp integration (still not finished)
* finalized wescamp integration
* editor:
* fixed a bug which prevented the editor to load maps with a Windows EOL on
Windows, other platforms where not affected.

View file

@ -181,6 +181,30 @@ class SVN:
return (out != "")
"""Copies files from an svn checkout to a local directory.
dest Directory to copy to.
exclude List with names to ignore.
returns Nothing.
"""
def copy_from_svn(self, dest, exclude):
logging.debug("copy_from_svn dest = '%s' exclude = '%s'",
dest, exclude)
# Check whether the status of the repo is clean.
out, err = self.__execute("svn st " + self.checkout_path)
# If not clean or an error bail out.
if(err != ""):
raise error("status failed with message:" + err)
elif(out != ""):
raise error("checout is not clean:" + out)
# Update.
self.__sync_dir(self.checkout_path, dest, True, exclude)
##### PRIVATE #####

View file

@ -203,28 +203,34 @@ if __name__ == "__main__":
svn = libsvn.SVN(wescamp + "/" + addon)
if(svn.update() == False):
logging.info("svn up to date, nothing to send to server")
# The result of the update can be ignored, no changes when updating
# doesn't mean no changes to the translations.
svn.update()
# test whether the svn has a translations dir, if not we can stop
if(os.path.isdir(wescamp + "/"
+ addon + "/" + addon + "/translations") == False):
logging.info("Wescamp has no translations directory so we can stop.")
if(stamp == None):
return
else:
return True
# test whether the svn has a translations dir, if not we can stop
# extract the campaign from the server
extract(server, addon, target)
# delete translations
# delete translations, but make sure the translations
# directory exists afterwards.
if(os.path.isdir(target + "/" + addon + "/translations")):
shutil.rmtree(target + "/" + addon + "/translations")
# copy the new translations
if(os.path.isdir(target + "/" + addon + "/translations") == False):
os.mkdir(target + "/" + addon + "/translations")
os.mkdir(target + "/" + addon + "/translations")
svn.sync_dir(svn.checkout_path + "/" + addon + "/translations" ,
target + "/" + addon + "/translations", True, None)
# copy the translations
svn = libsvn.SVN(wescamp + "/" + addon + "/" + addon + "/translations")
svn.copy_from_svn(target + "/" + addon + "/translations", None)
# upload to the server
wml = libwml.CampaignClient(server)