]> granicus.if.org Git - python/commitdiff
issue 9981
authorKristján Valur Jónsson <kristjan@ccpgames.com>
Wed, 3 Nov 2010 13:57:00 +0000 (13:57 +0000)
committerKristján Valur Jónsson <kristjan@ccpgames.com>
Wed, 3 Nov 2010 13:57:00 +0000 (13:57 +0000)
let make_buildinfo use a temporary directory on windows

PCbuild/make_buildinfo.c
PCbuild/make_buildinfo.vcproj
PCbuild/pythoncore.vcproj

index 5a3d385227e669ad2df9cdb02c6d9e3963952f03..a41aac59b8c20391c92fc5f5dcdfa7980539f4de 100644 (file)
    invoked as a pre-link step for pythoncore, so that overwrites
    any previous getbuildinfo.o.
 
+   However, if a second argument is provided, this will be used
+   as a temporary directory where any getbuildinfo2.c and
+   getbuildinfo.o files are put.  This is useful if multiple
+   configurations are being built in parallel, to avoid them
+   trampling each other's files.
+
 */
 
-int make_buildinfo2()
+int make_buildinfo2(const char *tmppath)
 {
     struct _stat st;
     HKEY hTortoise;
@@ -46,7 +52,9 @@ int make_buildinfo2()
     if (_stat(command+1, &st) < 0)
         /* subwcrev.exe not part of the release */
         return 0;
-    strcat_s(command, CMD_SIZE, "\" .. ..\\Modules\\getbuildinfo.c getbuildinfo2.c");
+    strcat_s(command, CMD_SIZE, "\" .. ..\\Modules\\getbuildinfo.c ");
+    strcat_s(command, CMD_SIZE, tmppath);
+    strcat_s(command, CMD_SIZE, "getbuildinfo2.c");
     puts(command); fflush(stdout);
     if (system(command) < 0)
         return 0;
@@ -55,10 +63,12 @@ int make_buildinfo2()
 
 int main(int argc, char*argv[])
 {
-    char command[500] = "cl.exe -c -D_WIN32 -DUSE_DL_EXPORT -D_WINDOWS -DWIN32 -D_WINDLL ";
+    char command[CMD_SIZE] = "cl.exe -c -D_WIN32 -DUSE_DL_EXPORT -D_WINDOWS -DWIN32 -D_WINDLL ";
+    char tmppath[CMD_SIZE] = "";
     int do_unlink, result;
-    if (argc != 2) {
-        fprintf(stderr, "make_buildinfo $(ConfigurationName)\n");
+    char *tmpdir = NULL;
+    if (argc <= 2 || argc > 3) {
+        fprintf(stderr, "make_buildinfo $(ConfigurationName) [tmpdir]\n");
         return EXIT_FAILURE;
     }
     if (strcmp(argv[1], "Release") == 0) {
@@ -78,16 +88,28 @@ int main(int argc, char*argv[])
         fprintf(stderr, "unsupported configuration %s\n", argv[1]);
         return EXIT_FAILURE;
     }
+    if (argc > 2) {
+        tmpdir = argv[2];
+        strcat_s(tmppath, _countof(tmppath), tmpdir);
+        strcat_s(tmppath, _countof(tmppath), "\\");
+    }
 
-    if ((do_unlink = make_buildinfo2()))
+    if ((do_unlink = make_buildinfo2(tmppath))) {
+        strcat_s(command, CMD_SIZE, tmppath);
         strcat_s(command, CMD_SIZE, "getbuildinfo2.c -DSUBWCREV ");
-    else
+    else
         strcat_s(command, CMD_SIZE, "..\\Modules\\getbuildinfo.c");
-    strcat_s(command, CMD_SIZE, " -Fogetbuildinfo.o -I..\\Include -I..\\PC");
+    strcat_s(command, CMD_SIZE, " -Fo");
+    strcat_s(command, CMD_SIZE, tmppath);
+    strcat_s(command, CMD_SIZE, "getbuildinfo.o -I..\\Include -I..\\PC");
     puts(command); fflush(stdout);
     result = system(command);
-    if (do_unlink)
-        _unlink("getbuildinfo2.c");
+    if (do_unlink) {
+        command[0] = '\0';
+        strcat_s(command, CMD_SIZE, tmppath);
+        strcat_s(command, CMD_SIZE, "getbuildinfo2.c");
+        _unlink(command);
+    }
     if (result < 0)
         return EXIT_FAILURE;
     return 0;
index c42229c1a0ac9aa7ea720d244c0e809d1399281d..e494d93b0e314e5e932507b8d437bbf021ab9b03 100644 (file)
@@ -12,9 +12,6 @@
                <Platform
                        Name="Win32"
                />
-               <Platform
-                       Name="x64"
-               />
        </Platforms>
        <ToolFiles>
        </ToolFiles>
                                Name="VCPostBuildEventTool"
                        />
                </Configuration>
-               <Configuration
-                       Name="Release|x64"
-                       ConfigurationType="1"
-                       InheritedPropertySheets=".\pyproject.vsprops;.\x64.vsprops;.\release.vsprops"
-                       >
-                       <Tool
-                               Name="VCPreBuildEventTool"
-                       />
-                       <Tool
-                               Name="VCCustomBuildTool"
-                       />
-                       <Tool
-                               Name="VCXMLDataGeneratorTool"
-                       />
-                       <Tool
-                               Name="VCWebServiceProxyGeneratorTool"
-                       />
-                       <Tool
-                               Name="VCMIDLTool"
-                       />
-                       <Tool
-                               Name="VCCLCompilerTool"
-                               PreprocessorDefinitions="_CONSOLE"
-                       />
-                       <Tool
-                               Name="VCManagedResourceCompilerTool"
-                       />
-                       <Tool
-                               Name="VCResourceCompilerTool"
-                       />
-                       <Tool
-                               Name="VCPreLinkEventTool"
-                       />
-                       <Tool
-                               Name="VCLinkerTool"
-                       />
-                       <Tool
-                               Name="VCALinkTool"
-                       />
-                       <Tool
-                               Name="VCManifestTool"
-                       />
-                       <Tool
-                               Name="VCXDCMakeTool"
-                       />
-                       <Tool
-                               Name="VCBscMakeTool"
-                       />
-                       <Tool
-                               Name="VCFxCopTool"
-                       />
-                       <Tool
-                               Name="VCAppVerifierTool"
-                       />
-                       <Tool
-                               Name="VCPostBuildEventTool"
-                       />
-               </Configuration>
        </Configurations>
        <References>
        </References>
index 77aa1e3b95f9daf57704b7530297c3be44bbc9ec..f5d12a3fb4daf4412e41bb7f48582148af22161e 100644 (file)
                        <Tool
                                Name="VCPreLinkEventTool"
                                Description="Generate build information..."
-                               CommandLine="&quot;$(SolutionDir)make_buildinfo.exe&quot; Release"
+                               CommandLine="&quot;$(SolutionDir)make_buildinfo.exe&quot; Release $(IntDir)"
                        />
                        <Tool
                                Name="VCLinkerTool"
-                               AdditionalDependencies="getbuildinfo.o"
+                               AdditionalDependencies="$(IntDir)\getbuildinfo.o"
                                OutputFile="$(OutDir)\$(PyDllName).dll"
                                IgnoreDefaultLibraryNames="libc"
                                ProgramDatabaseFile="$(OutDir)$(PyDllName).pdb"
                        <Tool
                                Name="VCPreLinkEventTool"
                                Description="Generate build information..."
-                               CommandLine="&quot;$(SolutionDir)make_buildinfo.exe&quot; Release"
+                               CommandLine="&quot;$(SolutionDir)make_buildinfo.exe&quot; Release $(IntDir)"
                        />
                        <Tool
                                Name="VCLinkerTool"
-                               AdditionalDependencies="getbuildinfo.o"
+                               AdditionalDependencies="$(IntDir)\getbuildinfo.o"
                                OutputFile="$(OutDir)\$(PyDllName).dll"
                                IgnoreDefaultLibraryNames="libc"
                                ProgramDatabaseFile="$(OutDir)$(PyDllName).pdb"
                        <Tool
                                Name="VCPreLinkEventTool"
                                Description="Generate build information..."
-                               CommandLine="&quot;$(SolutionDir)make_buildinfo.exe&quot; Debug"
+                               CommandLine="&quot;$(SolutionDir)make_buildinfo.exe&quot; Debug $(IntDir)"
                        />
                        <Tool
                                Name="VCLinkerTool"
-                               AdditionalDependencies="getbuildinfo.o"
+                               AdditionalDependencies="$(IntDir)\getbuildinfo.o"
                                OutputFile="$(OutDir)\$(PyDllName)_d.dll"
                                IgnoreDefaultLibraryNames="libc"
                                ProgramDatabaseFile="$(OutDir)$(PyDllName)_d.pdb"
                        <Tool
                                Name="VCPreLinkEventTool"
                                Description="Generate build information..."
-                               CommandLine="&quot;$(SolutionDir)make_buildinfo.exe&quot; Debug"
+                               CommandLine="&quot;$(SolutionDir)make_buildinfo.exe&quot; Debug $(IntDir)"
                        />
                        <Tool
                                Name="VCLinkerTool"
-                               AdditionalDependencies="getbuildinfo.o"
+                               AdditionalDependencies="$(IntDir)\getbuildinfo.o"
                                OutputFile="$(OutDir)\$(PyDllName)_d.dll"
                                IgnoreDefaultLibraryNames="libc"
                                ProgramDatabaseFile="$(OutDir)$(PyDllName)_d.pdb"
                        <Tool
                                Name="VCPreLinkEventTool"
                                Description="Generate build information..."
-                               CommandLine="&quot;$(SolutionDir)make_buildinfo.exe&quot; Release"
+                               CommandLine="&quot;$(SolutionDir)make_buildinfo.exe&quot; Release $(IntDir)"
                        />
                        <Tool
                                Name="VCLinkerTool"
-                               AdditionalDependencies="getbuildinfo.o"
+                               AdditionalDependencies="$(IntDir)\getbuildinfo.o"
                                OutputFile="$(OutDir)\$(PyDllName).dll"
                                IgnoreDefaultLibraryNames="libc"
                                ProgramDatabaseFile="$(OutDir)$(PyDllName).pdb"
                        <Tool
                                Name="VCPreLinkEventTool"
                                Description="Generate build information..."
-                               CommandLine="&quot;$(SolutionDir)make_buildinfo.exe&quot; Release"
+                               CommandLine="&quot;$(SolutionDir)make_buildinfo.exe&quot; Release $(IntDir)"
                        />
                        <Tool
                                Name="VCLinkerTool"
-                               AdditionalDependencies="getbuildinfo.o"
+                               AdditionalDependencies="$(IntDir)\getbuildinfo.o"
                                OutputFile="$(OutDir)\$(PyDllName).dll"
                                IgnoreDefaultLibraryNames="libc"
                                ProgramDatabaseFile="$(OutDir)$(PyDllName).pdb"
                        <Tool
                                Name="VCPreLinkEventTool"
                                Description="Generate build information..."
-                               CommandLine="&quot;$(SolutionDir)make_buildinfo.exe&quot; Release"
+                               CommandLine="&quot;$(SolutionDir)make_buildinfo.exe&quot; Release ($IntDir)"
                        />
                        <Tool
                                Name="VCLinkerTool"
-                               AdditionalDependencies="getbuildinfo.o"
+                               AdditionalDependencies="$(IntDir)\getbuildinfo.o"
                                OutputFile="$(OutDir)\$(PyDllName).dll"
                                IgnoreDefaultLibraryNames="libc"
                                ProgramDatabaseFile="$(OutDir)$(PyDllName).pdb"
                        <Tool
                                Name="VCPreLinkEventTool"
                                Description="Generate build information..."
-                               CommandLine="&quot;$(SolutionDir)make_buildinfo.exe&quot; Release"
+                               CommandLine="&quot;$(SolutionDir)make_buildinfo.exe&quot; Release $(IntDir)"
                        />
                        <Tool
                                Name="VCLinkerTool"
-                               AdditionalDependencies="getbuildinfo.o"
+                               AdditionalDependencies="$(IntDir)\getbuildinfo.o"
                                OutputFile="$(OutDir)\$(PyDllName).dll"
                                IgnoreDefaultLibraryNames="libc"
                                ProgramDatabaseFile="$(OutDir)$(PyDllName).pdb"