49 print(" (default: %s)" % (apisDir)) |
49 print(" (default: %s)" % (apisDir)) |
50 else: |
50 else: |
51 print(" (no default value)") |
51 print(" (no default value)") |
52 print(" -b dir where the binaries will be installed") |
52 print(" -b dir where the binaries will be installed") |
53 print(" (default: %s)" % (platBinDir)) |
53 print(" (default: %s)" % (platBinDir)) |
54 print(" -d dir where eric4 python files will be installed") |
54 print(" -d dir where eric5 python files will be installed") |
55 print(" (default: %s)" % (modDir)) |
55 print(" (default: %s)" % (modDir)) |
56 print(" -f file configuration file naming the various installation paths") |
56 print(" -f file configuration file naming the various installation paths") |
57 if not sys.platform.startswith("win"): |
57 if not sys.platform.startswith("win"): |
58 print(" -i dir temporary install prefix") |
58 print(" -i dir temporary install prefix") |
59 print(" (default: %s)" % (distDir)) |
59 print(" (default: %s)" % (distDir)) |
65 print("dictionary called 'cfg' with the keys 'ericDir', 'ericPixDir', 'ericIconDir',") |
65 print("dictionary called 'cfg' with the keys 'ericDir', 'ericPixDir', 'ericIconDir',") |
66 print("'ericDTDDir', 'ericCSSDir', 'ericStylesDir', 'ericDocDir', 'ericExamplesDir',") |
66 print("'ericDTDDir', 'ericCSSDir', 'ericStylesDir', 'ericDocDir', 'ericExamplesDir',") |
67 print("'ericTranslationsDir', 'ericTemplatesDir', 'ericCodeTemplatesDir',") |
67 print("'ericTranslationsDir', 'ericTemplatesDir', 'ericCodeTemplatesDir',") |
68 print("'ericOthersDir','bindir', 'mdir' and 'apidir.") |
68 print("'ericOthersDir','bindir', 'mdir' and 'apidir.") |
69 print("These define the directories for the installation of the various parts of"\ |
69 print("These define the directories for the installation of the various parts of"\ |
70 " eric4.") |
70 " eric5.") |
71 |
71 |
72 sys.exit(rcode) |
72 sys.exit(rcode) |
73 |
73 |
74 |
74 |
75 def initGlobals(): |
75 def initGlobals(): |
200 """ |
200 """ |
201 Create the global plugins directory, if it doesn't exist. |
201 Create the global plugins directory, if it doesn't exist. |
202 """ |
202 """ |
203 global cfg, distDir |
203 global cfg, distDir |
204 |
204 |
205 pdir = os.path.join(cfg['mdir'], "eric4plugins") |
205 pdir = os.path.join(cfg['mdir'], "eric5plugins") |
206 fname = os.path.join(pdir, "__init__.py") |
206 fname = os.path.join(pdir, "__init__.py") |
207 if not os.path.exists(fname): |
207 if not os.path.exists(fname): |
208 if not os.path.exists(pdir): |
208 if not os.path.exists(pdir): |
209 os.mkdir(pdir, 0o755) |
209 os.mkdir(pdir, 0o755) |
210 f = open(fname, "w") |
210 f = open(fname, "w") |
222 def cleanUp(): |
222 def cleanUp(): |
223 """ |
223 """ |
224 Uninstall the old eric files. |
224 Uninstall the old eric files. |
225 """ |
225 """ |
226 try: |
226 try: |
227 from .eric4config import getConfig |
227 from eric5config import getConfig |
228 except ImportError: |
228 except ImportError: |
229 # eric4 wasn't installed previously |
229 # eric5 wasn't installed previously |
230 return |
230 return |
231 |
231 |
232 global pyModDir, progLanguages |
232 global pyModDir, progLanguages |
233 |
233 |
234 # Remove the wrapper scripts |
234 # Remove the wrapper scripts |
235 rem_wnames = [ |
235 rem_wnames = [ |
236 "eric4-api", "eric4-compare", |
236 "eric5-api", "eric5-compare", |
237 "eric4-configure", "eric4-diff", |
237 "eric5-configure", "eric5-diff", |
238 "eric4-doc", "eric4-helpviewer", |
238 "eric5-doc", "eric5-helpviewer", |
239 "eric4-qregexp", "eric4-re", |
239 "eric5-qregexp", "eric5-re", |
240 "eric4-trpreviewer", "eric4-uipreviewer", |
240 "eric5-trpreviewer", "eric5-uipreviewer", |
241 "eric4-unittest", "eric4", |
241 "eric5-unittest", "eric5", |
242 "eric4-tray", "eric4-editor", |
242 "eric5-tray", "eric5-editor", |
243 "eric4-plugininstall", "eric4-pluginuninstall", |
243 "eric5-plugininstall", "eric5-pluginuninstall", |
244 "eric4-pluginrepository", "eric4-sqlbrowser", |
244 "eric5-pluginrepository", "eric5-sqlbrowser", |
245 "eric4-webbrowser", |
245 "eric5-webbrowser", |
246 ] |
246 ] |
247 for rem_wname in rem_wnames: |
247 for rem_wname in rem_wnames: |
248 rwname = wrapperName(getConfig('bindir'), rem_wname) |
248 rwname = wrapperName(getConfig('bindir'), rem_wname) |
249 if os.path.exists(rwname): |
249 if os.path.exists(rwname): |
250 os.remove(rwname) |
250 os.remove(rwname) |
251 |
251 |
252 # Cleanup our config file |
252 # Cleanup our config file |
253 for name in ['eric4config.py', 'eric4config.pyc']: |
253 for name in ['eric5config.py', 'eric5config.pyc']: |
254 e4cfile = os.path.join(pyModDir, name) |
254 e4cfile = os.path.join(pyModDir, name) |
255 if os.path.exists(e4cfile): |
255 if os.path.exists(e4cfile): |
256 os.remove(e4cfile) |
256 os.remove(e4cfile) |
257 |
257 |
258 # Cleanup the install directories |
258 # Cleanup the install directories |
261 'ericCodeTemplatesDir', 'ericOthersDir', 'ericStylesDir']: |
261 'ericCodeTemplatesDir', 'ericOthersDir', 'ericStylesDir']: |
262 if os.path.exists(getConfig(name)): |
262 if os.path.exists(getConfig(name)): |
263 shutil.rmtree(getConfig(name), True) |
263 shutil.rmtree(getConfig(name), True) |
264 |
264 |
265 # Cleanup translations |
265 # Cleanup translations |
266 for name in glob.glob(os.path.join(getConfig('ericTranslationsDir'), 'eric4_*.qm')): |
266 for name in glob.glob(os.path.join(getConfig('ericTranslationsDir'), 'eric5_*.qm')): |
267 if os.path.exists(name): |
267 if os.path.exists(name): |
268 os.remove(name) |
268 os.remove(name) |
269 |
269 |
270 # Cleanup API files |
270 # Cleanup API files |
271 try: |
271 try: |
285 """ |
285 """ |
286 global distDir, doCleanup, cfg, progLanguages |
286 global distDir, doCleanup, cfg, progLanguages |
287 |
287 |
288 # Create the platform specific wrappers. |
288 # Create the platform specific wrappers. |
289 wnames = [] |
289 wnames = [] |
290 wnames.append(createPyWrapper(cfg['ericDir'], "eric4-api")) |
290 wnames.append(createPyWrapper(cfg['ericDir'], "eric5-api")) |
291 wnames.append(createPyWrapper(cfg['ericDir'], "eric4-compare")) |
291 wnames.append(createPyWrapper(cfg['ericDir'], "eric5-compare")) |
292 wnames.append(createPyWrapper(cfg['ericDir'], "eric4-configure")) |
292 wnames.append(createPyWrapper(cfg['ericDir'], "eric5-configure")) |
293 wnames.append(createPyWrapper(cfg['ericDir'], "eric4-diff")) |
293 wnames.append(createPyWrapper(cfg['ericDir'], "eric5-diff")) |
294 wnames.append(createPyWrapper(cfg['ericDir'], "eric4-doc")) |
294 wnames.append(createPyWrapper(cfg['ericDir'], "eric5-doc")) |
295 wnames.append(createPyWrapper(cfg['ericDir'], "eric4-webbrowser")) |
295 wnames.append(createPyWrapper(cfg['ericDir'], "eric5-webbrowser")) |
296 wnames.append(createPyWrapper(cfg['ericDir'], "eric4-qregexp")) |
296 wnames.append(createPyWrapper(cfg['ericDir'], "eric5-qregexp")) |
297 wnames.append(createPyWrapper(cfg['ericDir'], "eric4-re")) |
297 wnames.append(createPyWrapper(cfg['ericDir'], "eric5-re")) |
298 wnames.append(createPyWrapper(cfg['ericDir'], "eric4-trpreviewer")) |
298 wnames.append(createPyWrapper(cfg['ericDir'], "eric5-trpreviewer")) |
299 wnames.append(createPyWrapper(cfg['ericDir'], "eric4-uipreviewer")) |
299 wnames.append(createPyWrapper(cfg['ericDir'], "eric5-uipreviewer")) |
300 wnames.append(createPyWrapper(cfg['ericDir'], "eric4-unittest")) |
300 wnames.append(createPyWrapper(cfg['ericDir'], "eric5-unittest")) |
301 wnames.append(createPyWrapper(cfg['ericDir'], "eric4-tray")) |
301 wnames.append(createPyWrapper(cfg['ericDir'], "eric5-tray")) |
302 wnames.append(createPyWrapper(cfg['ericDir'], "eric4-editor")) |
302 wnames.append(createPyWrapper(cfg['ericDir'], "eric5-editor")) |
303 wnames.append(createPyWrapper(cfg['ericDir'], "eric4-plugininstall")) |
303 wnames.append(createPyWrapper(cfg['ericDir'], "eric5-plugininstall")) |
304 wnames.append(createPyWrapper(cfg['ericDir'], "eric4-pluginuninstall")) |
304 wnames.append(createPyWrapper(cfg['ericDir'], "eric5-pluginuninstall")) |
305 wnames.append(createPyWrapper(cfg['ericDir'], "eric4-pluginrepository")) |
305 wnames.append(createPyWrapper(cfg['ericDir'], "eric5-pluginrepository")) |
306 wnames.append(createPyWrapper(cfg['ericDir'], "eric4-sqlbrowser")) |
306 wnames.append(createPyWrapper(cfg['ericDir'], "eric5-sqlbrowser")) |
307 wnames.append(createPyWrapper(cfg['ericDir'], "eric4")) |
307 wnames.append(createPyWrapper(cfg['ericDir'], "eric5")) |
308 |
308 |
309 # set install prefix, if not None |
309 # set install prefix, if not None |
310 if distDir: |
310 if distDir: |
311 for key in list(cfg.keys()): |
311 for key in list(cfg.keys()): |
312 cfg[key] = os.path.normpath(distDir + os.sep + cfg[key]) |
312 cfg[key] = os.path.normpath(distDir + os.sep + cfg[key]) |
316 # make the install directories |
316 # make the install directories |
317 for key in list(cfg.keys()): |
317 for key in list(cfg.keys()): |
318 if not os.path.isdir(cfg[key]): |
318 if not os.path.isdir(cfg[key]): |
319 os.makedirs(cfg[key]) |
319 os.makedirs(cfg[key]) |
320 |
320 |
321 # copy the eric4 config file |
321 # copy the eric5 config file |
322 if distDir: |
322 if distDir: |
323 shutil.copy('eric4config.py', cfg['mdir']) |
323 shutil.copy('eric5config.py', cfg['mdir']) |
324 if os.path.exists('eric4config.pyc'): |
324 if os.path.exists('eric5config.pyc'): |
325 shutil.copy('eric4config.pyc', cfg['mdir']) |
325 shutil.copy('eric5config.pyc', cfg['mdir']) |
326 else: |
326 else: |
327 shutil.copy('eric4config.py', modDir) |
327 shutil.copy('eric5config.py', modDir) |
328 if os.path.exists('eric4config.pyc'): |
328 if os.path.exists('eric5config.pyc'): |
329 shutil.copy('eric4config.pyc', modDir) |
329 shutil.copy('eric5config.pyc', modDir) |
330 |
330 |
331 # copy the eric4.pth file |
331 # copy the eric5.pth file |
332 if distDir: |
332 if distDir: |
333 shutil.copy('eric%seric4.pth' % os.sep, cfg['mdir']) |
333 shutil.copy('eric%seric5.pth' % os.sep, cfg['mdir']) |
334 else: |
334 else: |
335 shutil.copy('eric%seric4.pth' % os.sep, modDir) |
335 shutil.copy('eric%seric5.pth' % os.sep, modDir) |
336 |
336 |
337 # copy the various parts of eric4 |
337 # copy the various parts of eric5 |
338 copyTree('eric', cfg['ericDir'], ['*.py', '*.pyc', '*.pyo', '*.pyw'], |
338 copyTree('eric', cfg['ericDir'], ['*.py', '*.pyc', '*.pyo', '*.pyw'], |
339 ['eric%sExamples' % os.sep]) |
339 ['eric%sExamples' % os.sep]) |
340 copyTree('eric', cfg['ericDir'], ['*.rb'], |
340 copyTree('eric', cfg['ericDir'], ['*.rb'], |
341 ['eric%sExamples' % os.sep]) |
341 ['eric%sExamples' % os.sep]) |
342 copyTree('eric%sPlugins' % os.sep, '%s%sPlugins' % (cfg['ericDir'], os.sep), |
342 copyTree('eric%sPlugins' % os.sep, '%s%sPlugins' % (cfg['ericDir'], os.sep), |
402 """ |
402 """ |
403 Create the installation config dictionary. |
403 Create the installation config dictionary. |
404 """ |
404 """ |
405 global modDir, platBinDir, cfg, apisDir |
405 global modDir, platBinDir, cfg, apisDir |
406 |
406 |
407 ericdir = os.path.join(modDir, "eric4") |
407 ericdir = os.path.join(modDir, "eric5") |
408 cfg = { |
408 cfg = { |
409 'ericDir' : ericdir, |
409 'ericDir' : ericdir, |
410 'ericPixDir' : os.path.join(ericdir, "pixmaps"), |
410 'ericPixDir' : os.path.join(ericdir, "pixmaps"), |
411 'ericIconDir' : os.path.join(ericdir, "icons"), |
411 'ericIconDir' : os.path.join(ericdir, "icons"), |
412 'ericDTDDir' : os.path.join(ericdir, "DTDs"), |
412 'ericDTDDir' : os.path.join(ericdir, "DTDs"), |
436 apis = [] |
436 apis = [] |
437 for progLanguage in progLanguages: |
437 for progLanguage in progLanguages: |
438 for apiName in glob.glob(os.path.join("eric", "APIs", progLanguage, "*.api")): |
438 for apiName in glob.glob(os.path.join("eric", "APIs", progLanguage, "*.api")): |
439 apis.append(os.path.basename(apiName)) |
439 apis.append(os.path.basename(apiName)) |
440 |
440 |
441 fn = 'eric4config.py' |
441 fn = 'eric5config.py' |
442 config = \ |
442 config = \ |
443 """# -*- coding: utf-8 -*- |
443 """# -*- coding: utf-8 -*- |
444 # |
444 # |
445 # This module contains the configuration of the individual eric4 installation |
445 # This module contains the configuration of the individual eric5 installation |
446 # |
446 # |
447 |
447 |
448 _pkg_config = { |
448 _pkg_config = { |
449 'ericDir' : r'%s', |
449 'ericDir' : r'%s', |
450 'ericPixDir' : r'%s', |
450 'ericPixDir' : r'%s', |
491 Perform some dependency checks. |
491 Perform some dependency checks. |
492 """ |
492 """ |
493 print('Checking dependencies') |
493 print('Checking dependencies') |
494 |
494 |
495 # perform dependency checks |
495 # perform dependency checks |
496 if sys.version_info < (2, 6, 0): |
496 if sys.version_info < (3, 1, 0): |
497 print('Sorry, you must have Python 2.6.0 or higher.') |
497 print('Sorry, you must have Python 3.1.0 or higher.') |
498 sys.exit(5) |
498 sys.exit(5) |
499 if sys.version_info > (2, 9, 9): |
499 if sys.version_info > (3, 9, 9): |
500 print('Sorry, eric4 requires Python 2 for running.') |
500 print('Sorry, eric5 requires Python 3 for running.') |
501 sys.exit(5) |
501 sys.exit(5) |
502 print("Python Version: %d.%d.%d" % sys.version_info[:3]) |
502 print("Python Version: %d.%d.%d" % sys.version_info[:3]) |
503 |
503 |
504 try: |
504 try: |
505 from PyQt4.QtCore import qVersion, PYQT_VERSION |
505 from PyQt4.QtCore import qVersion, PYQT_VERSION |
733 if distDir: |
733 if distDir: |
734 compileall.compile_dir("eric", |
734 compileall.compile_dir("eric", |
735 ddir = os.path.join(distDir, modDir, cfg['ericDir']), |
735 ddir = os.path.join(distDir, modDir, cfg['ericDir']), |
736 rx = re.compile("Python3"), |
736 rx = re.compile("Python3"), |
737 quiet = True) |
737 quiet = True) |
738 py_compile.compile("eric4config.py", |
738 py_compile.compile("eric5config.py", |
739 dfile = os.path.join(distDir, modDir, "eric4config.py")) |
739 dfile = os.path.join(distDir, modDir, "eric5config.py")) |
740 else: |
740 else: |
741 compileall.compile_dir("eric", |
741 compileall.compile_dir("eric", |
742 ddir = os.path.join(modDir, cfg['ericDir']), |
742 ddir = os.path.join(modDir, cfg['ericDir']), |
743 rx = re.compile("Python3"), |
743 rx = re.compile("Python3"), |
744 quiet = True) |
744 quiet = True) |
745 py_compile.compile("eric4config.py", |
745 py_compile.compile("eric5config.py", |
746 dfile = os.path.join(modDir, "eric4config.py")) |
746 dfile = os.path.join(modDir, "eric5config.py")) |
747 print("\nInstalling eric4 ...") |
747 print("\nInstalling eric5 ...") |
748 installEric() |
748 installEric() |
749 print("\nInstallation complete.") |
749 print("\nInstallation complete.") |
750 print() |
750 print() |
751 |
751 |
752 # check PyXML version and output a message for broken PyXML (< 0.8.6) |
752 # check PyXML version and output a message for broken PyXML (< 0.8.6) |
753 try: |
753 try: |
754 import _xmlplus |
754 import _xmlplus |
755 v = _xmlplus.version_info |
755 v = _xmlplus.version_info |
756 if v < (0, 8, 6): |
756 if v < (0, 8, 6): |
757 from .eric4.patch_pyxml import isPatched, patchPyXML |
757 from eric5.patch_pyxml import isPatched, patchPyXML |
758 if not isPatched(): |
758 if not isPatched(): |
759 print("NOTE:") |
759 print("NOTE:") |
760 print(" Found PyXML %d.%d.%d, which needs a patch to work correctly" % \ |
760 print(" Found PyXML %d.%d.%d, which needs a patch to work correctly" % \ |
761 (v[0], v[1], v[2])) |
761 (v[0], v[1], v[2])) |
762 print(" with foreign characters. Please see 'README-PyXML.txt' for") |
762 print(" with foreign characters. Please see 'README-PyXML.txt' for") |