install.py

changeset 1381
b66bcd609f83
parent 1346
8c9af7608afa
child 1385
9eaf0cda4fb4
equal deleted inserted replaced
1380:27c9c4ae64fd 1381:b66bcd609f83
303 "eric5_tray", "eric5_editor", 303 "eric5_tray", "eric5_editor",
304 "eric5_plugininstall", "eric5_pluginuninstall", 304 "eric5_plugininstall", "eric5_pluginuninstall",
305 "eric5_pluginrepository", "eric5_sqlbrowser", 305 "eric5_pluginrepository", "eric5_sqlbrowser",
306 "eric5_webbrowser", "eric5_iconeditor", 306 "eric5_webbrowser", "eric5_iconeditor",
307 ] 307 ]
308 for rem_wname in rem_wnames: 308
309 rwname = wrapperName(getConfig('bindir'), rem_wname) 309 try:
310 if os.path.exists(rwname): 310 for rem_wname in rem_wnames:
311 os.remove(rwname) 311 rwname = wrapperName(getConfig('bindir'), rem_wname)
312 312 if os.path.exists(rwname):
313 # Cleanup our config file(s) 313 os.remove(rwname)
314 for name in ['eric5config.py', 'eric5config.pyc', 'eric5.pth']: 314
315 e5cfile = os.path.join(pyModDir, name) 315 # Cleanup our config file(s)
316 if os.path.exists(e5cfile): 316 for name in ['eric5config.py', 'eric5config.pyc', 'eric5.pth']:
317 os.remove(e5cfile) 317 e5cfile = os.path.join(pyModDir, name)
318 e5cfile = os.path.join(pyModDir, "__pycache__", name) 318 if os.path.exists(e5cfile):
319 path, ext = os.path.splitext(e5cfile) 319 os.remove(e5cfile)
320 for f in glob.glob("{0}.*{1}".format(path, ext)): 320 e5cfile = os.path.join(pyModDir, "__pycache__", name)
321 os.remove(f) 321 path, ext = os.path.splitext(e5cfile)
322 322 for f in glob.glob("{0}.*{1}".format(path, ext)):
323 # Cleanup the install directories 323 os.remove(f)
324 for name in ['ericExamplesDir', 'ericDocDir', 'ericDTDDir', 'ericCSSDir', 324
325 'ericIconDir', 'ericPixDir', 'ericTemplatesDir', 'ericCodeTemplatesDir', 325 # Cleanup the install directories
326 'ericOthersDir', 'ericStylesDir', 'ericDir']: 326 for name in ['ericExamplesDir', 'ericDocDir', 'ericDTDDir', 'ericCSSDir',
327 if os.path.exists(getConfig(name)): 327 'ericIconDir', 'ericPixDir', 'ericTemplatesDir', 'ericCodeTemplatesDir',
328 shutil.rmtree(getConfig(name), True) 328 'ericOthersDir', 'ericStylesDir', 'ericDir']:
329 329 if os.path.exists(getConfig(name)):
330 # Cleanup translations 330 shutil.rmtree(getConfig(name), True)
331 for name in glob.glob(os.path.join(getConfig('ericTranslationsDir'), 'eric5_*.qm')): 331
332 if os.path.exists(name): 332 # Cleanup translations
333 os.remove(name) 333 for name in glob.glob(os.path.join(getConfig('ericTranslationsDir'), 'eric5_*.qm')):
334 334 if os.path.exists(name):
335 # Cleanup API files 335 os.remove(name)
336 try: 336
337 apidir = getConfig('apidir') 337 # Cleanup API files
338 for progLanguage in progLanguages: 338 try:
339 for name in getConfig('apis'): 339 apidir = getConfig('apidir')
340 apiname = os.path.join(apidir, progLanguage.lower(), name) 340 for progLanguage in progLanguages:
341 if os.path.exists(apiname): 341 for name in getConfig('apis'):
342 apiname = os.path.join(apidir, progLanguage.lower(), name)
343 if os.path.exists(apiname):
344 os.remove(apiname)
345 for apiname in glob.glob(os.path.join(apidir, progLanguage.lower(), "*.bas")):
342 os.remove(apiname) 346 os.remove(apiname)
343 for apiname in glob.glob(os.path.join(apidir, progLanguage.lower(), "*.bas")): 347 except AttributeError:
344 os.remove(apiname) 348 pass
345 except AttributeError: 349
346 pass 350 except IOError as msg:
351 sys.stderr.write('IOError: %s\nTry install with admin rights.\n' % msg)
352 sys.exit(7)
353
354 except OSError as msg:
355 sys.stderr.write('OSError: %s\nTry install with admin rights.\n' % msg)
356 sys.exit(7)
347 357
348 358
349 def installEric(): 359 def installEric():
350 """ 360 """
351 Actually perform the installation steps. 361 Actually perform the installation steps.
438 448
439 # create the global plugins directory 449 # create the global plugins directory
440 createGlobalPluginsDir() 450 createGlobalPluginsDir()
441 451
442 except IOError as msg: 452 except IOError as msg:
443 sys.stderr.write('IOError: {0}\nTry install as root.\n'.format(msg)) 453 sys.stderr.write('IOError: {0}\nTry install with admin rights.\n'.format(msg))
444 exit(7) 454 exit(7)
445 455
446 except OSError as msg: 456 except OSError as msg:
447 sys.stderr.write('OSError: {0}\nTry install with admin rights.\n'.format(msg)) 457 sys.stderr.write('OSError: {0}\nTry install with admin rights.\n'.format(msg))
448 exit(7) 458 exit(7)

eric ide

mercurial