equal
deleted
inserted
replaced
12 platform-specific details from the core. |
12 platform-specific details from the core. |
13 """ |
13 """ |
14 |
14 |
15 from i18n import _ |
15 from i18n import _ |
16 import cStringIO, errno, getpass, popen2, re, shutil, sys, tempfile |
16 import cStringIO, errno, getpass, popen2, re, shutil, sys, tempfile |
17 import os, threading, time, calendar, ConfigParser, locale, glob |
17 import os, stat, threading, time, calendar, ConfigParser, locale, glob |
18 |
18 |
19 try: |
19 try: |
20 set = set |
20 set = set |
21 frozenset = frozenset |
21 frozenset = frozenset |
22 except NameError: |
22 except NameError: |
1045 """check whether a file is executable""" |
1045 """check whether a file is executable""" |
1046 return (os.lstat(f).st_mode & 0100 != 0) |
1046 return (os.lstat(f).st_mode & 0100 != 0) |
1047 |
1047 |
1048 def set_exec(f, mode): |
1048 def set_exec(f, mode): |
1049 s = os.lstat(f).st_mode |
1049 s = os.lstat(f).st_mode |
1050 if (s & 0100 != 0) == mode: |
1050 if stat.S_ISLNK(s) or (s & 0100 != 0) == mode: |
1051 return |
1051 return |
1052 if mode: |
1052 if mode: |
1053 # Turn on +x for every +r bit when making a file executable |
1053 # Turn on +x for every +r bit when making a file executable |
1054 # and obey umask. |
1054 # and obey umask. |
1055 os.chmod(f, s | (s & 0444) >> 2 & ~_umask) |
1055 os.chmod(f, s | (s & 0444) >> 2 & ~_umask) |