OSDN Git Service

setup.py: Never create nvda.exe any more. Instead, create nvda_noUIAccess.exe and...
authorJames Teh <jamie@jantrid.net>
Mon, 15 Aug 2011 05:01:30 +0000 (15:01 +1000)
committerJames Teh <jamie@jantrid.net>
Mon, 15 Aug 2011 05:01:30 +0000 (15:01 +1000)
sconstruct
source/setup.py

index cfc5fc1..2c450f2 100755 (executable)
@@ -185,7 +185,7 @@ def NVDADistGenerator(target, source, env, for_signature):
        if env.get("uiAccess"):\r
                buildCmd.append("--enable-uiAccess")\r
        if certFile:\r
-               for prog in "nvda", "nvda_slave", "nvda_service","nvda_uiAccess":\r
+               for prog in "nvda_noUIAccess", "nvda_uiAccess", "nvda_slave", "nvda_service":\r
                        action.append(signExec[:-1] + [os.path.join(target[0].path, "%s.exe" % prog)])\r
 \r
        for ext in "", "c", "o":\r
@@ -259,7 +259,6 @@ if certFile:
        env.AddPostAction(launcher, [signExec])\r
 env.Alias("launcher", launcher)\r
 \r
-\r
 clientArchive = env.SzArchive(outputDir.File("%s_controllerClient.zip" % outFilePrefix), clientDir, relativeToSourceDir=True)\r
 env.Alias("client", clientArchive)\r
 \r
index 0a4e6b0..2af0263 100755 (executable)
@@ -5,6 +5,7 @@
 #See the file COPYING for more details.\r
 \r
 import os\r
+import copy\r
 import gettext\r
 gettext.install("nvda", unicode=True)\r
 from distutils.core import setup\r
@@ -82,21 +83,23 @@ class py2exe(build_exe.py2exe):
        def copy_w9xpopen(self, modules, dlls):\r
                pass\r
 \r
-       def build_manifest(self, target, template):\r
-               if target is self.distribution.windows[0]:\r
-                       # This is the main executable.\r
-                       isMainExec = True\r
-                       if self.enable_uiAccess:\r
-                               target.uac_info = (target.uac_info[0], True)\r
-               else:\r
-                       isMainExec = False\r
+       def run(self):\r
+               dist = self.distribution\r
+               if self.enable_uiAccess:\r
+                       # Add a target for nvda_uiAccess, using nvda_noUIAccess as a base.\r
+                       target = copy.deepcopy(dist.windows[0])\r
+                       target["dest_base"] = "nvda_uiAccess"\r
+                       target["uac_info"] = (target["uac_info"][0], True)\r
+                       dist.windows.insert(1, target)\r
 \r
-               mfest, rid = build_exe.py2exe.build_manifest(self, target, template)\r
+               build_exe.py2exe.run(self)\r
 \r
-               if isMainExec:\r
+       def build_manifest(self, target, template):\r
+               mfest, rid = build_exe.py2exe.build_manifest(self, target, template)\r
+               if getattr(target, "script", None) == "nvda.pyw":\r
+                       # This is one of the main application executables.\r
                        mfest = mfest[:mfest.rindex("</assembly>")]\r
                        mfest += MAIN_MANIFEST_EXTRA + "</assembly>"\r
-\r
                return mfest, rid\r
 \r
 def getLocaleDataFiles():\r
@@ -135,6 +138,7 @@ setup(
        windows=[\r
                {\r
                        "script":"nvda.pyw",\r
+                       "dest_base":"nvda_noUIAccess",\r
                        "uac_info": ("asInvoker", False),\r
                        "icon_resources":[(1,"images/nvda.ico")],\r
                        "version":"0.0.0.0",\r
@@ -143,17 +147,7 @@ setup(
                        "copyright":copyright,\r
                        "company_name":publisher,\r
                },\r
-               {\r
-                       "script":"nvda.pyw",\r
-                       "uac_info": ("asInvoker", True),\r
-                       "dest_base":"nvda_uiAccess",\r
-                       "icon_resources":[(1,"images/nvda.ico")],\r
-                       "version":"0.0.0.0",\r
-                       "description":"NVDA application",\r
-                       "product_version":version,\r
-                       "copyright":copyright,\r
-                       "company_name":publisher,\r
-               },\r
+               # The nvda_uiAccess target will be added at runtime if required.\r
                {\r
                        "script": "nvda_slave.pyw",\r
                        "icon_resources": [(1,"images/nvda.ico")],\r