eric6/PluginManager/PluginManager.py

changeset 7836
2f0d208b8137
parent 7785
9978016560ec
child 7900
72b88fb20261
child 7924
8a96736d465e
equal deleted inserted replaced
7835:0835ed67714b 7836:2f0d208b8137
206 fname = os.path.join(path, "__init__.py") 206 fname = os.path.join(path, "__init__.py")
207 if not os.path.exists(fname): 207 if not os.path.exists(fname):
208 try: 208 try:
209 with open(fname, "w"): 209 with open(fname, "w"):
210 pass 210 pass
211 except IOError: 211 except OSError:
212 return ( 212 return (
213 False, 213 False,
214 self.tr("Could not create a package for {0}.") 214 self.tr("Could not create a package for {0}.")
215 .format(self.__develPluginFile)) 215 .format(self.__develPluginFile))
216 216
219 if not os.path.exists(self.pluginDirs["user"]): 219 if not os.path.exists(self.pluginDirs["user"]):
220 os.mkdir(self.pluginDirs["user"], 0o755) 220 os.mkdir(self.pluginDirs["user"], 0o755)
221 try: 221 try:
222 with open(fname, "w"): 222 with open(fname, "w"):
223 pass 223 pass
224 except IOError: 224 except OSError:
225 del self.pluginDirs["user"] 225 del self.pluginDirs["user"]
226 226
227 if ( 227 if (
228 not os.path.exists(self.pluginDirs["global"]) and 228 not os.path.exists(self.pluginDirs["global"]) and
229 os.access(Utilities.getPythonModulesDirectory(), os.W_OK) 229 os.access(Utilities.getPythonModulesDirectory(), os.W_OK)
1201 downloadDir = self.__defaultDownloadDir 1201 downloadDir = self.__defaultDownloadDir
1202 1202
1203 if not os.path.exists(downloadDir): 1203 if not os.path.exists(downloadDir):
1204 try: 1204 try:
1205 os.mkdir(downloadDir, 0o755) 1205 os.mkdir(downloadDir, 0o755)
1206 except (OSError, IOError): 1206 except OSError:
1207 # try again with (possibly) new default 1207 # try again with (possibly) new default
1208 downloadDir = self.__defaultDownloadDir 1208 downloadDir = self.__defaultDownloadDir
1209 if not os.path.exists(downloadDir): 1209 if not os.path.exists(downloadDir):
1210 try: 1210 try:
1211 os.mkdir(downloadDir, 0o755) 1211 os.mkdir(downloadDir, 0o755)
1212 except (OSError, IOError) as err: 1212 except OSError as err:
1213 E5MessageBox.critical( 1213 E5MessageBox.critical(
1214 self.__ui, 1214 self.__ui,
1215 self.tr("Plugin Manager Error"), 1215 self.tr("Plugin Manager Error"),
1216 self.tr( 1216 self.tr(
1217 """<p>The plugin download directory""" 1217 """<p>The plugin download directory"""

eric ide

mercurial