comparison OrthancStone/Resources/CMake/LinuxStandardBaseUic.py @ 1512:244ad1e4e76a

reorganization of folders
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 07 Jul 2020 16:21:02 +0200
parents Resources/CMake/LinuxStandardBaseUic.py@95939fa925f6
children
comparison
equal deleted inserted replaced
1511:9dfeee74c1e6 1512:244ad1e4e76a
1 #!/usr/bin/env python
2
3 import subprocess
4 import sys
5
6 if len(sys.argv) <= 1:
7 sys.stderr.write('Please provide arguments for uic\n')
8 sys.exit(-1)
9
10 path = ''
11 pos = 1
12 while pos < len(sys.argv):
13 if sys.argv[pos].startswith('-'):
14 pos += 2
15 else:
16 path = sys.argv[pos]
17 break
18
19 if len(path) == 0:
20 sys.stderr.write('Unable to find the input file in the arguments to uic\n')
21 sys.exit(-1)
22
23 with open(path, 'r') as f:
24 lines = f.read().split('\n')
25 if (len(lines) > 1 and
26 lines[0].startswith('<?')):
27 content = '\n'.join(lines[1:])
28 else:
29 content = '\n'.join(lines)
30
31 # Remove the source file from the arguments
32 args = sys.argv[1:pos] + sys.argv[pos+1:]
33
34 p = subprocess.Popen([ '/opt/lsb/bin/uic' ] + args,
35 stdin = subprocess.PIPE)
36 p.communicate(input = content)