Tidy up code setting permissions

svn: r19606
This commit is contained in:
Nick Hall 2012-05-20 13:50:17 +00:00
parent c92791e4d2
commit 4884a8dcc9

View File

@ -35,12 +35,7 @@ import sys
import glob
import codecs
import commands
# determine if the computer has ability to change file permissions or not?
if hasattr(os, 'chmod'):
_has_chmod = True
else:
_has_chmod = False
from stat import ST_MODE
VERSION = '3.5.0'
ALL_LINGUAS = ('bg', 'ca', 'cs', 'da', 'de', 'en_GB', 'es', 'fi', 'fr', 'he',
@ -215,11 +210,11 @@ def write_gramps_script(install_cmd, build_scripts):
f_out.write('exec %s -O $GRAMPSDIR/gramps.py "$@"\n' % sys.executable)
f_out.close()
# set eXecute bit for gramps startup script...
# this is required for both Linux and MacOS
if _has_chmod:
log.info('Changing permissions of %s from 644 to 775', filename)
os.chmod(filename, 0775)
if os.name == 'posix':
# set read and execute bits
mode = ((os.stat(filename)[ST_MODE]) | 0555) & 07777
log.info('changing mode of %s to %o', filename, mode)
os.chmod(filename, mode)
def write_const_py(install_cmd):
'''
@ -282,11 +277,6 @@ class install(_install):
else:
update_posix()
# change permissions of build directory after installation
# so it can be deleted by normal user...
if _has_chmod:
os.system('chmod -R 777 build')
DOC_FILES = ['AUTHORS', 'COPYING', 'FAQ', 'INSTALL', 'NEWS', 'README', 'TODO']
GEDCOM_FILES = glob.glob(os.path.join('example', 'gedcom', '*.*'))
GRAMPS_FILES = glob.glob(os.path.join('example', 'gramps', '*.*'))