342 if not os.path.isdir(cfg[key]): |
344 if not os.path.isdir(cfg[key]): |
343 os.makedirs(cfg[key]) |
345 os.makedirs(cfg[key]) |
344 |
346 |
345 # copy the eric5 config file |
347 # copy the eric5 config file |
346 if distDir: |
348 if distDir: |
347 shutil.copy('eric5config.py', cfg['mdir']) |
349 shutil.copy(configName, cfg['mdir']) |
348 if os.path.exists('eric5config.pyc'): |
350 if os.path.exists(configName + 'c'): |
349 shutil.copy('eric5config.pyc', cfg['mdir']) |
351 shutil.copy(configName + 'c', cfg['mdir']) |
350 else: |
352 else: |
351 shutil.copy('eric5config.py', modDir) |
353 shutil.copy(configName, modDir) |
352 if os.path.exists('eric5config.pyc'): |
354 if os.path.exists(configName + 'c'): |
353 shutil.copy('eric5config.pyc', modDir) |
355 shutil.copy(configName + 'c', modDir) |
354 |
356 |
355 # copy the various parts of eric5 |
357 # copy the various parts of eric5 |
356 copyTree('eric', cfg['ericDir'], ['*.py', '*.pyc', '*.pyo', '*.pyw'], |
358 copyTree(sourceDir, cfg['ericDir'], ['*.py', '*.pyc', '*.pyo', '*.pyw'], |
357 ['eric{0}Examples'.format(os.sep)]) |
359 ['{1}{0}Examples'.format(os.sep, sourceDir)]) |
358 copyTree('eric', cfg['ericDir'], ['*.rb'], |
360 copyTree(sourceDir, cfg['ericDir'], ['*.rb'], |
359 ['eric{0}Examples'.format(os.sep)]) |
361 ['{1}{0}Examples'.format(os.sep, sourceDir)]) |
360 copyTree('eric{0}Plugins'.format(os.sep), |
362 copyTree('{1}{0}Plugins'.format(os.sep, sourceDir), |
361 '{0}{1}Plugins'.format(cfg['ericDir'], os.sep), |
363 '{0}{1}Plugins'.format(cfg['ericDir'], os.sep), |
362 ['*.png', '*.style']) |
364 ['*.png', '*.style']) |
363 copyTree('eric{0}Documentation'.format(os.sep), cfg['ericDocDir'], |
365 copyTree('{1}{0}Documentation'.format(os.sep, sourceDir), cfg['ericDocDir'], |
364 ['*.html', '*.qch']) |
366 ['*.html', '*.qch']) |
365 copyTree('eric{0}DTDs'.format(os.sep), cfg['ericDTDDir'], ['*.dtd']) |
367 copyTree('{1}{0}DTDs'.format(os.sep, sourceDir), cfg['ericDTDDir'], |
366 copyTree('eric{0}CSSs'.format(os.sep), cfg['ericCSSDir'], ['*.css']) |
368 ['*.dtd']) |
367 copyTree('eric{0}Styles'.format(os.sep), cfg['ericStylesDir'], ['*.qss']) |
369 copyTree('{1}{0}CSSs'.format(os.sep, sourceDir), cfg['ericCSSDir'], |
368 copyTree('eric{0}i18n'.format(os.sep), cfg['ericTranslationsDir'], ['*.qm']) |
370 ['*.css']) |
369 copyTree('eric{0}icons'.format(os.sep), cfg['ericIconDir'], |
371 copyTree('{1}{0}Styles'.format(os.sep, sourceDir), cfg['ericStylesDir'], |
|
372 ['*.qss']) |
|
373 copyTree('{1}{0}i18n'.format(os.sep, sourceDir), cfg['ericTranslationsDir'], |
|
374 ['*.qm']) |
|
375 copyTree('{1}{0}icons'.format(os.sep, sourceDir), cfg['ericIconDir'], |
370 ['*.png', 'LICENSE*.*']) |
376 ['*.png', 'LICENSE*.*']) |
371 copyTree('eric{0}pixmaps'.format(os.sep), cfg['ericPixDir'], |
377 copyTree('{1}{0}pixmaps'.format(os.sep, sourceDir), cfg['ericPixDir'], |
372 ['*.png', '*.xpm', '*.ico']) |
378 ['*.png', '*.xpm', '*.ico']) |
373 copyTree('eric{0}DesignerTemplates'.format(os.sep), cfg['ericTemplatesDir'], |
379 copyTree('{1}{0}DesignerTemplates'.format(os.sep, sourceDir), |
|
380 cfg['ericTemplatesDir'], |
374 ['*.tmpl']) |
381 ['*.tmpl']) |
375 copyTree('eric{0}CodeTemplates'.format(os.sep), cfg['ericCodeTemplatesDir'], |
382 copyTree('{1}{0}CodeTemplates'.format(os.sep, sourceDir), |
|
383 cfg['ericCodeTemplatesDir'], |
376 ['*.tmpl']) |
384 ['*.tmpl']) |
377 copyTree('eric{0}Examples'.format(os.sep), cfg['ericExamplesDir'], |
385 copyTree('{1}{0}Examples'.format(os.sep, sourceDir), cfg['ericExamplesDir'], |
378 ['*.py', '*.pyc', '*.pyo']) |
386 ['*.py', '*.pyc', '*.pyo']) |
379 |
387 |
380 # copy the wrappers |
388 # copy the wrappers |
381 for wname in wnames: |
389 for wname in wnames: |
382 shutil.copy(wname, cfg['bindir']) |
390 shutil.copy(wname, cfg['bindir']) |
|
391 os.remove(wname) |
383 |
392 |
384 # copy the license file |
393 # copy the license file |
385 shutil.copy('eric{0}LICENSE.GPL3'.format(os.sep), cfg['ericDir']) |
394 shutil.copy('{1}{0}LICENSE.GPL3'.format(os.sep, sourceDir), cfg['ericDir']) |
386 |
395 |
387 # create the global plugins directory |
396 # create the global plugins directory |
388 createGlobalPluginsDir() |
397 createGlobalPluginsDir() |
389 |
398 |
390 except IOError as msg: |
399 except IOError as msg: |
396 exit(7) |
405 exit(7) |
397 |
406 |
398 # copy some text files to the doc area |
407 # copy some text files to the doc area |
399 for name in ["LICENSE.GPL3", "THANKS", "changelog"]: |
408 for name in ["LICENSE.GPL3", "THANKS", "changelog"]: |
400 try: |
409 try: |
401 shutil.copy('eric{0}{1}'.format(os.sep, name), cfg['ericDocDir']) |
410 shutil.copy('{2}{0}{1}'.format(os.sep, name, sourceDir), cfg['ericDocDir']) |
402 except EnvironmentError: |
411 except EnvironmentError: |
403 print("Could not install 'eric{0}{1}'.".format(os.sep, name)) |
412 print("Could not install '{2}{0}{1}'.".format(os.sep, name, sourceDir)) |
404 for name in glob.glob(os.path.join('eric', 'README*.*')): |
413 for name in glob.glob(os.path.join(sourceDir, 'README*.*')): |
405 try: |
414 try: |
406 shutil.copy(name, cfg['ericDocDir']) |
415 shutil.copy(name, cfg['ericDocDir']) |
407 except EnvironmentError: |
416 except EnvironmentError: |
408 print("Could not install 'eric{0}{1}'.".format(os.sep, name)) |
417 print("Could not install '{1}'.".format(name)) |
409 |
418 |
410 # copy some more stuff |
419 # copy some more stuff |
411 for name in ['default.e4k']: |
420 for name in ['default.e4k']: |
412 try: |
421 try: |
413 shutil.copy('eric{0}{1}'.format(os.sep, name), cfg['ericOthersDir']) |
422 shutil.copy('{2}{0}{1}'.format(os.sep, name, sourceDir), cfg['ericOthersDir']) |
414 except EnvironmentError: |
423 except EnvironmentError: |
415 print("Could not install 'eric{0}{1}'.".format(os.sep, name)) |
424 print("Could not install '{2}{0}{1}'.".format(os.sep, name, sourceDir)) |
416 |
425 |
417 # install the API file |
426 # install the API file |
418 for progLanguage in progLanguages: |
427 for progLanguage in progLanguages: |
419 apidir = os.path.join(cfg['apidir'], progLanguage.lower()) |
428 apidir = os.path.join(cfg['apidir'], progLanguage.lower()) |
420 if not os.path.exists(apidir): |
429 if not os.path.exists(apidir): |
421 os.makedirs(apidir) |
430 os.makedirs(apidir) |
422 for apiName in glob.glob(os.path.join("eric", "APIs", progLanguage, "*.api")): |
431 for apiName in glob.glob(os.path.join(sourceDir, "APIs", progLanguage, "*.api")): |
423 try: |
432 try: |
424 shutil.copy(apiName, apidir) |
433 shutil.copy(apiName, apidir) |
425 except EnvironmentError: |
434 except EnvironmentError: |
426 print("Could not install '{0}'.".format(apiName)) |
435 print("Could not install '{0}'.".format(apiName)) |
427 if progLanguage == "Python": |
436 if progLanguage == "Python": |
428 # copy Python3 API files to the same destination |
437 # copy Python3 API files to the same destination |
429 for apiName in glob.glob(os.path.join("eric", "APIs", "Python3", "*.api")): |
438 for apiName in glob.glob(os.path.join(sourceDir, "APIs", "Python3", "*.api")): |
430 try: |
439 try: |
431 shutil.copy(apiName, apidir) |
440 shutil.copy(apiName, apidir) |
432 except EnvironmentError: |
441 except EnvironmentError: |
433 print("Could not install '{0}'.".format(apiName)) |
442 print("Could not install '{0}'.".format(apiName)) |
434 |
443 |
436 if sys.platform.startswith("linux"): |
445 if sys.platform.startswith("linux"): |
437 if distDir: |
446 if distDir: |
438 dst = os.path.normpath(os.path.join(distDir, "usr/share/pixmaps")) |
447 dst = os.path.normpath(os.path.join(distDir, "usr/share/pixmaps")) |
439 if not os.path.exists(dst): |
448 if not os.path.exists(dst): |
440 os.makedirs(dst) |
449 os.makedirs(dst) |
441 shutil.copy(os.path.join("eric", "icons", "default", "eric.png"), dst) |
450 shutil.copy(os.path.join(sourceDir, "icons", "default", "eric.png"), dst) |
442 dst = os.path.normpath(os.path.join(distDir, "usr/share/applications")) |
451 dst = os.path.normpath(os.path.join(distDir, "usr/share/applications")) |
443 if not os.path.exists(dst): |
452 if not os.path.exists(dst): |
444 os.makedirs(dst) |
453 os.makedirs(dst) |
445 shutil.copy(os.path.join("eric", "eric5.desktop"), dst) |
454 shutil.copy(os.path.join(sourceDir, "eric5.desktop"), dst) |
446 else: |
455 else: |
447 shutil.copy(os.path.join("eric", "icons", "default", "eric.png"), |
456 shutil.copy(os.path.join(sourceDir, "icons", "default", "eric.png"), |
448 "/usr/share/pixmaps") |
457 "/usr/share/pixmaps") |
449 shutil.copy(os.path.join("eric", "eric5.desktop"), |
458 shutil.copy(os.path.join(sourceDir, "eric5.desktop"), |
450 "/usr/share/applications") |
459 "/usr/share/applications") |
451 |
460 |
452 |
461 |
453 def createInstallConfig(): |
462 def createInstallConfig(): |
454 """ |
463 """ |
815 compileUiFiles() |
833 compileUiFiles() |
816 |
834 |
817 if doCompile: |
835 if doCompile: |
818 print("\nCompiling source files...") |
836 print("\nCompiling source files...") |
819 if distDir: |
837 if distDir: |
820 compileall.compile_dir("eric", |
838 compileall.compile_dir(sourceDir, |
821 ddir = os.path.join(distDir, modDir, cfg['ericDir']), |
839 ddir = os.path.join(distDir, modDir, cfg['ericDir']), |
822 rx = re.compile(r"DebugClients[\\/]Python[\\/]"), |
840 rx = re.compile(r"DebugClients[\\/]Python[\\/]"), |
823 quiet = True) |
841 quiet = True) |
824 py_compile.compile("eric5config.py", |
842 py_compile.compile(configName, |
825 dfile = os.path.join(distDir, modDir, "eric5config.py")) |
843 dfile = os.path.join(distDir, modDir, "eric5config.py")) |
826 else: |
844 else: |
827 compileall.compile_dir("eric", |
845 compileall.compile_dir(sourceDir, |
828 ddir = os.path.join(modDir, cfg['ericDir']), |
846 ddir = os.path.join(modDir, cfg['ericDir']), |
829 rx = re.compile(r"DebugClients[\\/]Python[\\/]"), |
847 rx = re.compile(r"DebugClients[\\/]Python[\\/]"), |
830 quiet = True) |
848 quiet = True) |
831 py_compile.compile("eric5config.py", |
849 py_compile.compile(configName, |
832 dfile = os.path.join(modDir, "eric5config.py")) |
850 dfile = os.path.join(modDir, "eric5config.py")) |
833 print("\nInstalling eric5 ...") |
851 print("\nInstalling eric5 ...") |
834 installEric() |
852 installEric() |
|
853 |
|
854 # do some cleanup |
|
855 try: |
|
856 if installFromSource: |
|
857 os.remove(configName) |
|
858 os.rename(configName + ".orig", configName) |
|
859 except EnvironmentError: |
|
860 pass |
|
861 |
835 print("\nInstallation complete.") |
862 print("\nInstallation complete.") |
836 print() |
863 print() |
837 |
864 |
838 exit() |
865 exit() |
839 |
866 |