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