1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-12-26 18:06:13 +01:00
github.com_openSUSE_osc/osc-wrapper.py
Jordi Mallach 9f35853216 Fix locale encoding extraction
Using locale.getdefaultlocale() for encoding detection breaks with
locales that use modifiers, such as de_DE@euro, or ca_ES@valencia.
Use locale.getpreferredencoding() instead, which should do the right
thing.
2012-08-06 09:29:59 +02:00

24 lines
565 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
# 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
osccli = commandline.Osc()
r = babysitter.run(osccli)
sys.exit(r)