Mercurial > hg > orthanc-stone
view OrthancStone/Resources/CMake/LinuxStandardBaseUic.py @ 1527:4c4b267e4004
RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Sun, 02 Aug 2020 15:13:58 +0200 |
parents | 244ad1e4e76a |
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)