Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # Usage add_to_whitelist.py $FILENAME $USERNAME
- import sys
- def eval_line(line):
- if line.startswith('#'):
- return line
- if '=' in line:
- key, val = line.split('=')
- if key == 'app.store.access.list':
- return line + ',' + sys.argv[2]
- return line
- def get_updated_file_content(filename):
- with open(filename, 'r') as props:
- return [eval_line(line.rstrip()) for line in props]
- filename = sys.argv[1]
- new_content = get_updated_file_content(filename)
- dst = open(filename, 'w')
- for line in new_content:
- dst.write(line + '\n')
- dst.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement