1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-11-10 14:56:14 +01:00
github.com_openSUSE_osc/osc-wrapper.py
Michal Vyskocil f3b4acfd0a python3 compatibility: fix osc-wrapper
the sys reload trick does not work in python 3 and it is not needed, so
let's remove that
2013-04-16 10:51:42 +02:00

28 lines
676 B
Python
Executable File

#!/usr/bin/env python
# this wrapper exists so it can be put into /usr/bin, but still allows the
# python module to be called within the source directory during development
import locale
import sys
from osc import commandline, babysitter
try:
# this is a hack to make osc work as expected with utf-8 characters,
# no matter how site.py is set...
reload(sys)
loc = locale.getpreferredencoding()
if not loc:
loc = sys.getpreferredencoding()
sys.setdefaultencoding(loc)
del sys.setdefaultencoding
except NameError:
#reload, neither setdefaultencoding are in python3
pass
osccli = commandline.Osc()
r = babysitter.run(osccli)
sys.exit(r)