install.py

changeset 1387
1734bc5f4f82
parent 1385
9eaf0cda4fb4
child 1388
deb3a1940126
equal deleted inserted replaced
1386:58b3f5b5021e 1387:1734bc5f4f82
322 for f in glob.glob("{0}.*{1}".format(path, ext)): 322 for f in glob.glob("{0}.*{1}".format(path, ext)):
323 os.remove(f) 323 os.remove(f)
324 324
325 # Cleanup the install directories 325 # Cleanup the install directories
326 for name in ['ericExamplesDir', 'ericDocDir', 'ericDTDDir', 'ericCSSDir', 326 for name in ['ericExamplesDir', 'ericDocDir', 'ericDTDDir', 'ericCSSDir',
327 'ericIconDir', 'ericPixDir', 'ericTemplatesDir', 'ericCodeTemplatesDir', 327 'ericIconDir', 'ericPixDir', 'ericTemplatesDir',
328 'ericOthersDir', 'ericStylesDir', 'ericDir']: 328 'ericCodeTemplatesDir', 'ericOthersDir', 'ericStylesDir', 'ericDir']:
329 if os.path.exists(getConfig(name)): 329 if os.path.exists(getConfig(name)):
330 shutil.rmtree(getConfig(name), True) 330 shutil.rmtree(getConfig(name), True)
331 331
332 # Cleanup translations 332 # Cleanup translations
333 for name in glob.glob(os.path.join(getConfig('ericTranslationsDir'), 'eric5_*.qm')): 333 for name in glob.glob(
334 os.path.join(getConfig('ericTranslationsDir'), 'eric5_*.qm')):
334 if os.path.exists(name): 335 if os.path.exists(name):
335 os.remove(name) 336 os.remove(name)
336 337
337 # Cleanup API files 338 # Cleanup API files
338 try: 339 try:
340 for progLanguage in progLanguages: 341 for progLanguage in progLanguages:
341 for name in getConfig('apis'): 342 for name in getConfig('apis'):
342 apiname = os.path.join(apidir, progLanguage.lower(), name) 343 apiname = os.path.join(apidir, progLanguage.lower(), name)
343 if os.path.exists(apiname): 344 if os.path.exists(apiname):
344 os.remove(apiname) 345 os.remove(apiname)
345 for apiname in glob.glob(os.path.join(apidir, progLanguage.lower(), "*.bas")): 346 for apiname in glob.glob(
347 os.path.join(apidir, progLanguage.lower(), "*.bas")):
346 os.remove(apiname) 348 os.remove(apiname)
347 except AttributeError: 349 except AttributeError:
348 pass 350 pass
351
352 if sys.platform == "darwin":
353 # delete the Mac app bundle
354 if os.path.exists("/Developer/Applications/Eric5"):
355 shutil.rmtree("/Developer/Applications/Eric5")
349 356
350 except IOError as msg: 357 except IOError as msg:
351 sys.stderr.write('IOError: {0}\nTry install with admin rights.\n'.format(msg)) 358 sys.stderr.write('IOError: {0}\nTry install with admin rights.\n'.format(msg))
352 exit(7) 359 exit(7)
353 360
518 else: 525 else:
519 shutil.copy(os.path.join(sourceDir, "icons", "default", "eric.png"), 526 shutil.copy(os.path.join(sourceDir, "icons", "default", "eric.png"),
520 "/usr/share/pixmaps") 527 "/usr/share/pixmaps")
521 shutil.copy(os.path.join(sourceDir, "eric5.desktop"), 528 shutil.copy(os.path.join(sourceDir, "eric5.desktop"),
522 "/usr/share/applications") 529 "/usr/share/applications")
530
531 if sys.platform == "darwin":
532 createMacAppBundle()
533
534
535 def createMacAppBundle():
536 """
537 Create a Mac application bundle.
538 """
539 global cfg, sourceDir
540
541 dirs = {"contents": "/Developer/Applications/Eric5/eric5.app/Contents/",
542 "exe": "/Developer/Applications/Eric5/eric5.app/Contents/MacOS",
543 "icns": "/Developer/Applications/Eric5/eric5.app/Contents/Resources"}
544 os.makedirs(dirs["contents"])
545 os.mkdir(dirs["exe"])
546 os.mkdir(dirs["icns"])
547 shutil.copy(os.path.join(cfg['bindir'], "eric5"), dirs["exe"])
548 shutil.copy(os.path.join(sourceDir, "pixmaps", "eric_1.icns"),
549 os.path.join(dirs["icns"], "eric.icns"))
550 f = open(os.path.join(dirs["contents"], "Info.plist"), "wb")
551 f.write(\
552 '''<?xml version="1.0" encoding="UTF-8"?>
553 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
554 "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
555 <plist version="1.0">
556 <dict>
557 <key>CFBundleExecutable</key>
558 <string>eric5</string>
559 <key>CFBundleIconFile</key>
560 <string>eric.icns</string>
561 <key>CFBundleInfoDictionaryVersion</key>
562 <string>1.0</string>
563 <key>CFBundleName</key>
564 <string>eric5</string>
565 <key>CFBundlePackageType</key>
566 <string>APPL</string>
567 <key>CFBundleSignature</key>
568 <string>????</string>
569 <key>CFBundleVersion</key>
570 <string>1.0</string>
571 </dict>
572 </plist>
573 '''
574 )
575 f.close()
523 576
524 577
525 def createInstallConfig(): 578 def createInstallConfig():
526 """ 579 """
527 Create the installation config dictionary. 580 Create the installation config dictionary.

eric ide

mercurial