summaryrefslogtreecommitdiff
path: root/pygobject_postinstall.py
diff options
context:
space:
mode:
authorJohan Dahlin <johan@src.gnome.org>2006-01-09 12:33:54 +0000
committerJohan Dahlin <johan@src.gnome.org>2006-01-09 12:33:54 +0000
commitd98ba78262fdbbaa9b0caca1e5fb62b3bb39df9a (patch)
treed24b0bb5062ca3767d121cb3f65e382a43b7cef1 /pygobject_postinstall.py
parent551a38178f7e66f215980fb01200472c8e6d3cd4 (diff)
downloadpygobject-d98ba78262fdbbaa9b0caca1e5fb62b3bb39df9a.tar.gz
Add distutils support
* setup.py: Add distutils support * dsextras.py (get_m4_define): Check for configure.ac aswell.
Diffstat (limited to 'pygobject_postinstall.py')
-rw-r--r--pygobject_postinstall.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/pygobject_postinstall.py b/pygobject_postinstall.py
new file mode 100644
index 00000000..b6e9d7ab
--- /dev/null
+++ b/pygobject_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__