9 src_dir
= os
.path
.dirname(os
.path
.abspath(__file__
))
15 elements
= list(elements
)
16 for n
in range(1, len(elements
)):
17 if elements
[n
][0] == '/':
18 elements
[n
] = elements
[n
][1:]
19 return os
.path
.join(*elements
)
21 def get_var(name
, default
= None):
23 v
= var_opts
.get(name
)
25 v
= os
.environ
.get(name
)
30 for a
in sys
.argv
[1:]:
34 elif a
== 'uninstall':
37 dest_dir
= get_var('DEST_DIR', '/')
38 prefix
= get_var('PREFIX')
40 fp
= subprocess
.Popen('pkg-config --variable=prefix libgnome-2.0',
41 shell
= True, stdout
= subprocess
.PIPE
).stdout
42 prefix
= fp
.read().strip()
45 lib_dir
= opj(prefix
, 'lib', 'sysbars')
46 share_dir
= opj(prefix
, 'share', 'sysbars')
47 icons_dir
= opj(prefix
, 'share', 'icons',
48 'hicolor', 'scalable', 'apps')
49 pixmaps_dir
= opj(prefix
, 'share', 'pixmaps')
50 bonobo_dir
= opj(prefix
, 'lib', 'bonobo', 'servers')
51 doc_dir
= opj(prefix
, 'share', 'doc', 'sysbars')
55 os
.unlink(opj(dest_dir
, icons_dir
, 'sysbars.svg'))
59 os
.unlink(opj(dest_dir
, pixmaps_dir
, 'sysbars.xpm'))
63 os
.unlink(opj(dest_dir
, bonobo_dir
,
64 'GNOME_SysBarsApplet.server'))
67 for d
in (lib_dir
, share_dir
, doc_dir
):
69 for root
, dirs
, files
in os
.walk(d
):
72 os
.remove(opj(root
, n
))
77 os
.rmdir(opj(root
, n
))
88 if not os
.path
.isdir(d
):
92 shutil
.copy(opj(src_dir
, f
), opj(dest_dir
, dest
))
94 for d
in (opj(lib_dir
, 'platform'), opj(lib_dir
, 'plugins'),
95 share_dir
, icons_dir
, pixmaps_dir
, bonobo_dir
, doc_dir
):
98 for f
in fnmatch
.filter(os
.listdir(src_dir
), '*.py'):
99 if f
!= 'install.py' and f
!= 'procstat.py':
101 os
.chmod(opj(dest_dir
, lib_dir
, 'sysbars.py'), 0755)
102 for f
in fnmatch
.filter(os
.listdir(opj(src_dir
, 'platform')), '*.py'):
103 install(opj('platform', f
), opj(lib_dir
, 'platform'))
104 for f
in fnmatch
.filter(os
.listdir(opj(src_dir
, 'plugins')), '*.py'):
105 install(opj('plugins', f
), opj(lib_dir
, 'plugins'))
106 install('AppInfo.xml', share_dir
)
107 install('.DirIcon', opj(icons_dir
, 'sysbars.svg'))
108 install('sysbars.xpm', pixmaps_dir
)
109 install(opj('Help', 'Changes'), opj(doc_dir
, 'ChangeLog'))
110 install(opj('Help', 'COPYING'), doc_dir
)
111 install(opj('Help', 'README'), doc_dir
)
113 fp
= open(opj(dest_dir
, lib_dir
, 'prefix.py'), 'w')
119 """ % (prefix
, share_dir
, icons_dir
))
122 fp
= open(opj(dest_dir
, bonobo_dir
, 'GNOME_SysBarsApplet.server'), 'w')
125 <oaf_server iid="OAFIID:GNOME_SysBarsApplet_Factory"
126 type="exe" location="%s">
128 <oaf_attribute name="repo_ids" type="stringv">
129 <item value="IDL:Bonobo/GenericFactory:1.0"/>
130 <item value="IDL:Bonobo/Unknown:1.0"/>
132 <oaf_attribute name="name" type="string" value="SysBars"/>
133 <oaf_attribute name="description" type="string"
134 value="System resource usage barchart display"/>
137 <oaf_server iid="OAFIID:GNOME_SysBarsApplet"
138 type="factory" location="OAFIID:GNOME_SysBarsApplet_Factory">
140 <oaf_attribute name="repo_ids" type="stringv">
141 <item value="IDL:GNOME/Vertigo/PanelAppletShell:1.0"/>
142 <item value="IDL:Bonobo/Control:1.0"/>
143 <item value="IDL:Bonobo/Unknown:1.0"/>
145 <oaf_attribute name="name" type="string" value="SysBars"/>
146 <oaf_attribute name="description" type="string"
147 value="System resource usage barchart display"/>
148 <oaf_attribute name="panel:category" type="string" value="Utility"/>
149 <oaf_attribute name="panel:icon" type="string" value="sysbars"/>
152 """ % (opj(lib_dir
, 'sysbars.py')))