install.py

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

eric ide

mercurial