Index: trunk/wikiation/installer/installer_util.py |
— | — | @@ -70,6 +70,9 @@ |
71 | 71 | def pretty_list(mylist,layout_width=None): |
72 | 72 | """format a list ~like ls""" |
73 | 73 | |
| 74 | + if not mylist: |
| 75 | + return "" |
| 76 | + |
74 | 77 | if layout_width==None: |
75 | 78 | layout_width=getTerminalSize()[0] |
76 | 79 | |
Index: trunk/wikiation/installer/installer.py |
— | — | @@ -81,8 +81,9 @@ |
82 | 82 | print \ |
83 | 83 | """available.mediawiki: installed.mediawiki: |
84 | 84 | 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: } |
87 | 88 | """ |
88 | 89 | return |
89 | 90 | installers.ls(args) |
Index: trunk/wikiation/installer/naive_installer.py |
— | — | @@ -9,66 +9,20 @@ |
10 | 10 | |
11 | 11 | from installation_system import Installation_System |
12 | 12 | from extension_installer import Extension_Installer_Exception |
| 13 | +from download_installer import Download_Installer, Download_Installer_Exception |
13 | 14 | |
14 | | -class Naive_Installer_Exception(Extension_Installer_Exception): |
| 15 | +class Naive_Installer_Exception(Download_Installer_Exception): |
15 | 16 | pass |
16 | 17 | |
17 | 18 | class Unsupported_Exception(Exception): |
18 | 19 | pass |
19 | 20 | |
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' |
22 | 25 | destination_dir=None |
23 | 26 | |
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 | | - |
73 | 27 | def install_settings(self,installer_name): |
74 | 28 | |
75 | 29 | settings=file(self._settings_filepath(installer_name),"w") |
— | — | @@ -85,8 +39,3 @@ |
86 | 40 | os.unlink(self._settings_filepath(installer_name)) |
87 | 41 | except OSError: |
88 | 42 | 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 @@ |
15 | 15 | from mediawiki_installer import Mediawiki_Installer |
16 | 16 | from naive_installer import Naive_Installer |
17 | 17 | from installation_system import Installer_Exception |
| 18 | +from download_installer import Download_Installer |
18 | 19 | |
19 | 20 | class Parse_Exception(Exception): |
20 | 21 | pass |
— | — | @@ -282,7 +283,7 @@ |
283 | 284 | |
284 | 285 | return sYstem() |
285 | 286 | |
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} |
287 | 288 | |
288 | 289 | if __name__=="__main__": |
289 | 290 | print "testing installers.py module" |
Index: trunk/wikiation/installer/installation_system.py |
— | — | @@ -170,9 +170,9 @@ |
171 | 171 | self.do_setup(installer_name,destination_dir) |
172 | 172 | |
173 | 173 | def do_setup(self, installer_name, destination_dir): |
| 174 | + #silently fail if there's no setup script |
174 | 175 | if not self.can_exec(installer_name,"setup"): |
175 | | - print "notice: cannot execute setup script for "+installer_name |
176 | | - return |
| 176 | + return |
177 | 177 | |
178 | 178 | self.exec_task(installer_name,"setup") |
179 | 179 | |