pep8'd sugar3.bundle
This commit is contained in:
parent
8a6c935dd0
commit
9e4454a2ed
@ -72,9 +72,12 @@ def _expand_lang(locale):
|
|||||||
for i in range(mask + 1):
|
for i in range(mask + 1):
|
||||||
if not (i & ~mask): # if all components for this combo exist ...
|
if not (i & ~mask): # if all components for this combo exist ...
|
||||||
val = language
|
val = language
|
||||||
if i & COMPONENT_TERRITORY: val += territory
|
if i & COMPONENT_TERRITORY:
|
||||||
if i & COMPONENT_CODESET: val += codeset
|
val += territory
|
||||||
if i & COMPONENT_MODIFIER: val += modifier
|
if i & COMPONENT_CODESET:
|
||||||
|
val += codeset
|
||||||
|
if i & COMPONENT_MODIFIER:
|
||||||
|
val += modifier
|
||||||
ret.append(val)
|
ret.append(val)
|
||||||
ret.reverse()
|
ret.reverse()
|
||||||
return ret
|
return ret
|
||||||
@ -315,8 +318,9 @@ class ActivityBundle(Bundle):
|
|||||||
|
|
||||||
mime_types = self.get_mime_types()
|
mime_types = self.get_mime_types()
|
||||||
if mime_types is not None:
|
if mime_types is not None:
|
||||||
installed_icons_dir = os.path.join(xdg_data_home,
|
installed_icons_dir = \
|
||||||
'icons/sugar/scalable/mimetypes')
|
os.path.join(xdg_data_home,
|
||||||
|
'icons/sugar/scalable/mimetypes')
|
||||||
if not os.path.isdir(installed_icons_dir):
|
if not os.path.isdir(installed_icons_dir):
|
||||||
os.makedirs(installed_icons_dir)
|
os.makedirs(installed_icons_dir)
|
||||||
|
|
||||||
@ -326,11 +330,11 @@ class ActivityBundle(Bundle):
|
|||||||
svg_file = mime_icon_base + '.svg'
|
svg_file = mime_icon_base + '.svg'
|
||||||
info_file = mime_icon_base + '.icon'
|
info_file = mime_icon_base + '.icon'
|
||||||
self._symlink(svg_file,
|
self._symlink(svg_file,
|
||||||
os.path.join(installed_icons_dir,
|
os.path.join(installed_icons_dir,
|
||||||
os.path.basename(svg_file)))
|
os.path.basename(svg_file)))
|
||||||
self._symlink(info_file,
|
self._symlink(info_file,
|
||||||
os.path.join(installed_icons_dir,
|
os.path.join(installed_icons_dir,
|
||||||
os.path.basename(info_file)))
|
os.path.basename(info_file)))
|
||||||
|
|
||||||
def _symlink(self, src, dst):
|
def _symlink(self, src, dst):
|
||||||
if not os.path.isfile(src):
|
if not os.path.isfile(src):
|
||||||
@ -364,8 +368,9 @@ class ActivityBundle(Bundle):
|
|||||||
|
|
||||||
mime_types = self.get_mime_types()
|
mime_types = self.get_mime_types()
|
||||||
if mime_types is not None:
|
if mime_types is not None:
|
||||||
installed_icons_dir = os.path.join(xdg_data_home,
|
installed_icons_dir = \
|
||||||
'icons/sugar/scalable/mimetypes')
|
os.path.join(xdg_data_home,
|
||||||
|
'icons/sugar/scalable/mimetypes')
|
||||||
if os.path.isdir(installed_icons_dir):
|
if os.path.isdir(installed_icons_dir):
|
||||||
for f in os.listdir(installed_icons_dir):
|
for f in os.listdir(installed_icons_dir):
|
||||||
path = os.path.join(installed_icons_dir, f)
|
path = os.path.join(installed_icons_dir, f)
|
||||||
|
@ -123,7 +123,7 @@ class NormalizedVersion(object):
|
|||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
version_string = '.'.join(str(v) for v in self.parts)
|
version_string = '.'.join(str(v) for v in self.parts)
|
||||||
if self._local != None:
|
if self._local is not None:
|
||||||
version_string += self._local
|
version_string += self._local
|
||||||
return version_string
|
return version_string
|
||||||
|
|
||||||
@ -132,7 +132,7 @@ class NormalizedVersion(object):
|
|||||||
|
|
||||||
def _cannot_compare(self, other):
|
def _cannot_compare(self, other):
|
||||||
raise TypeError("Can not compare %s and %s"
|
raise TypeError("Can not compare %s and %s"
|
||||||
% (type(self).__name__, type(other).__name__))
|
% (type(self).__name__, type(other).__name__))
|
||||||
|
|
||||||
def __eq__(self, other):
|
def __eq__(self, other):
|
||||||
if not isinstance(other, NormalizedVersion):
|
if not isinstance(other, NormalizedVersion):
|
||||||
|
@ -66,7 +66,7 @@ class ContentBundle(Bundle):
|
|||||||
self._parse_info(info_file)
|
self._parse_info(info_file)
|
||||||
|
|
||||||
if (self.get_file('index.html') is None and
|
if (self.get_file('index.html') is None and
|
||||||
self.get_file('library/library.xml') is None):
|
self.get_file('library/library.xml') is None):
|
||||||
raise MalformedBundleException(
|
raise MalformedBundleException(
|
||||||
'Content bundle %s has neither index.html nor library.xml' %
|
'Content bundle %s has neither index.html nor library.xml' %
|
||||||
self._path)
|
self._path)
|
||||||
@ -220,7 +220,7 @@ class ContentBundle(Bundle):
|
|||||||
return True
|
return True
|
||||||
elif os.path.isdir(self.get_root_dir()):
|
elif os.path.isdir(self.get_root_dir()):
|
||||||
return ContentBundle(self.get_root_dir()).get_library_version() \
|
return ContentBundle(self.get_root_dir()).get_library_version() \
|
||||||
== self.get_library_version()
|
== self.get_library_version()
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user