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