188 return ( |
188 return ( |
189 False, |
189 False, |
190 self.tr("Could not create a package for {0}.") |
190 self.tr("Could not create a package for {0}.") |
191 .format(self.__develPluginFile)) |
191 .format(self.__develPluginFile)) |
192 |
192 |
193 if Preferences.getPluginManager("ActivateExternal"): |
193 fname = os.path.join(self.pluginDirs["user"], "__init__.py") |
194 fname = os.path.join(self.pluginDirs["user"], "__init__.py") |
194 if not os.path.exists(fname): |
195 if not os.path.exists(fname): |
195 if not os.path.exists(self.pluginDirs["user"]): |
196 if not os.path.exists(self.pluginDirs["user"]): |
196 os.mkdir(self.pluginDirs["user"], 0o755) |
197 os.mkdir(self.pluginDirs["user"], 0o755) |
197 try: |
198 try: |
198 f = open(fname, "w") |
199 f = open(fname, "w") |
|
200 f.close() |
|
201 except IOError: |
|
202 del self.pluginDirs["user"] |
|
203 |
|
204 if not os.path.exists(self.pluginDirs["global"]) and \ |
|
205 os.access(Utilities.getPythonModulesDirectory(), os.W_OK): |
|
206 # create the global plugins directory |
|
207 os.mkdir(self.pluginDirs["global"], 0o755) |
|
208 fname = os.path.join(self.pluginDirs["global"], "__init__.py") |
|
209 f = open(fname, "w", encoding="utf-8") |
|
210 f.write('# -*- coding: utf-8 -*-' + "\n") |
|
211 f.write("\n") |
|
212 f.write('"""' + "\n") |
|
213 f.write('Package containing the global plugins.' + "\n") |
|
214 f.write('"""' + "\n") |
|
215 f.close() |
199 f.close() |
216 if not os.path.exists(self.pluginDirs["global"]): |
200 except IOError: |
217 del self.pluginDirs["global"] |
201 del self.pluginDirs["user"] |
218 else: |
202 |
219 del self.pluginDirs["user"] |
203 if not os.path.exists(self.pluginDirs["global"]) and \ |
|
204 os.access(Utilities.getPythonModulesDirectory(), os.W_OK): |
|
205 # create the global plugins directory |
|
206 os.mkdir(self.pluginDirs["global"], 0o755) |
|
207 fname = os.path.join(self.pluginDirs["global"], "__init__.py") |
|
208 f = open(fname, "w", encoding="utf-8") |
|
209 f.write('# -*- coding: utf-8 -*-' + "\n") |
|
210 f.write("\n") |
|
211 f.write('"""' + "\n") |
|
212 f.write('Package containing the global plugins.' + "\n") |
|
213 f.write('"""' + "\n") |
|
214 f.close() |
|
215 if not os.path.exists(self.pluginDirs["global"]): |
220 del self.pluginDirs["global"] |
216 del self.pluginDirs["global"] |
221 |
217 |
222 if not os.path.exists(self.pluginDirs["eric6"]): |
218 if not os.path.exists(self.pluginDirs["eric6"]): |
223 return ( |
219 return ( |
224 False, |
220 False, |
238 not os.path.exists(self.__develPluginFile): |
234 not os.path.exists(self.__develPluginFile): |
239 return False |
235 return False |
240 |
236 |
241 self.__foundCoreModules = self.getPluginModules( |
237 self.__foundCoreModules = self.getPluginModules( |
242 self.pluginDirs["eric6"]) |
238 self.pluginDirs["eric6"]) |
243 if "global" in self.pluginDirs: |
239 if Preferences.getPluginManager("ActivateExternal"): |
244 self.__foundGlobalModules = \ |
240 if "global" in self.pluginDirs: |
245 self.getPluginModules(self.pluginDirs["global"]) |
241 self.__foundGlobalModules = \ |
246 if "user" in self.pluginDirs: |
242 self.getPluginModules(self.pluginDirs["global"]) |
247 self.__foundUserModules = \ |
243 if "user" in self.pluginDirs: |
248 self.getPluginModules(self.pluginDirs["user"]) |
244 self.__foundUserModules = \ |
|
245 self.getPluginModules(self.pluginDirs["user"]) |
249 |
246 |
250 return len(self.__foundCoreModules + self.__foundGlobalModules + |
247 return len(self.__foundCoreModules + self.__foundGlobalModules + |
251 self.__foundUserModules) > 0 |
248 self.__foundUserModules) > 0 |
252 |
249 |
253 def getPluginModules(self, pluginPath): |
250 def getPluginModules(self, pluginPath): |