r47716 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r47715‎ | r47716 | r47717 >
Date:18:16, 23 February 2009
Author:kim
Status:deferred
Tags:
Comment:
Common error... forget to svn add the new file :-/
Modified paths:
  • /trunk/wikiation/installer/download_installer.py (added) (history)

Diff [purge]

Index: trunk/wikiation/installer/download_installer.py
@@ -0,0 +1,76 @@
 2+# This software, copyright (C) 2008-2009 by Wikiation.
 3+# This software is developed by Kim Bruning.
 4+#
 5+# Distributed under the terms of the MIT license.
 6+
 7+import settings
 8+import os, os.path, shutil
 9+import subprocess
 10+
 11+from installation_system import Installation_System
 12+from extension_installer import Extension_Installer_Exception
 13+
 14+class Download_Installer_Exception(Extension_Installer_Exception):
 15+ pass
 16+
 17+class Unsupported_Exception(Exception):
 18+ pass
 19+
 20+class Download_Installer(Installation_System):
 21+ """download an extension, do nothing else"""
 22+ system_name='download'
 23+ destination_dir=None
 24+
 25+ def set_revision(self,revision):
 26+ self.destination_dir=os.path.join(settings.revisionsdir,revision,"extensions")
 27+ Installation_System.set_revision(self,revision)
 28+
 29+ def get_installers(self):
 30+ l=list(os.popen('svn ls '+settings.extensionsdir))
 31+ # tidy l in place
 32+ for i in range(len(l)):
 33+ l[i]=l[i].strip()
 34+ if l[i].endswith("/"):
 35+ l[i]=l[i][:-1]
 36+ return l
 37+ #exists() ok.
 38+
 39+ def installdir_name():
 40+ raise Unsupported_Exception("naive installer does not use installdirs")
 41+
 42+ def exec_task():
 43+ raise Unsupported_Exception("naive installer does not use installdirs, and therefore also does not exec scripts in installdirs")
 44+
 45+ def can_exec(self, installer_name, task):
 46+ return False # we don't have an installdir, so we
 47+ # can never exec a task.
 48+
 49+ # get_installed: works ok.
 50+
 51+ def is_installed(self, installer_name):
 52+ if self.revision==None:
 53+ raise Download_Installer_Exception("no revision specified ... did you try doing ... in <Revision> ?")
 54+ path=os.path.join(self.destination_dir,installer_name)
 55+ return os.path.isdir(path)
 56+
 57+ # get info will cause an exception to be raised
 58+ # install: ok.
 59+
 60+ def do_download (self, installer_name, destination_dir):
 61+ os.chdir(destination_dir)
 62+ command="svn checkout '"+\
 63+ settings.extensionsdir+"/"+\
 64+ installer_name+"'"
 65+ #print command
 66+ os.system(command)
 67+
 68+ def _settings_filepath(self, installer_name):
 69+ settingsdir=os.path.join(self.destination_dir,"../LocalSettings")
 70+ filename=installer_name+".settings.php"
 71+ filepath=os.path.join(settingsdir,filename)
 72+ return filepath
 73+
 74+ def do_uninstall(self, installer_name, destination_dir):
 75+ pathname=os.path.join(destination_dir, installer_name)
 76+ shutil.rmtree(pathname,ignore_errors=True)
 77+

Status & tagging log