Ensure py2/3 compatibiliy
This commit is contained in:
parent
f05fc4aab9
commit
518177dd01
2 changed files with 7 additions and 3 deletions
|
@ -1,5 +1,7 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
|
|
||||||
import socket
|
import socket
|
||||||
|
|
||||||
hostname = socket.gethostname().split('.')[0]
|
hostname = socket.gethostname().split('.')[0]
|
||||||
|
@ -9,4 +11,4 @@ for c in hostname:
|
||||||
s = s + ord(c)
|
s = s + ord(c)
|
||||||
|
|
||||||
color = str(1 + s % 14).rjust(3, '0')
|
color = str(1 + s % 14).rjust(3, '0')
|
||||||
print '$FG[{}]'.format(color)
|
print('$FG[{}]'.format(color))
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
|
|
||||||
# Usage: git setmail
|
# Usage: git setmail
|
||||||
#
|
#
|
||||||
# Configuration format:
|
# Configuration format:
|
||||||
|
@ -19,13 +21,13 @@ def main():
|
||||||
try:
|
try:
|
||||||
repo = [x.split()[1] for x in subprocess.check_output(['git', 'remote', '-v']).split('\n') if re.match('origin.*\(push\)', x)][0]
|
repo = [x.split()[1] for x in subprocess.check_output(['git', 'remote', '-v']).split('\n') if re.match('origin.*\(push\)', x)][0]
|
||||||
except:
|
except:
|
||||||
print 'Could not find origin, not setting email.'
|
print('Could not find origin, not setting email.')
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
if os.path.isfile(CONFIG):
|
if os.path.isfile(CONFIG):
|
||||||
combinations = json.loads(open(CONFIG).read())
|
combinations = json.loads(open(CONFIG).read())
|
||||||
else:
|
else:
|
||||||
print 'Config ({}) found.'.format(CONFIG)
|
print('Config ({}) found.'.format(CONFIG))
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
for combi in combinations:
|
for combi in combinations:
|
||||||
|
|
Loading…
Reference in a new issue