@@ -55,12 +55,11 @@ def run_global(script_name, *args):
55
55
| stat .S_IRWXG # read/write/execute, group
56
56
| stat .S_IROTH # read, others
57
57
| stat .S_IXOTH ) # execute, others
58
- PERMISSIONS_SOURCED = (
59
- stat .S_IRUSR # read, user
60
- | stat .S_IWUSR # write, user
61
- | stat .S_IRGRP # read, group
62
- | stat .S_IWGRP # write, group
63
- | stat .S_IROTH ) # read, others
58
+ PERMISSIONS_SOURCED = PERMISSIONS \
59
+ & ~ ( # remove executable bits for
60
+ stat .S_IXUSR # ... user
61
+ | stat .S_IXGRP # ...
62
+ | stat .S_IXOTH )
64
63
65
64
66
65
GLOBAL_HOOKS = [
@@ -136,12 +135,12 @@ def run_global(script_name, *args):
136
135
137
136
138
137
SOURCED = ('initialize' ,
139
- 'postactivate' ,
140
- 'predeactivate' ,
141
- 'postdeactivate' ,
142
- 'postmkproject' ,
143
- 'postmkvirtualenv' ,
144
- )
138
+ 'postactivate' ,
139
+ 'predeactivate' ,
140
+ 'postdeactivate' ,
141
+ 'postmkproject' ,
142
+ 'postmkvirtualenv' ,
143
+ )
145
144
146
145
147
146
def make_hook (filename , comment ):
@@ -155,18 +154,18 @@ def make_hook(filename, comment):
155
154
log .info ('creating %s' , filename )
156
155
f = open (filename , 'w' )
157
156
try :
158
- # for sourced scripts, the shebang line won't be used;
159
- # it is useful for editors to recognize the file type, though
157
+ # for sourced scripts, the shebang line won't be used;
158
+ # it is useful for editors to recognize the file type, though
160
159
f .write ("#!%(shell)s\n # %(comment)s\n \n " % {
161
160
'comment' : comment ,
162
161
'shell' : os .environ .get ('SHELL' , '/bin/sh' ),
163
162
})
164
163
finally :
165
164
f .close ()
166
165
os .chmod (filename ,
167
- os .path .basename (filename ) in SOURCED
168
- and PERMISSIONS_SOURCED
169
- or PERMISSIONS )
166
+ os .path .basename (filename ) in SOURCED
167
+ and PERMISSIONS_SOURCED
168
+ or PERMISSIONS )
170
169
return
171
170
172
171
0 commit comments