Permalink
Browse files

The pygtk_setup_config_files.py script could be useful

even after installation, so intall it to the Scripts dir.
  • Loading branch information...
dieterv committed Dec 23, 2010
1 parent 98e2f28 commit f35daa87e1d921fbe19cf4a7ea46b98baab591d4
Showing with 22 additions and 11 deletions.
  1. +18 −7 wix/binary/pygtk_setup_config_files.py
  2. +4 −4 wix/template/PyGtk.wxs
@@ -6,21 +6,32 @@
import subprocess
-TARGETDIR = os.path.abspath(sys.argv[1].strip())
-TMPDIR = os.path.abspath(sys.argv[2].strip())
+if len(sys.argv) == 3:
+ # Run from the all-in-one installer
+ TARGETDIR = os.path.abspath(sys.argv[1].strip())
+ TMPDIR = os.path.abspath(sys.argv[2].strip())
+
+ # We'll redirect output to a logfile
+ sys.stdout = open(os.path.join(TMPDIR, 'pygtk_setup_config_files.log'), 'w')
+ sys.stderr = open(os.path.join(TMPDIR, 'pygtk_setup_config_files.log'), 'w')
+
+ # And need to make sure Popen calls point stderr to subprocess.PIPE or
+ # suffer ugly popup "Command Prompts" during install...
+ stderr = subprocess.PIPE
+else:
+ # Run from the Scripts directory
+ TARGETDIR = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
+
+ stderr = sys.stderr
def redirect(executable, configile):
output=open(configfile, 'w')
- subprocess.Popen(executable, shell=True, stdout=output, stderr=subprocess.PIPE)
+ subprocess.Popen(executable, shell=True, stdout=output, stderr=stderr)
output.close()
if __name__ == '__main__':
- logfile = open(os.path.join(TMPDIR, 'pygtk_setup_config_files.log'), 'w')
- sys.stdout = logfile
- sys.stdout = logfile
-
# gdk-pixbuf-query-loaders
executable = os.path.join(TARGETDIR, 'Lib', 'site-packages', 'gtk-2.0',
'runtime', 'bin', 'gdk-pixbuf-query-loaders.exe')
View
@@ -112,7 +112,7 @@
<!-- WriteIniValues Sequence -->
<CustomAction Id="setup_config_files"
Directory="TARGETDIR"
- ExeCommand="&quot;[TARGETDIR]pythonw.exe&quot; -B -E -S &quot;[TempFolder]pygtk_setup_config_files.py&quot; &quot;[TARGETDIR]\&quot; &quot;[TempFolder]\&quot;"
+ ExeCommand="&quot;[TARGETDIR]pythonw.exe&quot; -B -E -S &quot;[TARGETDIR]Scripts\pygtk_setup_config_files.py&quot; &quot;[TARGETDIR]\&quot; &quot;[TempFolder]\&quot;"
Execute="commit"
Impersonate="yes"
Return="check" />
@@ -149,13 +149,13 @@
Level="1"
AllowAdvertise="no"
InstallDefault="local">
- <ComponentRef Id="TempScripts" />
+ <ComponentRef Id="Scripts" />
<ComponentRef Id="Empty" />
</Feature>
<Directory Id="TARGETDIR" Name="SourceDir">
- <Directory Id="TempFolder" Name="Temp">
- <Component Id="TempScripts" Guid="{3BE80FA8-CC1A-49F6-B293-D107E142FB7D}">
+ <Directory Id="Scripts" Name="Scripts">
+ <Component Id="Scripts" Guid="{3BE80FA8-CC1A-49F6-B293-D107E142FB7D}">
<File Id="pygtk_setup_config_files" Name="pygtk_setup_config_files.py" Source="$(var.BinarySources)/pygtk_setup_config_files.py" />
</Component>
</Directory>

0 comments on commit f35daa8

Please sign in to comment.