install.py

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

eric ide

mercurial