Ensure py2/3 compatibiliy

This commit is contained in:
Knut Ahlers 2017-12-14 11:18:00 +01:00
parent f05fc4aab9
commit 518177dd01
Signed by: luzifer
GPG key ID: DC2729FDD34BE99E
2 changed files with 7 additions and 3 deletions

View file

@ -1,5 +1,7 @@
#!/usr/bin/env python
from __future__ import print_function
import socket
hostname = socket.gethostname().split('.')[0]
@ -9,4 +11,4 @@ for c in hostname:
s = s + ord(c)
color = str(1 + s % 14).rjust(3, '0')
print '$FG[{}]'.format(color)
print('$FG[{}]'.format(color))

View file

@ -1,5 +1,7 @@
#!/usr/bin/env python
from __future__ import print_function
# Usage: git setmail
#
# Configuration format:
@ -19,13 +21,13 @@ def main():
try:
repo = [x.split()[1] for x in subprocess.check_output(['git', 'remote', '-v']).split('\n') if re.match('origin.*\(push\)', x)][0]
except:
print 'Could not find origin, not setting email.'
print('Could not find origin, not setting email.')
return 0
if os.path.isfile(CONFIG):
combinations = json.loads(open(CONFIG).read())
else:
print 'Config ({}) found.'.format(CONFIG)
print('Config ({}) found.'.format(CONFIG))
return 1
for combi in combinations: