From: Oleg Broytman Date: Wed, 3 Aug 2016 19:12:03 +0000 (+0300) Subject: browser-stack: adapt to Python 3 X-Git-Url: https://git.phdru.name/?p=dotfiles.git;a=commitdiff_plain;h=9018b95f07313e4df571fa6959e2642db3914dc2 browser-stack: adapt to Python 3 --- diff --git a/bin/browser-stack.py b/bin/browser-stack.py index cec4f7d..0deb390 100755 --- a/bin/browser-stack.py +++ b/bin/browser-stack.py @@ -1,5 +1,6 @@ #! /usr/bin/env python +from __future__ import print_function import sys, os from browser_stack import get_stack, save_stack @@ -10,10 +11,10 @@ if command.startswith('--'): stack = get_stack() if command in ('get', 'peek', 'print'): - if stack: print stack[0], + if stack: print(stack[0], end='') sys.exit() elif command in ('list', 'list-all'): - if stack: print ''.join(stack), + if stack: print(''.join(stack), end='') sys.exit() browser = os.path.basename(sys.argv[2]) + '\n' diff --git a/bin/browser_stack.py b/bin/browser_stack.py old mode 100755 new mode 100644 index dda6e0a..94e6c60 --- a/bin/browser_stack.py +++ b/bin/browser_stack.py @@ -1,4 +1,3 @@ -#! /usr/bin/env python import os, shutil browser_stack = os.path.expanduser('~/.cache/browser-stack') @@ -11,7 +10,7 @@ def get_stack(): return [] def save_stack(stack): - os.umask(0066) # octal -rw------- + os.umask(0o066) # octal -rw------- with open(browser_stack+'.tmp', 'w') as stack_file: stack_file.writelines(stack) shutil.copy(browser_stack+'.tmp', browser_stack)