390 Uninstall the old eric files. |
390 Uninstall the old eric files. |
391 """ |
391 """ |
392 global macAppBundleName, macAppBundlePath, platBinDir, includePythonVariant |
392 global macAppBundleName, macAppBundlePath, platBinDir, includePythonVariant |
393 |
393 |
394 try: |
394 try: |
395 from eric5config import getConfig |
395 from eric6config import getConfig |
396 except ImportError: |
396 except ImportError: |
397 # eric5 wasn't installed previously |
397 # eric6 wasn't installed previously |
398 return |
398 return |
399 |
399 |
400 global pyModDir, progLanguages |
400 global pyModDir, progLanguages |
401 |
401 |
402 # Remove the menu entry for Linux systems |
402 # Remove the menu entry for Linux systems |
403 if sys.platform.startswith("linux"): |
403 if sys.platform.startswith("linux"): |
404 for name in ["/usr/share/pixmaps/eric.png", |
404 for name in ["/usr/share/pixmaps/eric.png", |
405 "/usr/share/applications/eric5.desktop", |
405 "/usr/share/applications/eric6.desktop", |
406 "/usr/share/appdata/eric5.appdata.xml", |
406 "/usr/share/appdata/eric6.appdata.xml", |
407 "/usr/share/pixmaps/ericWeb.png", |
407 "/usr/share/pixmaps/ericWeb.png", |
408 "/usr/share/applications/eric5_webbrowser.desktop"]: |
408 "/usr/share/applications/eric6_webbrowser.desktop"]: |
409 if os.path.exists(name): |
409 if os.path.exists(name): |
410 os.remove(name) |
410 os.remove(name) |
411 |
411 |
412 # Remove the wrapper scripts |
412 # Remove the wrapper scripts |
413 rem_wnames = [ |
413 rem_wnames = [ |
414 "eric5-api", "eric5-compare", |
414 "eric6-api", "eric6-compare", |
415 "eric5-configure", "eric5-diff", |
415 "eric6-configure", "eric6-diff", |
416 "eric5-doc", |
416 "eric6-doc", |
417 "eric5-qregexp", "eric5-re", |
417 "eric6-qregexp", "eric6-re", |
418 "eric5-trpreviewer", "eric5-uipreviewer", |
418 "eric6-trpreviewer", "eric6-uipreviewer", |
419 "eric5-unittest", "eric5", |
419 "eric6-unittest", "eric6", |
420 "eric5-tray", "eric5-editor", |
420 "eric6-tray", "eric6-editor", |
421 "eric5-plugininstall", "eric5-pluginuninstall", |
421 "eric6-plugininstall", "eric6-pluginuninstall", |
422 "eric5-pluginrepository", "eric5-sqlbrowser", |
422 "eric6-pluginrepository", "eric6-sqlbrowser", |
423 "eric5-webbrowser", "eric5-iconeditor", |
423 "eric6-webbrowser", "eric6-iconeditor", |
424 ] |
424 ] |
425 rem_wnames2 = [ |
425 rem_wnames2 = [ |
426 "eric5_api", "eric5_compare", |
426 "eric6_api", "eric6_compare", |
427 "eric5_configure", "eric5_diff", |
427 "eric6_configure", "eric6_diff", |
428 "eric5_doc", "eric5_qregularexpression", |
428 "eric6_doc", "eric6_qregularexpression", |
429 "eric5_qregexp", "eric5_re", |
429 "eric6_qregexp", "eric6_re", |
430 "eric5_trpreviewer", "eric5_uipreviewer", |
430 "eric6_trpreviewer", "eric6_uipreviewer", |
431 "eric5_unittest", "eric5", |
431 "eric6_unittest", "eric6", |
432 "eric5_tray", "eric5_editor", |
432 "eric6_tray", "eric6_editor", |
433 "eric5_plugininstall", "eric5_pluginuninstall", |
433 "eric6_plugininstall", "eric6_pluginuninstall", |
434 "eric5_pluginrepository", "eric5_sqlbrowser", |
434 "eric6_pluginrepository", "eric6_sqlbrowser", |
435 "eric5_webbrowser", "eric5_iconeditor", |
435 "eric6_webbrowser", "eric6_iconeditor", |
436 "eric5_snap", |
436 "eric6_snap", |
437 ] |
437 ] |
438 if includePythonVariant: |
438 if includePythonVariant: |
439 marker = PythonMarkers[sys.version_info.major] |
439 marker = PythonMarkers[sys.version_info.major] |
440 rem_wnames.extend([n + marker for n in rem_wnames2]) |
440 rem_wnames.extend([n + marker for n in rem_wnames2]) |
441 else: |
441 else: |
447 rwname = wrapperName(d, rem_wname) |
447 rwname = wrapperName(d, rem_wname) |
448 if os.path.exists(rwname): |
448 if os.path.exists(rwname): |
449 os.remove(rwname) |
449 os.remove(rwname) |
450 |
450 |
451 # Cleanup our config file(s) |
451 # Cleanup our config file(s) |
452 for name in ['eric5config.py', 'eric5config.pyc', 'eric5.pth']: |
452 for name in ['eric6config.py', 'eric6config.pyc', 'eric6.pth']: |
453 e5cfile = os.path.join(pyModDir, name) |
453 e5cfile = os.path.join(pyModDir, name) |
454 if os.path.exists(e5cfile): |
454 if os.path.exists(e5cfile): |
455 os.remove(e5cfile) |
455 os.remove(e5cfile) |
456 e5cfile = os.path.join(pyModDir, "__pycache__", name) |
456 e5cfile = os.path.join(pyModDir, "__pycache__", name) |
457 path, ext = os.path.splitext(e5cfile) |
457 path, ext = os.path.splitext(e5cfile) |
486 except AttributeError: |
486 except AttributeError: |
487 pass |
487 pass |
488 |
488 |
489 if sys.platform == "darwin": |
489 if sys.platform == "darwin": |
490 # delete the Mac app bundle |
490 # delete the Mac app bundle |
491 if os.path.exists("/Developer/Applications/Eric5"): |
491 if os.path.exists("/Developer/Applications/Eric6"): |
492 shutil.rmtree("/Developer/Applications/Eric5") |
492 shutil.rmtree("/Developer/Applications/Eric6") |
493 try: |
493 try: |
494 macAppBundlePath = getConfig("macAppBundlePath") |
494 macAppBundlePath = getConfig("macAppBundlePath") |
495 macAppBundleName = getConfig("macAppBundleName") |
495 macAppBundleName = getConfig("macAppBundleName") |
496 except AttributeError: |
496 except AttributeError: |
497 macAppBundlePath = "/Applications" |
497 macAppBundlePath = "/Applications" |
498 macAppBundleName = "eric5.app" |
498 macAppBundleName = "eric6.app" |
499 if os.path.exists("/Applications/" + macAppBundleName): |
499 if os.path.exists("/Applications/" + macAppBundleName): |
500 shutil.rmtree("/Applications/" + macAppBundleName) |
500 shutil.rmtree("/Applications/" + macAppBundleName) |
501 bundlePath = os.path.join(macAppBundlePath, macAppBundleName) |
501 bundlePath = os.path.join(macAppBundlePath, macAppBundleName) |
502 if os.path.exists(bundlePath): |
502 if os.path.exists(bundlePath): |
503 shutil.rmtree(bundlePath) |
503 shutil.rmtree(bundlePath) |
529 """ |
529 """ |
530 global distDir, doCleanup, cfg, progLanguages, sourceDir, configName |
530 global distDir, doCleanup, cfg, progLanguages, sourceDir, configName |
531 |
531 |
532 # Create the platform specific wrappers. |
532 # Create the platform specific wrappers. |
533 wnames = [] |
533 wnames = [] |
534 for name in ["eric5_api", "eric5_doc"]: |
534 for name in ["eric6_api", "eric6_doc"]: |
535 wnames.append(createPyWrapper(cfg['ericDir'], name, False)) |
535 wnames.append(createPyWrapper(cfg['ericDir'], name, False)) |
536 for name in ["eric5_compare", "eric5_configure", "eric5_diff", |
536 for name in ["eric6_compare", "eric6_configure", "eric6_diff", |
537 "eric5_editor", "eric5_iconeditor", "eric5_plugininstall", |
537 "eric6_editor", "eric6_iconeditor", "eric6_plugininstall", |
538 "eric5_pluginrepository", "eric5_pluginuninstall", |
538 "eric6_pluginrepository", "eric6_pluginuninstall", |
539 "eric5_qregexp", "eric5_qregularexpression", "eric5_re", |
539 "eric6_qregexp", "eric6_qregularexpression", "eric6_re", |
540 "eric5_snap", "eric5_sqlbrowser", "eric5_tray", |
540 "eric6_snap", "eric6_sqlbrowser", "eric6_tray", |
541 "eric5_trpreviewer", "eric5_uipreviewer", "eric5_unittest", |
541 "eric6_trpreviewer", "eric6_uipreviewer", "eric6_unittest", |
542 "eric5_webbrowser", "eric5"]: |
542 "eric6_webbrowser", "eric6"]: |
543 wnames.append(createPyWrapper(cfg['ericDir'], name)) |
543 wnames.append(createPyWrapper(cfg['ericDir'], name)) |
544 |
544 |
545 # set install prefix, if not None |
545 # set install prefix, if not None |
546 if distDir: |
546 if distDir: |
547 for key in list(cfg.keys()): |
547 for key in list(cfg.keys()): |
552 # make the install directories |
552 # make the install directories |
553 for key in list(cfg.keys()): |
553 for key in list(cfg.keys()): |
554 if not os.path.isdir(cfg[key]): |
554 if not os.path.isdir(cfg[key]): |
555 os.makedirs(cfg[key]) |
555 os.makedirs(cfg[key]) |
556 |
556 |
557 # copy the eric5 config file |
557 # copy the eric6 config file |
558 if distDir: |
558 if distDir: |
559 shutilCopy(configName, cfg['mdir']) |
559 shutilCopy(configName, cfg['mdir']) |
560 if os.path.exists(configName + 'c'): |
560 if os.path.exists(configName + 'c'): |
561 shutilCopy(configName + 'c', cfg['mdir']) |
561 shutilCopy(configName + 'c', cfg['mdir']) |
562 else: |
562 else: |
563 shutilCopy(configName, modDir) |
563 shutilCopy(configName, modDir) |
564 if os.path.exists(configName + 'c'): |
564 if os.path.exists(configName + 'c'): |
565 shutilCopy(configName + 'c', modDir) |
565 shutilCopy(configName + 'c', modDir) |
566 |
566 |
567 # copy the various parts of eric5 |
567 # copy the various parts of eric6 |
568 copyTree( |
568 copyTree( |
569 sourceDir, cfg['ericDir'], |
569 sourceDir, cfg['ericDir'], |
570 ['*.py', '*.pyc', '*.pyo', '*.pyw'], |
570 ['*.py', '*.pyc', '*.pyo', '*.pyw'], |
571 ['{1}{0}Examples'.format(os.sep, sourceDir)], |
571 ['{1}{0}Examples'.format(os.sep, sourceDir)], |
572 excludePatterns=["eric5config.py*"]) |
572 excludePatterns=["eric6config.py*"]) |
573 copyTree( |
573 copyTree( |
574 sourceDir, cfg['ericDir'], ['*.rb'], |
574 sourceDir, cfg['ericDir'], ['*.rb'], |
575 ['{1}{0}Examples'.format(os.sep, sourceDir)]) |
575 ['{1}{0}Examples'.format(os.sep, sourceDir)]) |
576 copyTree( |
576 copyTree( |
577 '{1}{0}Plugins'.format(os.sep, sourceDir), |
577 '{1}{0}Plugins'.format(os.sep, sourceDir), |
697 os.path.join(dst, "ericWeb.png")) |
697 os.path.join(dst, "ericWeb.png")) |
698 dst = os.path.normpath( |
698 dst = os.path.normpath( |
699 os.path.join(distDir, "usr/share/applications")) |
699 os.path.join(distDir, "usr/share/applications")) |
700 if not os.path.exists(dst): |
700 if not os.path.exists(dst): |
701 os.makedirs(dst) |
701 os.makedirs(dst) |
702 shutilCopy(os.path.join(sourceDir, "eric5.desktop"), dst) |
702 shutilCopy(os.path.join(sourceDir, "eric6.desktop"), dst) |
703 shutilCopy(os.path.join(sourceDir, "eric5_webbrowser.desktop"), |
703 shutilCopy(os.path.join(sourceDir, "eric6_webbrowser.desktop"), |
704 dst) |
704 dst) |
705 dst = os.path.normpath( |
705 dst = os.path.normpath( |
706 os.path.join(distDir, "usr/share/appdata")) |
706 os.path.join(distDir, "usr/share/appdata")) |
707 if not os.path.exists(dst): |
707 if not os.path.exists(dst): |
708 os.makedirs(dst) |
708 os.makedirs(dst) |
709 shutilCopy(os.path.join(sourceDir, "eric5.appdata.xml"), dst) |
709 shutilCopy(os.path.join(sourceDir, "eric6.appdata.xml"), dst) |
710 else: |
710 else: |
711 shutilCopy(os.path.join( |
711 shutilCopy(os.path.join( |
712 sourceDir, "icons", "default", "eric.png"), |
712 sourceDir, "icons", "default", "eric.png"), |
713 "/usr/share/pixmaps/eric.png") |
713 "/usr/share/pixmaps/eric.png") |
714 shutilCopy(os.path.join( |
714 shutilCopy(os.path.join( |
715 sourceDir, "eric5.desktop"), |
715 sourceDir, "eric6.desktop"), |
716 "/usr/share/applications") |
716 "/usr/share/applications") |
717 if os.path.exists("/usr/share/appdata"): |
717 if os.path.exists("/usr/share/appdata"): |
718 shutilCopy(os.path.join( |
718 shutilCopy(os.path.join( |
719 sourceDir, "eric5.appdata.xml"), |
719 sourceDir, "eric6.appdata.xml"), |
720 "/usr/share/appdata") |
720 "/usr/share/appdata") |
721 shutilCopy(os.path.join( |
721 shutilCopy(os.path.join( |
722 sourceDir, "icons", "default", "ericWeb48.png"), |
722 sourceDir, "icons", "default", "ericWeb48.png"), |
723 "/usr/share/pixmaps/ericWeb.png") |
723 "/usr/share/pixmaps/ericWeb.png") |
724 shutilCopy(os.path.join( |
724 shutilCopy(os.path.join( |
725 sourceDir, "eric5_webbrowser.desktop"), |
725 sourceDir, "eric6_webbrowser.desktop"), |
726 "/usr/share/applications") |
726 "/usr/share/applications") |
727 |
727 |
728 # Create a Mac application bundle |
728 # Create a Mac application bundle |
729 if sys.platform == "darwin": |
729 if sys.platform == "darwin": |
730 createMacAppBundle(cfg['ericDir']) |
730 createMacAppBundle(cfg['ericDir']) |
769 path = os.pathsep.join(pathlist) |
769 path = os.pathsep.join(pathlist) |
770 wrapper = ('''#!/bin/sh\n''' |
770 wrapper = ('''#!/bin/sh\n''' |
771 '''\n''' |
771 '''\n''' |
772 '''PATH={0}\n''' |
772 '''PATH={0}\n''' |
773 '''exec "{1}" "{2}/{3}.py" "$@"\n''' |
773 '''exec "{1}" "{2}/{3}.py" "$@"\n''' |
774 .format(path, starter, pydir, "eric5")) |
774 .format(path, starter, pydir, "eric6")) |
775 else: |
775 else: |
776 wrapper = ('''#!/bin/sh\n''' |
776 wrapper = ('''#!/bin/sh\n''' |
777 '''\n''' |
777 '''\n''' |
778 '''exec "{0}" "{1}/{2}.py" "$@"\n''' |
778 '''exec "{0}" "{1}/{2}.py" "$@"\n''' |
779 .format(starter, pydir, "eric5")) |
779 .format(starter, pydir, "eric6")) |
780 copyToFile(wname, wrapper) |
780 copyToFile(wname, wrapper) |
781 os.chmod(wname, 0o755) |
781 os.chmod(wname, 0o755) |
782 |
782 |
783 shutilCopy(os.path.join(sourceDir, "pixmaps", "eric_2.icns"), |
783 shutilCopy(os.path.join(sourceDir, "pixmaps", "eric_2.icns"), |
784 os.path.join(dirs["icns"], "eric.icns")) |
784 os.path.join(dirs["icns"], "eric.icns")) |
855 # treat Python3 API files the same as Python API files |
855 # treat Python3 API files the same as Python API files |
856 for apiName in glob.glob( |
856 for apiName in glob.glob( |
857 os.path.join(sourceDir, "APIs", "Python3", "*.api")): |
857 os.path.join(sourceDir, "APIs", "Python3", "*.api")): |
858 apis.append(os.path.basename(apiName)) |
858 apis.append(os.path.basename(apiName)) |
859 |
859 |
860 fn = 'eric5config.py' |
860 fn = 'eric6config.py' |
861 config = ( |
861 config = ( |
862 """# -*- coding: utf-8 -*-\n""" |
862 """# -*- coding: utf-8 -*-\n""" |
863 """#\n""" |
863 """#\n""" |
864 """# This module contains the configuration of the individual eric5""" |
864 """# This module contains the configuration of the individual eric6""" |
865 """ installation\n""" |
865 """ installation\n""" |
866 """#\n""" |
866 """#\n""" |
867 """\n""" |
867 """\n""" |
868 """_pkg_config = {{\n""" |
868 """_pkg_config = {{\n""" |
869 """ 'ericDir': r'{0}',\n""" |
869 """ 'ericDir': r'{0}',\n""" |
1175 global progName, modDir, doCleanup, doCompile, distDir, cfg, apisDir |
1175 global progName, modDir, doCleanup, doCompile, distDir, cfg, apisDir |
1176 global sourceDir, configName, includePythonVariant |
1176 global sourceDir, configName, includePythonVariant |
1177 global macAppBundlePath, macAppBundleName, macPythonExe |
1177 global macAppBundlePath, macAppBundleName, macPythonExe |
1178 |
1178 |
1179 if sys.version_info < (2, 6, 0) or sys.version_info > (3, 9, 9): |
1179 if sys.version_info < (2, 6, 0) or sys.version_info > (3, 9, 9): |
1180 print('Sorry, eric5 requires at least Python 2.6 or ' |
1180 print('Sorry, eric6 requires at least Python 2.6 or ' |
1181 'Python 3 for running.') |
1181 'Python 3 for running.') |
1182 exit(5) |
1182 exit(5) |
1183 |
1183 |
1184 progName = os.path.basename(argv[0]) |
1184 progName = os.path.basename(argv[0]) |
1185 |
1185 |
1300 ddir=os.path.join(distDir, modDir, cfg['ericDir']), |
1300 ddir=os.path.join(distDir, modDir, cfg['ericDir']), |
1301 rx=re.compile(r"DebugClients[\\/]Python[\\/]"), |
1301 rx=re.compile(r"DebugClients[\\/]Python[\\/]"), |
1302 quiet=True) |
1302 quiet=True) |
1303 py_compile.compile( |
1303 py_compile.compile( |
1304 configName, |
1304 configName, |
1305 dfile=os.path.join(distDir, modDir, "eric5config.py")) |
1305 dfile=os.path.join(distDir, modDir, "eric6config.py")) |
1306 else: |
1306 else: |
1307 compileall.compile_dir( |
1307 compileall.compile_dir( |
1308 sourceDir, |
1308 sourceDir, |
1309 ddir=os.path.join(modDir, cfg['ericDir']), |
1309 ddir=os.path.join(modDir, cfg['ericDir']), |
1310 rx=re.compile(r"DebugClients[\\/]Python[\\/]"), |
1310 rx=re.compile(r"DebugClients[\\/]Python[\\/]"), |
1311 quiet=True) |
1311 quiet=True) |
1312 py_compile.compile(configName, |
1312 py_compile.compile(configName, |
1313 dfile=os.path.join(modDir, "eric5config.py")) |
1313 dfile=os.path.join(modDir, "eric6config.py")) |
1314 sys.stdout = sys.__stdout__ |
1314 sys.stdout = sys.__stdout__ |
1315 print("\nInstalling eric5 ...") |
1315 print("\nInstalling eric6 ...") |
1316 res = installEric() |
1316 res = installEric() |
1317 |
1317 |
1318 # do some cleanup |
1318 # do some cleanup |
1319 try: |
1319 try: |
1320 if installFromSource: |
1320 if installFromSource: |