Skip to content

Commit 1f996c8

Browse files
TobiasTobias
authored andcommitted
tabs expanded; mode difference
1 parent 2df1960 commit 1f996c8

File tree

1 file changed

+16
-17
lines changed

1 file changed

+16
-17
lines changed

virtualenvwrapper/user_scripts.py

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,11 @@ def run_global(script_name, *args):
5555
| stat.S_IRWXG # read/write/execute, group
5656
| stat.S_IROTH # read, others
5757
| 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)
6463

6564

6665
GLOBAL_HOOKS = [
@@ -136,12 +135,12 @@ def run_global(script_name, *args):
136135

137136

138137
SOURCED = ('initialize',
139-
'postactivate',
140-
'predeactivate',
141-
'postdeactivate',
142-
'postmkproject',
143-
'postmkvirtualenv',
144-
)
138+
'postactivate',
139+
'predeactivate',
140+
'postdeactivate',
141+
'postmkproject',
142+
'postmkvirtualenv',
143+
)
145144

146145

147146
def make_hook(filename, comment):
@@ -155,18 +154,18 @@ def make_hook(filename, comment):
155154
log.info('creating %s', filename)
156155
f = open(filename, 'w')
157156
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
160159
f.write("#!%(shell)s\n# %(comment)s\n\n" % {
161160
'comment': comment,
162161
'shell': os.environ.get('SHELL', '/bin/sh'),
163162
})
164163
finally:
165164
f.close()
166165
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)
170169
return
171170

172171

0 commit comments

Comments
 (0)