Print warnings about the deprecated activity.info fields

This commit is contained in:
Simon Schampijer 2010-08-17 17:25:19 +02:00
parent acd8095a29
commit 981707c112

View File

@ -25,6 +25,7 @@ import locale
import os import os
import tempfile import tempfile
import logging import logging
import warnings
from sugar import env from sugar import env
from sugar import util from sugar import util
@ -151,6 +152,8 @@ class ActivityBundle(Bundle):
self._bundle_id = cp.get(section, 'bundle_id') self._bundle_id = cp.get(section, 'bundle_id')
# FIXME deprecated # FIXME deprecated
elif cp.has_option(section, 'service_name'): elif cp.has_option(section, 'service_name'):
warnings.warn('use bundle_id instead of service_name ' \
'in your activity.info', DeprecationWarning)
self._bundle_id = cp.get(section, 'service_name') self._bundle_id = cp.get(section, 'service_name')
else: else:
raise MalformedBundleException( raise MalformedBundleException(
@ -165,6 +168,8 @@ class ActivityBundle(Bundle):
# FIXME class is deprecated # FIXME class is deprecated
if cp.has_option(section, 'class'): if cp.has_option(section, 'class'):
warnings.warn('use exec instead of class ' \
'in your activity.info', DeprecationWarning)
self.activity_class = cp.get(section, 'class') self.activity_class = cp.get(section, 'class')
elif cp.has_option(section, 'exec'): elif cp.has_option(section, 'exec'):
self.bundle_exec = cp.get(section, 'exec') self.bundle_exec = cp.get(section, 'exec')