r47715 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r47714‎ | r47715 | r47716 >
Date:18:06, 23 February 2009
Author:kim
Status:deferred
Tags:
Comment:
Add download:
Modified paths:
  • /trunk/wikiation/installer/installation_system.py (modified) (history)
  • /trunk/wikiation/installer/installer.py (modified) (history)
  • /trunk/wikiation/installer/installer_util.py (modified) (history)
  • /trunk/wikiation/installer/installers.py (modified) (history)
  • /trunk/wikiation/installer/naive_installer.py (modified) (history)

Diff [purge]

Index: trunk/wikiation/installer/installer_util.py
@@ -70,6 +70,9 @@
7171 def pretty_list(mylist,layout_width=None):
7272 """format a list ~like ls"""
7373
 74+ if not mylist:
 75+ return ""
 76+
7477 if layout_width==None:
7578 layout_width=getTerminalSize()[0]
7679
Index: trunk/wikiation/installer/installer.py
@@ -81,8 +81,9 @@
8282 print \
8383 """available.mediawiki: installed.mediawiki:
8484 available.wikiation_toolkit: installed.wikiation_toolkit:
85 -available.extension: installed.extension:
86 -available.naive: installed.naive:
 85+available.extension: installed.extension: }
 86+available.naive: installed.naive: } extensions
 87+available.download: installer.download: }
8788 """
8889 return
8990 installers.ls(args)
Index: trunk/wikiation/installer/naive_installer.py
@@ -9,66 +9,20 @@
1010
1111 from installation_system import Installation_System
1212 from extension_installer import Extension_Installer_Exception
 13+from download_installer import Download_Installer, Download_Installer_Exception
1314
14 -class Naive_Installer_Exception(Extension_Installer_Exception):
 15+class Naive_Installer_Exception(Download_Installer_Exception):
1516 pass
1617
1718 class Unsupported_Exception(Exception):
1819 pass
1920
20 -class Naive_Installer(Installation_System):
21 - system_name='extensions'
 21+class Naive_Installer(Download_Installer):
 22+ """download an extension, and try to naively just require_once() it in
 23+ LocalSettings, this SHOULD work 60-80% of the time. (famous last words)"""
 24+ system_name='naive'
2225 destination_dir=None
2326
24 - def set_revision(self,revision):
25 - self.destination_dir=os.path.join(settings.revisionsdir,revision,"extensions")
26 - Installation_System.set_revision(self,revision)
27 -
28 - def get_installers(self):
29 - l=list(os.popen('svn ls '+settings.extensionsdir))
30 - # tidy l in place
31 - for i in range(len(l)):
32 - l[i]=l[i].strip()
33 - if l[i].endswith("/"):
34 - l[i]=l[i][:-1]
35 - return l
36 - #exists() ok.
37 -
38 - def installdir_name():
39 - raise Unsupported_Exception("naive installer does not use installdirs")
40 -
41 - def exec_task():
42 - raise Unsupported_Exception("naive installer does not use installdirs, and therefore also does not exec scripts in installdirs")
43 -
44 - def can_exec(self, installer_name, task):
45 - return False # we don't have an installdir, so we
46 - # can never exec a task.
47 -
48 - # get_installed: works ok.
49 -
50 - def is_installed(self, installer_name):
51 - if self.revision==None:
52 - raise Naive_Installer_Exception("no revision specified ... did you try doing ... in <Revision> ?")
53 - path=os.path.join(self.destination_dir,installer_name)
54 - return os.path.isdir(path)
55 -
56 - # get info will cause an exception to be raised
57 - # install: ok.
58 -
59 - def do_download (self, installer_name, destination_dir):
60 - os.chdir(destination_dir)
61 - command="svn checkout '"+\
62 - settings.extensionsdir+"/"+\
63 - installer_name+"'"
64 - #print command
65 - os.system(command)
66 -
67 - def _settings_filepath(self, installer_name):
68 - settingsdir=os.path.join(self.destination_dir,"../LocalSettings")
69 - filename=installer_name+".settings.php"
70 - filepath=os.path.join(settingsdir,filename)
71 - return filepath
72 -
7327 def install_settings(self,installer_name):
7428
7529 settings=file(self._settings_filepath(installer_name),"w")
@@ -85,8 +39,3 @@
8640 os.unlink(self._settings_filepath(installer_name))
8741 except OSError:
8842 pass
89 -
90 - def do_uninstall(self, installer_name, destination_dir):
91 - pathname=os.path.join(destination_dir, installer_name)
92 - shutil.rmtree(pathname,ignore_errors=True)
93 -
Index: trunk/wikiation/installer/installers.py
@@ -14,6 +14,7 @@
1515 from mediawiki_installer import Mediawiki_Installer
1616 from naive_installer import Naive_Installer
1717 from installation_system import Installer_Exception
 18+from download_installer import Download_Installer
1819
1920 class Parse_Exception(Exception):
2021 pass
@@ -282,7 +283,7 @@
283284
284285 return sYstem()
285286
286 -systems={'wikiation_toolkit':Toolkit_Installer,'extension': Extension_Installer, 'mediawiki':Mediawiki_Installer,'naive': Naive_Installer}
 287+systems={'wikiation_toolkit':Toolkit_Installer,'extension': Extension_Installer, 'mediawiki':Mediawiki_Installer,'naive': Naive_Installer, 'download':Download_Installer}
287288
288289 if __name__=="__main__":
289290 print "testing installers.py module"
Index: trunk/wikiation/installer/installation_system.py
@@ -170,9 +170,9 @@
171171 self.do_setup(installer_name,destination_dir)
172172
173173 def do_setup(self, installer_name, destination_dir):
 174+ #silently fail if there's no setup script
174175 if not self.can_exec(installer_name,"setup"):
175 - print "notice: cannot execute setup script for "+installer_name
176 - return
 176+ return
177177
178178 self.exec_task(installer_name,"setup")
179179

Status & tagging log