view Resources/CMake/LinuxStandardBaseUic.py @ 1314:9b126de2cde2 broker

Since the observer system now uses shared_ptr and many registrations are done in the constructors, and since we cannot called shared_from_this() in the constructors, it is mandatory to split construction from registration. This has been done by making many ctors protected and replacing them by factory methods that directly return shared_ptrs + added PostConstructor method when base classes perform shared_from_this() calls too.
author Benjamin Golinvaux <bgo@osimis.io>
date Mon, 16 Mar 2020 11:19:50 +0100
parents 95939fa925f6
children
line wrap: on
line source

#!/usr/bin/env python

import subprocess
import sys

if len(sys.argv) <= 1:
    sys.stderr.write('Please provide arguments for uic\n')
    sys.exit(-1)

path = ''
pos = 1
while pos < len(sys.argv):
    if sys.argv[pos].startswith('-'):
        pos += 2
    else:
        path = sys.argv[pos]
        break

if len(path) == 0:
    sys.stderr.write('Unable to find the input file in the arguments to uic\n')
    sys.exit(-1)

with open(path, 'r') as f:
    lines = f.read().split('\n')
    if (len(lines) > 1 and
        lines[0].startswith('<?')):
        content = '\n'.join(lines[1:])
    else:
        content = '\n'.join(lines)
        
# Remove the source file from the arguments
args = sys.argv[1:pos] + sys.argv[pos+1:]

p = subprocess.Popen([ '/opt/lsb/bin/uic' ] + args,
                     stdin = subprocess.PIPE)
p.communicate(input = content)