1
"""distutils_extra.command.build_icons
3
Implement DistutilsExtra's 'build_icons' command.
6
# Created by Sebastian Heinlein
16
import distutils.command.build
18
class build_icons(distutils.cmd.Command):
20
description = "select all icons for installation"
22
user_options= [('icon-dir=', 'i', 'icon directory of the source tree')]
24
def initialize_options(self):
27
def finalize_options(self):
28
if self.icon_dir is None:
29
self.icon_dir = os.path.join("data", "icons")
32
data_files = self.distribution.data_files
34
for size in glob.glob(os.path.join(self.icon_dir, "*")):
35
for category in glob.glob(os.path.join(size, "*")):
37
for icon in glob.glob(os.path.join(category,"*")):
39
# Only install apps and emblems contexts to system theme
40
# everything else should go to the private hicolor theme
41
if category.endswith("apps") or \
42
category.endswith("emblems"):
43
data_files.append(("share/icons/hicolor/%s/%s" %
44
(os.path.basename(size),
45
os.path.basename(category)),
48
data_files.append(("share/%s/icons/hicolor/%s/%s" %
49
(self.distribution.get_name(),
50
os.path.basename(size),
51
os.path.basename(category)),