48 """ |
48 """ |
49 global progName, platBinDir, modDir, distDir, apisDir |
49 global progName, platBinDir, modDir, distDir, apisDir |
50 |
50 |
51 print() |
51 print() |
52 print("Usage:") |
52 print("Usage:") |
53 print(" %s [-chxz] [-a dir] [-b dir] [-d dir] [-f file] [-i dir]" % (progName)) |
53 print(" {0} [-chxz] [-a dir] [-b dir] [-d dir] [-f file] [-i dir]"\ |
|
54 .format(progName)) |
54 print("where:") |
55 print("where:") |
55 print(" -h display this help message") |
56 print(" -h display this help message") |
56 print(" -a dir where the API files will be installed") |
57 print(" -a dir where the API files will be installed") |
57 if apisDir: |
58 if apisDir: |
58 print(" (default: %s)" % (apisDir)) |
59 print(" (default: {0})".format(apisDir)) |
59 else: |
60 else: |
60 print(" (no default value)") |
61 print(" (no default value)") |
61 print(" -b dir where the binaries will be installed") |
62 print(" -b dir where the binaries will be installed") |
62 print(" (default: %s)" % (platBinDir)) |
63 print(" (default: {0})".format(platBinDir)) |
63 print(" -d dir where eric5 python files will be installed") |
64 print(" -d dir where eric5 python files will be installed") |
64 print(" (default: %s)" % (modDir)) |
65 print(" (default: {0})".format(modDir)) |
65 print(" -f file configuration file naming the various installation paths") |
66 print(" -f file configuration file naming the various installation paths") |
66 if not sys.platform.startswith("win"): |
67 if not sys.platform.startswith("win"): |
67 print(" -i dir temporary install prefix") |
68 print(" -i dir temporary install prefix") |
68 print(" (default: %s)" % (distDir)) |
69 print(" (default: {0})".format(distDir)) |
69 print(" -x don't perform dependency checks (use on your own risk)") |
70 print(" -x don't perform dependency checks (use on your own risk)") |
70 print(" -c don't cleanup old installation first") |
71 print(" -c don't cleanup old installation first") |
71 print(" -z don't compile the installed python files") |
72 print(" -z don't compile the installed python files") |
72 print() |
73 print() |
73 print("The file given to the -f option must be valid Python code defining a") |
74 print("The file given to the -f option must be valid Python code defining a") |
344 if os.path.exists('eric5config.pyc'): |
345 if os.path.exists('eric5config.pyc'): |
345 shutil.copy('eric5config.pyc', modDir) |
346 shutil.copy('eric5config.pyc', modDir) |
346 |
347 |
347 # copy the various parts of eric5 |
348 # copy the various parts of eric5 |
348 copyTree('eric', cfg['ericDir'], ['*.py', '*.pyc', '*.pyo', '*.pyw'], |
349 copyTree('eric', cfg['ericDir'], ['*.py', '*.pyc', '*.pyo', '*.pyw'], |
349 ['eric%sExamples' % os.sep]) |
350 ['eric{0}Examples'.format(os.sep)]) |
350 copyTree('eric', cfg['ericDir'], ['*.rb'], |
351 copyTree('eric', cfg['ericDir'], ['*.rb'], |
351 ['eric%sExamples' % os.sep]) |
352 ['eric{0}Examples'.format(os.sep)]) |
352 copyTree('eric%sPlugins' % os.sep, '%s%sPlugins' % (cfg['ericDir'], os.sep), |
353 copyTree('eric{0}Plugins'.format(os.sep), |
|
354 '{0}{1}Plugins'.format(cfg['ericDir'], os.sep), |
353 ['*.png', '*.style']) |
355 ['*.png', '*.style']) |
354 copyTree('eric%sDocumentation' % os.sep, cfg['ericDocDir'], ['*.html', '*.qch']) |
356 copyTree('eric{0}Documentation'.format(os.sep), cfg['ericDocDir'], |
355 copyTree('eric%sDTDs' % os.sep, cfg['ericDTDDir'], ['*.dtd']) |
357 ['*.html', '*.qch']) |
356 copyTree('eric%sCSSs' % os.sep, cfg['ericCSSDir'], ['*.css']) |
358 copyTree('eric{0}DTDs'.format(os.sep), cfg['ericDTDDir'], ['*.dtd']) |
357 copyTree('eric%sStyles' % os.sep, cfg['ericStylesDir'], ['*.qss']) |
359 copyTree('eric{0}CSSs'.format(os.sep), cfg['ericCSSDir'], ['*.css']) |
358 copyTree('eric%si18n' % os.sep, cfg['ericTranslationsDir'], ['*.qm']) |
360 copyTree('eric{0}Styles'.format(os.sep), cfg['ericStylesDir'], ['*.qss']) |
359 copyTree('eric%sicons' % os.sep, cfg['ericIconDir'], ['*.png', 'LICENSE*.*']) |
361 copyTree('eric{0}i18n'.format(os.sep), cfg['ericTranslationsDir'], ['*.qm']) |
360 copyTree('eric%spixmaps' % os.sep, cfg['ericPixDir'], ['*.png', '*.xpm', '*.ico']) |
362 copyTree('eric{0}icons'.format(os.sep), cfg['ericIconDir'], |
361 copyTree('eric%sDesignerTemplates' % os.sep, cfg['ericTemplatesDir'], ['*.tmpl']) |
363 ['*.png', 'LICENSE*.*']) |
362 copyTree('eric%sCodeTemplates' % os.sep, cfg['ericCodeTemplatesDir'], ['*.tmpl']) |
364 copyTree('eric{0}pixmaps'.format(os.sep), cfg['ericPixDir'], |
363 copyTree('eric%sExamples' % os.sep, cfg['ericExamplesDir'], |
365 ['*.png', '*.xpm', '*.ico']) |
364 ['*.py', '*.pyc', '*.pyo']) |
366 copyTree('eric{0}DesignerTemplates'.format(os.sep), cfg['ericTemplatesDir'], |
|
367 ['*.tmpl']) |
|
368 copyTree('eric{0}CodeTemplates'.format(os.sep), cfg['ericCodeTemplatesDir'], |
|
369 ['*.tmpl']) |
|
370 copyTree('eric{0}Examples'.format(os.sep), cfg['ericExamplesDir'], |
|
371 ['*.py', '*.pyc', '*.pyo']) |
365 |
372 |
366 # copy the wrappers |
373 # copy the wrappers |
367 for wname in wnames: |
374 for wname in wnames: |
368 shutil.copy(wname, cfg['bindir']) |
375 shutil.copy(wname, cfg['bindir']) |
369 |
376 |
370 # copy the license file |
377 # copy the license file |
371 shutil.copy('eric%sLICENSE.GPL3' % os.sep, cfg['ericDir']) |
378 shutil.copy('eric{0}LICENSE.GPL3'.format(os.sep), cfg['ericDir']) |
372 |
379 |
373 # create the global plugins directory |
380 # create the global plugins directory |
374 createGlobalPluginsDir() |
381 createGlobalPluginsDir() |
375 |
382 |
376 except IOError as msg: |
383 except IOError as msg: |
377 sys.stderr.write('IOError: %s\nTry install as root.\n' % msg) |
384 sys.stderr.write('IOError: {0}\nTry install as root.\n'.format(msg)) |
378 exit(7) |
385 exit(7) |
379 |
386 |
380 except OSError as msg: |
387 except OSError as msg: |
381 sys.stderr.write('OSError: %s\nTry install with admin rights.\n' % msg) |
388 sys.stderr.write('OSError: {0}\nTry install with admin rights.\n'.format(msg)) |
382 exit(7) |
389 exit(7) |
383 |
390 |
384 # copy some text files to the doc area |
391 # copy some text files to the doc area |
385 for name in ["LICENSE.GPL3", "THANKS", "changelog"]: |
392 for name in ["LICENSE.GPL3", "THANKS", "changelog"]: |
386 try: |
393 try: |
387 shutil.copy('eric%s%s' % (os.sep, name), cfg['ericDocDir']) |
394 shutil.copy('eric{0}{1}'.format(os.sep, name), cfg['ericDocDir']) |
388 except EnvironmentError: |
395 except EnvironmentError: |
389 print("Could not install 'eric%s%s'." % (os.sep, name)) |
396 print("Could not install 'eric{0}{1}'.".format(os.sep, name)) |
390 for name in glob.glob(os.path.join('eric', 'README*.*')): |
397 for name in glob.glob(os.path.join('eric', 'README*.*')): |
391 try: |
398 try: |
392 shutil.copy(name, cfg['ericDocDir']) |
399 shutil.copy(name, cfg['ericDocDir']) |
393 except EnvironmentError: |
400 except EnvironmentError: |
394 print("Could not install 'eric%s%s'." % (os.sep, name)) |
401 print("Could not install 'eric{0}{1}'.".format(os.sep, name)) |
395 |
402 |
396 # copy some more stuff |
403 # copy some more stuff |
397 for name in ['default.e4k']: |
404 for name in ['default.e4k']: |
398 try: |
405 try: |
399 shutil.copy('eric%s%s' % (os.sep, name), cfg['ericOthersDir']) |
406 shutil.copy('eric{0}{1}'.format(os.sep, name), cfg['ericOthersDir']) |
400 except EnvironmentError: |
407 except EnvironmentError: |
401 print("Could not install 'eric%s%s'." % (os.sep, name)) |
408 print("Could not install 'eric{0}{1}'.".format(os.sep, name)) |
402 |
409 |
403 # install the API file |
410 # install the API file |
404 for progLanguage in progLanguages: |
411 for progLanguage in progLanguages: |
405 apidir = os.path.join(cfg['apidir'], progLanguage.lower()) |
412 apidir = os.path.join(cfg['apidir'], progLanguage.lower()) |
406 if not os.path.exists(apidir): |
413 if not os.path.exists(apidir): |
407 os.makedirs(apidir) |
414 os.makedirs(apidir) |
408 for apiName in glob.glob(os.path.join("eric", "APIs", progLanguage, "*.api")): |
415 for apiName in glob.glob(os.path.join("eric", "APIs", progLanguage, "*.api")): |
409 try: |
416 try: |
410 shutil.copy(apiName, apidir) |
417 shutil.copy(apiName, apidir) |
411 except EnvironmentError: |
418 except EnvironmentError: |
412 print("Could not install '%s'." % apiName) |
419 print("Could not install '{0}'.".format(apiName)) |
413 if progLanguage == "Python": |
420 if progLanguage == "Python": |
414 # copy Python3 API files to the same destination |
421 # copy Python3 API files to the same destination |
415 for apiName in glob.glob(os.path.join("eric", "APIs", "Python3", "*.api")): |
422 for apiName in glob.glob(os.path.join("eric", "APIs", "Python3", "*.api")): |
416 try: |
423 try: |
417 shutil.copy(apiName, apidir) |
424 shutil.copy(apiName, apidir) |
418 except EnvironmentError: |
425 except EnvironmentError: |
419 print("Could not install '%s'." % apiName) |
426 print("Could not install '{0}'.".format(apiName)) |
420 |
427 |
421 # create menu entry for Linux systems |
428 # create menu entry for Linux systems |
422 if sys.platform.startswith("linux"): |
429 if sys.platform.startswith("linux"): |
423 if distDir: |
430 if distDir: |
424 shutil.copy(os.path.join("eric", "icons", "default", "eric.png"), |
431 shutil.copy(os.path.join("eric", "icons", "default", "eric.png"), |
535 print('Sorry, you must have Python 3.1.0 or higher.') |
542 print('Sorry, you must have Python 3.1.0 or higher.') |
536 exit(5) |
543 exit(5) |
537 if sys.version_info > (3, 9, 9): |
544 if sys.version_info > (3, 9, 9): |
538 print('Sorry, eric5 requires Python 3 for running.') |
545 print('Sorry, eric5 requires Python 3 for running.') |
539 exit(5) |
546 exit(5) |
540 print("Python Version: %d.%d.%d" % sys.version_info[:3]) |
547 print("Python Version: {0:d}.{1:d}.{2:d}".format(*sys.version_info[:3])) |
541 |
548 |
542 try: |
549 try: |
543 from PyQt4.QtCore import qVersion |
550 from PyQt4.QtCore import qVersion |
544 except ImportError as msg: |
551 except ImportError as msg: |
545 print('Sorry, please install PyQt4.') |
552 print('Sorry, please install PyQt4.') |
546 print('Error: %s' % msg) |
553 print('Error: {0}'.format(msg)) |
547 exit(1) |
554 exit(1) |
548 print("Found PyQt") |
555 print("Found PyQt") |
549 |
556 |
550 try: |
557 try: |
551 from PyQt4 import Qsci |
558 from PyQt4 import Qsci |
552 except ImportError as msg: |
559 except ImportError as msg: |
553 print("Sorry, please install QScintilla2 and") |
560 print("Sorry, please install QScintilla2 and") |
554 print("it's PyQt4 wrapper.") |
561 print("it's PyQt4 wrapper.") |
555 print('Error: %s' % msg) |
562 print('Error: {0}'.format(msg)) |
556 exit(1) |
563 exit(1) |
557 print("Found QScintilla2") |
564 print("Found QScintilla2") |
558 |
565 |
559 # check version of Qt |
566 # check version of Qt |
560 qtMajor = int(qVersion().split('.')[0]) |
567 qtMajor = int(qVersion().split('.')[0]) |
561 qtMinor = int(qVersion().split('.')[1]) |
568 qtMinor = int(qVersion().split('.')[1]) |
562 if qtMajor < 4 or (qtMajor == 4 and qtMinor < 5): |
569 if qtMajor < 4 or (qtMajor == 4 and qtMinor < 5): |
563 print('Sorry, you must have Qt version 4.5.0 or higher.') |
570 print('Sorry, you must have Qt version 4.5.0 or higher.') |
564 exit(2) |
571 exit(2) |
565 print("Qt Version: %s" % qVersion()) |
572 print("Qt Version: {0}".format(qVersion())) |
566 |
573 |
567 #check version of PyQt |
574 #check version of PyQt |
568 from PyQt4.QtCore import PYQT_VERSION_STR |
575 from PyQt4.QtCore import PYQT_VERSION_STR |
569 pyqtVersion = PYQT_VERSION_STR |
576 pyqtVersion = PYQT_VERSION_STR |
570 # always assume, that snapshots are new enough |
577 # always assume, that snapshots are new enough |