Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
Loading items

Target

Select target project
  • anders_blomdell/pluto
  • tetov/pluto
2 results
Select Git revision
Loading items
Show changes
Commits on Source (23)
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
No preview for this file type
......@@ -53,8 +53,27 @@ class SPS:
def __init__(self, path):
self.data = open(path, encoding='utf-16').read()
self.join_broken_auto_lines()
self.gm = PlutoVariables('GM')
self.parse()
pass
def join_broken_auto_lines(self):
result = []
lines = self.data.split('\n')
i = 0
while i < len(lines):
result.append(lines[i])
i = i + 1
while (result[-1].startswith(';AUTO') and
i < len(lines) and
len(lines[i]) > 1 and
lines[i].startswith(';') ) :
result[-1] += lines[i][1:]
i = i + 1
pass
pass
self.data = '\n'.join(result)
def parse(self):
for l in self.data.split('\n'):
......
#!/usr/bin/python3
import sys
import re
import tempfile
import os
if __name__ == '__main__':
path = sys.argv[1]
variables = sys.argv[2:]
orig = [ l.replace('\n','') for l in open(path, encoding='utf-16') ]
data = list(orig)
for v in variables:
pattern = re.compile('(! %s[.])([0-9]+)(.*)' % re.escape(v))
index = 0
for i in range(0, len(data)):
m = re.match(pattern, data[i])
if m:
data[i] = '%s%s%s' % (m.group(1), index, m.group(3))
index += 1
pass
pass
pass
if orig != data:
print('Rewriting %s' % path)
f1 = tempfile.NamedTemporaryFile(dir=os.path.dirname(path),
delete=False)
f1.write(''.join([ l+'\r\n' for l in data ]).encode('utf-16'))
f1.close()
os.rename(f1.name, path)
pass
pass
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
File suppressed by a .gitattributes entry or the file's encoding is unsupported.