2 """pygobject is now installed on your machine.
4 Local configuration files were successfully updated."""
8 prefix_pattern
=re
.compile("^prefix=.*")
11 def replace_prefix(s
):
12 if prefix_pattern
.match(s
):
13 s
='prefix='+sys
.prefix
.replace("\\","/")+'\n'
14 s
=s
.replace("@DATADIR@",
15 os
.path
.join(sys
.prefix
,'share').replace("\\","/"))
19 # TODO : Check that shortcuts are created system-wide when the user
20 # has admin rights (hint: see pywin32 postinstall)
21 def create_shortcuts():
22 progs_folder
= get_special_folder_path("CSIDL_COMMON_PROGRAMS")
23 site_packages_dir
= os
.path
.join(sys
.prefix
, 'lib','site-packages')
25 pygtk_shortcuts
= os
.path
.join(progs_folder
, 'PyGTK')
26 if not os
.path
.isdir(pygtk_shortcuts
):
27 os
.mkdir(pygtk_shortcuts
)
29 pygobject_doc_link
=os
.path
.join(pygtk_shortcuts
,
30 'PyGObject Documentation.lnk')
31 if os
.path
.isfile(pygobject_doc_link
):
32 os
.remove(pygobject_doc_link
)
34 create_shortcut(os
.path
.join(sys
.prefix
,'share','gtk-doc','html',
35 'pygobject','index.html'),
36 'PyGObject Documentation', pygobject_doc_link
)
38 def remove_shortcuts():
39 pygtk_shortcuts
= os
.path
.join(
40 get_special_folder_path('CSIDL_COMMON_PROGRAMS'), 'PyGTK')
41 os
.remove(os
.path
.join(pygtk_shortcuts
,'PyGObject Documentation.lnk'))
43 os
.rmdir(pygtk_shortcuts
)
45 # Directory is not empty, so leave it like that !
48 if len(sys
.argv
) == 2:
49 if sys
.argv
[1] == "-install":
50 filenames
=['lib/pkgconfig/pygobject-2.0.pc',
51 'share/pygobject/xsl/fixxref.py']
52 for filename
in filenames
:
53 pkgconfig_file
= os
.path
.normpath(
54 os
.path
.join(sys
.prefix
,filename
))
56 lines
=open(pkgconfig_file
).readlines()
57 open(pkgconfig_file
, 'w').writelines(map(replace_prefix
,lines
))
58 # TODO: Add an installer option for shortcut creation
61 elif sys
.argv
[1] == "-remove":