mumble/scripts/server/ice/testdynamic.py
Robert 56db3410c5 MAINT: Update copyright notice to 2021 (Part II)
Apparently the first commit (59ae429972)
did not include all files.

Furthermore the used script tended to produce funny results in certain
cases. This has been fixed and as a result thereof a few more changes
were made in this second run.
2021-04-09 15:41:49 +02:00

36 lines
1.1 KiB
Python
Executable File

#!/usr/bin/env python
# Copyright 2013-2021 The Mumble Developers. All rights reserved.
# Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file at the root of the
# Mumble source tree or at <https://www.mumble.info/LICENSE>.
# -*- coding: utf-8
import Ice, IcePy, sys, tempfile, os
ice = Ice.initialize(sys.argv)
proxy = ice.stringToProxy('Meta:tcp -h 127.0.0.1 -p 6502')
try:
slice = IcePy.Operation('getSlice', Ice.OperationMode.Idempotent, Ice.OperationMode.Idempotent, True, (), (), (), IcePy._t_string, ()).invoke(proxy, ((), None))
(slicefiledesc, slicefilepath) = tempfile.mkstemp(suffix = '.ice')
slicefile = os.fdopen(slicefiledesc, 'w')
slicefile.write(slice)
slicefile.flush()
Ice.loadSlice('', ['-I' + Ice.getSliceDir(), slicefilepath])
slicefile.close()
os.remove(slicefilepath)
print 'Using dynamic slice'
except Exception:
Ice.loadSlice('', ['-I' + Ice.getSliceDir(), 'Murmur.ice'])
print 'Using bundled slice'
import Murmur
meta = Murmur.MetaPrx.checkedCast(proxy)
print meta.getVersion()