431 if not os.path.isdir(cfg[key]): |
446 if not os.path.isdir(cfg[key]): |
432 os.makedirs(cfg[key]) |
447 os.makedirs(cfg[key]) |
433 |
448 |
434 # copy the eric5 config file |
449 # copy the eric5 config file |
435 if distDir: |
450 if distDir: |
436 shutil.copy(configName, cfg['mdir']) |
451 shutilCopy(configName, cfg['mdir']) |
437 if os.path.exists(configName + 'c'): |
452 if os.path.exists(configName + 'c'): |
438 shutil.copy(configName + 'c', cfg['mdir']) |
453 shutilCopy(configName + 'c', cfg['mdir']) |
439 else: |
454 else: |
440 shutil.copy(configName, modDir) |
455 shutilCopy(configName, modDir) |
441 if os.path.exists(configName + 'c'): |
456 if os.path.exists(configName + 'c'): |
442 shutil.copy(configName + 'c', modDir) |
457 shutilCopy(configName + 'c', modDir) |
443 |
458 |
444 # copy the various parts of eric5 |
459 # copy the various parts of eric5 |
445 copyTree(sourceDir, cfg['ericDir'], ['*.py', '*.pyc', '*.pyo', '*.pyw'], |
460 copyTree(sourceDir, cfg['ericDir'], ['*.py', '*.pyc', '*.pyo', '*.pyw'], |
446 ['{1}{0}Examples'.format(os.sep, sourceDir)], |
461 ['{1}{0}Examples'.format(os.sep, sourceDir)], |
447 excludePatterns=["eric5config.py*"]) |
462 excludePatterns=["eric5config.py*"]) |
493 exit(7) |
508 exit(7) |
494 |
509 |
495 # copy some text files to the doc area |
510 # copy some text files to the doc area |
496 for name in ["LICENSE.GPL3", "THANKS", "changelog"]: |
511 for name in ["LICENSE.GPL3", "THANKS", "changelog"]: |
497 try: |
512 try: |
498 shutil.copy('{2}{0}{1}'.format(os.sep, name, sourceDir), cfg['ericDocDir']) |
513 shutilCopy('{2}{0}{1}'.format(os.sep, name, sourceDir), cfg['ericDocDir']) |
499 except EnvironmentError: |
514 except EnvironmentError: |
500 print("Could not install '{2}{0}{1}'.".format(os.sep, name, sourceDir)) |
515 print("Could not install '{2}{0}{1}'.".format(os.sep, name, sourceDir)) |
501 for name in glob.glob(os.path.join(sourceDir, 'README*.*')): |
516 for name in glob.glob(os.path.join(sourceDir, 'README*.*')): |
502 try: |
517 try: |
503 shutil.copy(name, cfg['ericDocDir']) |
518 shutilCopy(name, cfg['ericDocDir']) |
504 except EnvironmentError: |
519 except EnvironmentError: |
505 print("Could not install '{1}'.".format(name)) |
520 print("Could not install '{1}'.".format(name)) |
506 |
521 |
507 # copy some more stuff |
522 # copy some more stuff |
508 for name in ['default.e4k', 'default_Mac.e4k']: |
523 for name in ['default.e4k', 'default_Mac.e4k']: |
509 try: |
524 try: |
510 shutil.copy('{2}{0}{1}'.format(os.sep, name, sourceDir), cfg['ericOthersDir']) |
525 shutilCopy('{2}{0}{1}'.format(os.sep, name, sourceDir), cfg['ericOthersDir']) |
511 except EnvironmentError: |
526 except EnvironmentError: |
512 print("Could not install '{2}{0}{1}'.".format(os.sep, name, sourceDir)) |
527 print("Could not install '{2}{0}{1}'.".format(os.sep, name, sourceDir)) |
513 |
528 |
514 # install the API file |
529 # install the API file |
515 for progLanguage in progLanguages: |
530 for progLanguage in progLanguages: |
516 apidir = os.path.join(cfg['apidir'], progLanguage.lower()) |
531 apidir = os.path.join(cfg['apidir'], progLanguage.lower()) |
517 if not os.path.exists(apidir): |
532 if not os.path.exists(apidir): |
518 os.makedirs(apidir) |
533 os.makedirs(apidir) |
519 for apiName in glob.glob(os.path.join(sourceDir, "APIs", progLanguage, "*.api")): |
534 for apiName in glob.glob(os.path.join(sourceDir, "APIs", progLanguage, "*.api")): |
520 try: |
535 try: |
521 shutil.copy(apiName, apidir) |
536 shutilCopy(apiName, apidir) |
522 except EnvironmentError: |
537 except EnvironmentError: |
523 print("Could not install '{0}'.".format(apiName)) |
538 print("Could not install '{0}'.".format(apiName)) |
524 for apiName in glob.glob(os.path.join(sourceDir, "APIs", progLanguage, "*.bas")): |
539 for apiName in glob.glob(os.path.join(sourceDir, "APIs", progLanguage, "*.bas")): |
525 try: |
540 try: |
526 shutil.copy(apiName, apidir) |
541 shutilCopy(apiName, apidir) |
527 except EnvironmentError: |
542 except EnvironmentError: |
528 print("Could not install '{0}'.".format(apiName)) |
543 print("Could not install '{0}'.".format(apiName)) |
529 if progLanguage == "Python": |
544 if progLanguage == "Python": |
530 # copy Python3 API files to the same destination |
545 # copy Python3 API files to the same destination |
531 for apiName in glob.glob(os.path.join(sourceDir, "APIs", "Python3", "*.api")): |
546 for apiName in glob.glob(os.path.join(sourceDir, "APIs", "Python3", "*.api")): |
532 try: |
547 try: |
533 shutil.copy(apiName, apidir) |
548 shutilCopy(apiName, apidir) |
534 except EnvironmentError: |
549 except EnvironmentError: |
535 print("Could not install '{0}'.".format(apiName)) |
550 print("Could not install '{0}'.".format(apiName)) |
536 for apiName in glob.glob(os.path.join(sourceDir, "APIs", "Python3", "*.bas")): |
551 for apiName in glob.glob(os.path.join(sourceDir, "APIs", "Python3", "*.bas")): |
537 try: |
552 try: |
538 shutil.copy(apiName, apidir) |
553 shutilCopy(apiName, apidir) |
539 except EnvironmentError: |
554 except EnvironmentError: |
540 print("Could not install '{0}'.".format(apiName)) |
555 print("Could not install '{0}'.".format(apiName)) |
541 |
556 |
542 # create menu entry for Linux systems |
557 # create menu entry for Linux systems |
543 if sys.platform.startswith("linux"): |
558 if sys.platform.startswith("linux"): |
544 if distDir: |
559 if distDir: |
545 dst = os.path.normpath(os.path.join(distDir, "usr/share/pixmaps")) |
560 dst = os.path.normpath(os.path.join(distDir, "usr/share/pixmaps")) |
546 if not os.path.exists(dst): |
561 if not os.path.exists(dst): |
547 os.makedirs(dst) |
562 os.makedirs(dst) |
548 shutil.copy(os.path.join(sourceDir, "icons", "default", "eric_2.png"), |
563 shutilCopy(os.path.join(sourceDir, "icons", "default", "eric_2.png"), |
549 os.path.join(dst, "eric.png")) |
564 os.path.join(dst, "eric.png")) |
550 dst = os.path.normpath(os.path.join(distDir, "usr/share/applications")) |
565 dst = os.path.normpath(os.path.join(distDir, "usr/share/applications")) |
551 if not os.path.exists(dst): |
566 if not os.path.exists(dst): |
552 os.makedirs(dst) |
567 os.makedirs(dst) |
553 shutil.copy(os.path.join(sourceDir, "eric5.desktop"), dst) |
568 shutilCopy(os.path.join(sourceDir, "eric5.desktop"), dst) |
554 else: |
569 else: |
555 shutil.copy(os.path.join(sourceDir, "icons", "default", "eric_2.png"), |
570 shutilCopy(os.path.join(sourceDir, "icons", "default", "eric_2.png"), |
556 "/usr/share/pixmaps/eric.png") |
571 "/usr/share/pixmaps/eric.png") |
557 shutil.copy(os.path.join(sourceDir, "eric5.desktop"), |
572 shutilCopy(os.path.join(sourceDir, "eric5.desktop"), |
558 "/usr/share/applications") |
573 "/usr/share/applications") |
559 |
574 |
560 # Create a Mac application bundle |
575 # Create a Mac application bundle |
561 if sys.platform == "darwin": |
576 if sys.platform == "darwin": |
562 createMacAppBundle(cfg['ericDir']) |
577 createMacAppBundle(cfg['ericDir']) |