from __future__ import print_function
This commit is contained in:
parent
cb78624a92
commit
2ba2903dbc
1 changed files with 8 additions and 7 deletions
|
@ -1,6 +1,7 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
#vim: et:ts=4:sw=4:sts=4
|
#vim: et:ts=4:sw=4:sts=4
|
||||||
|
from __future__ import print_function
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
|
@ -17,9 +18,9 @@ def get_version():
|
||||||
revision = subprocess.Popen(
|
revision = subprocess.Popen(
|
||||||
['git', 'rev-list', 'HEAD', '--count'], stdout=subprocess.PIPE
|
['git', 'rev-list', 'HEAD', '--count'], stdout=subprocess.PIPE
|
||||||
).communicate()[0].strip()
|
).communicate()[0].strip()
|
||||||
print revision
|
print(revision)
|
||||||
revision = int(revision) - 94
|
revision = int(revision) - 94
|
||||||
print revision
|
print(revision)
|
||||||
else:
|
else:
|
||||||
revision = subprocess.Popen(
|
revision = subprocess.Popen(
|
||||||
['bzr', 'revno'], stdout=subprocess.PIPE
|
['bzr', 'revno'], stdout=subprocess.PIPE
|
||||||
|
@ -302,7 +303,7 @@ def build_oxjs(downloads=False, geo=False):
|
||||||
|
|
||||||
|
|
||||||
def copy_file(source, target):
|
def copy_file(source, target):
|
||||||
print 'copying', source, 'to', target
|
print('copying', source, 'to', target)
|
||||||
write_file(target, read_file(source))
|
write_file(target, read_file(source))
|
||||||
|
|
||||||
def filter_min(tarinfo):
|
def filter_min(tarinfo):
|
||||||
|
@ -354,7 +355,7 @@ def parse_css(css, values):
|
||||||
return re.sub('\$(\w+)(\[\d+\])?', sub, css)
|
return re.sub('\$(\w+)(\[\d+\])?', sub, css)
|
||||||
|
|
||||||
def read_file(file):
|
def read_file(file):
|
||||||
print 'reading', file
|
print('reading', file)
|
||||||
f = open(file)
|
f = open(file)
|
||||||
data = f.read()
|
data = f.read()
|
||||||
f.close()
|
f.close()
|
||||||
|
@ -364,7 +365,7 @@ def read_jsonc(file):
|
||||||
return ox.jsonc.loads(read_file(file))
|
return ox.jsonc.loads(read_file(file))
|
||||||
|
|
||||||
def write_file(file, data):
|
def write_file(file, data):
|
||||||
print 'writing', file
|
print('writing', file)
|
||||||
write_path(file)
|
write_path(file)
|
||||||
f = open(file, 'w')
|
f = open(file, 'w')
|
||||||
f.write(data)
|
f.write(data)
|
||||||
|
@ -372,7 +373,7 @@ def write_file(file, data):
|
||||||
return len(data)
|
return len(data)
|
||||||
|
|
||||||
def write_link(source, target):
|
def write_link(source, target):
|
||||||
print 'linking', source, 'to', target
|
print('linking', source, 'to', target)
|
||||||
write_path(target)
|
write_path(target)
|
||||||
# remove files, symlinks *and broken symlinks*
|
# remove files, symlinks *and broken symlinks*
|
||||||
if os.path.exists(target) or os.path.lexists(target):
|
if os.path.exists(target) or os.path.lexists(target):
|
||||||
|
@ -388,7 +389,7 @@ def write_path(file):
|
||||||
os.makedirs(path)
|
os.makedirs(path)
|
||||||
|
|
||||||
def write_tarfile(file, path, arcname, filter):
|
def write_tarfile(file, path, arcname, filter):
|
||||||
print 'writing', file
|
print('writing', file)
|
||||||
f = tarfile.open(file, 'w:gz')
|
f = tarfile.open(file, 'w:gz')
|
||||||
f.add(path, arcname=arcname, filter=filter)
|
f.add(path, arcname=arcname, filter=filter)
|
||||||
f.close()
|
f.close()
|
||||||
|
|
Loading…
Reference in a new issue