Rev 3545: fix how cog.py is invoked on Windows (Mark Hammond) in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Thu Jul 17 02:01:26 BST 2008


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 3545
revision-id:pqm at pqm.ubuntu.com-20080717010114-xbxqlwo42vqi0rif
parent: pqm at pqm.ubuntu.com-20080716232313-9pcoze89hualg5qn
parent: ian.clatworthy at canonical.com-20080717004125-xqq4jhlh9ldxgg7a
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Thu 2008-07-17 02:01:14 +0100
message:
  fix how cog.py is invoked on Windows (Mark Hammond)
added:
  tools/win32/run_script.py      run_script.py-20080717003927-k6itvarbtnwk44o9-1
modified:
  Makefile                       Makefile-20050805140406-d96e3498bb61c5bb
    ------------------------------------------------------------
    revno: 3544.1.1
    revision-id:ian.clatworthy at canonical.com-20080717004125-xqq4jhlh9ldxgg7a
    parent: pqm at pqm.ubuntu.com-20080716232313-9pcoze89hualg5qn
    committer: Ian Clatworthy <ian.clatworthy at canonical.com>
    branch nick: ianc-integration
    timestamp: Thu 2008-07-17 10:41:25 +1000
    message:
      fix how cog.py is invoked on Windows (Mark Hammond)
    added:
      tools/win32/run_script.py      run_script.py-20080717003927-k6itvarbtnwk44o9-1
    modified:
      Makefile                       Makefile-20050805140406-d96e3498bb61c5bb
=== added file 'tools/win32/run_script.py'
--- a/tools/win32/run_script.py	1970-01-01 00:00:00 +0000
+++ b/tools/win32/run_script.py	2008-07-17 00:41:25 +0000
@@ -0,0 +1,16 @@
+# A utility that executes a script from our %PYTHON%\Scripts directory.
+# Example usage:
+# 'python run_script.py cog.py arg1 arg2'
+# which will locate %PYTHON_HOME%/Scripts/cog.py and execute it with the args.
+# This is only necessary for Windows, and only when the build process is
+# executed via a cygwin/*nix based make utility, which doesn't honor the
+# PATHEXT environment variable.
+import sys
+import os
+
+if __name__ == '__main__':
+    # clobber me, new sys.argv[0] is the script to run.
+    del sys.argv[0]
+    assert not os.path.isabs(sys.argv[0]), "If you know the FQ path, just use it!"
+    sys.argv[0] = os.path.join(sys.prefix, "Scripts", sys.argv[0])
+    execfile(sys.argv[0])

=== modified file 'Makefile'
--- a/Makefile	2008-07-02 16:52:12 +0000
+++ b/Makefile	2008-07-17 00:41:25 +0000
@@ -179,7 +179,7 @@
 # win32 installer for bzr.exe
 installer: exe copy-docs
 	@echo *** Make windows installer
-	cog.py -d -o tools/win32/bzr.iss tools/win32/bzr.iss.cog
+	python tools/win32/run_script.py cog.py -d -o tools/win32/bzr.iss tools/win32/bzr.iss.cog
 	iscc /Q tools/win32/bzr.iss
 
 # win32 Python's distutils-based installer




More information about the bazaar-commits mailing list