summaryrefslogtreecommitdiff
path: root/pygtk_postinstall.py
diff options
context:
space:
mode:
authorJohan Dahlin <johan@src.gnome.org>2004-12-24 15:04:03 +0000
committerJohan Dahlin <johan@src.gnome.org>2004-12-24 15:04:03 +0000
commitc13a325884ef4097bdab6bc662387679195e0216 (patch)
tree55883159e33a8d2ddf5f692586c939dff1faa759 /pygtk_postinstall.py
parent70578aeea8693e0de98f507b41278b4d2109df77 (diff)
downloadpygtk-c13a325884ef4097bdab6bc662387679195e0216.tar.gz
Add pygtk_postinstall.py, used by distutils for win32
Diffstat (limited to 'pygtk_postinstall.py')
-rw-r--r--pygtk_postinstall.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/pygtk_postinstall.py b/pygtk_postinstall.py
new file mode 100644
index 00000000..b6e9d7ab
--- /dev/null
+++ b/pygtk_postinstall.py
@@ -0,0 +1,30 @@
+
+"""pygtk is now installed on your machine.
+
+Local configuration files were successfully updated."""
+
+import os, re, sys
+
+prefix_pattern=re.compile("^prefix=.*")
+exec_pattern=re.compile("^exec\s.*")
+
+def replace_prefix(s):
+ if prefix_pattern.match(s):
+ s='prefix='+sys.prefix.replace("\\","\\\\")+'\n'
+ if exec_pattern.match(s):
+ s=('exec '+sys.prefix+'\\python.exe '+
+ '$codegendir/codegen.py \"$@\"\n').replace("\\","\\\\")
+ return s
+
+
+if len(sys.argv) == 2 and sys.argv[1] == "-install":
+
+ filenames=['lib/pkgconfig/pygtk-2.0.pc','bin/pygtk-codegen-2.0']
+ for filename in filenames:
+ pkgconfig_file = os.path.normpath(
+ os.path.join(sys.prefix,filename))
+
+ lines=open(pkgconfig_file).readlines()
+ open(pkgconfig_file, 'w').writelines(map(replace_prefix,lines))
+
+ print __doc__