389 except OSError as msg: |
389 except OSError as msg: |
390 sys.stderr.write('OSError: {0}\nTry install with admin rights.\n'.format(msg)) |
390 sys.stderr.write('OSError: {0}\nTry install with admin rights.\n'.format(msg)) |
391 exit(7) |
391 exit(7) |
392 |
392 |
393 |
393 |
394 def shutilCopy(src, dst): |
394 def shutilCopy(src, dst, perm=0o644): |
395 """ |
395 """ |
396 Wrapper function around shutil.copy() to ensure the permissions. |
396 Wrapper function around shutil.copy() to ensure the permissions. |
397 |
397 |
398 @param src source file name (string) |
398 @param src source file name (string) |
399 @param dst destination file name or directory name (string) |
399 @param dst destination file name or directory name (string) |
|
400 @keyparam perm permissions to be set (integer) |
400 """ |
401 """ |
401 shutil.copy(src, dst) |
402 shutil.copy(src, dst) |
402 if os.path.isdir(dst): |
403 if os.path.isdir(dst): |
403 dst = os.path.join(dst, os.path.basename(src)) |
404 dst = os.path.join(dst, os.path.basename(src)) |
404 os.chmod(dst, 0o644) |
405 os.chmod(dst, perm) |
405 |
406 |
406 |
407 |
407 def installEric(): |
408 def installEric(): |
408 """ |
409 """ |
409 Actually perform the installation steps. |
410 Actually perform the installation steps. |
486 copyTree('{1}{0}Examples'.format(os.sep, sourceDir), cfg['ericExamplesDir'], |
487 copyTree('{1}{0}Examples'.format(os.sep, sourceDir), cfg['ericExamplesDir'], |
487 ['*.py', '*.pyc', '*.pyo']) |
488 ['*.py', '*.pyc', '*.pyo']) |
488 |
489 |
489 # copy the wrappers |
490 # copy the wrappers |
490 for wname in wnames: |
491 for wname in wnames: |
491 shutilCopy(wname, cfg['bindir']) |
492 shutilCopy(wname, cfg['bindir'], perm=0o755) |
492 os.remove(wname) |
493 os.remove(wname) |
493 |
494 |
494 # copy the license file |
495 # copy the license file |
495 shutilCopy('{1}{0}LICENSE.GPL3'.format(os.sep, sourceDir), cfg['ericDir']) |
496 shutilCopy('{1}{0}LICENSE.GPL3'.format(os.sep, sourceDir), cfg['ericDir']) |
496 |
497 |