6 /* This file creates the getbuildinfo2.c file, by
7 invoking subwcrev.exe (if found).
8 If this isn't a subversion checkout, or subwcrev isn't
9 found, it copies ..\\Modules\\getbuildinfo.c instead.
11 A file, getbuildinfo2.h is then updated to define
12 SUBWCREV if it was a subversion checkout.
14 getbuildinfo2.c is part of the pythoncore project with
15 getbuildinfo2.h as a forced include. This helps
16 VisualStudio refrain from unnecessary compiles much of the
19 Currently, subwcrev.exe is found from the registry entries
22 make_buildinfo.exe is called as a pre-build step for pythoncore.
32 if (_stat(".svn", &st
) < 0)
34 /* Allow suppression of subwcrev.exe invocation if a no_subwcrev file is present. */
35 if (_stat("no_subwcrev", &st
) == 0)
37 if (RegOpenKey(HKEY_LOCAL_MACHINE
, "Software\\TortoiseSVN", &hTortoise
) != ERROR_SUCCESS
&&
38 RegOpenKey(HKEY_CURRENT_USER
, "Software\\TortoiseSVN", &hTortoise
) != ERROR_SUCCESS
)
39 /* Tortoise not installed */
41 command
[0] = '"'; /* quote the path to the executable */
42 size
= sizeof(command
) - 1;
43 if (RegQueryValueEx(hTortoise
, "Directory", 0, &type
, command
+1, &size
) != ERROR_SUCCESS
||
45 /* Registry corrupted */
47 strcat_s(command
, sizeof(command
), "bin\\subwcrev.exe");
48 if (_stat(command
+1, &st
) < 0)
49 /* subwcrev.exe not part of the release */
51 strcat_s(command
, sizeof(command
), "\" .. ..\\Modules\\getbuildinfo.c getbuildinfo2.c");
52 puts(command
); fflush(stdout
);
53 if (system(command
) < 0)
58 int main(int argc
, char*argv
[])
60 char command
[500] = "";
64 if (fopen_s(&f
, "getbuildinfo2.h", "w"))
66 /* Get getbuildinfo.c from svn as getbuildinfo2.c */
67 svn
= make_buildinfo2();
69 puts("got getbuildinfo2.c from svn. Updating getbuildinfo2.h");
70 /* yes. make sure SUBWCREV is defined */
71 fprintf(f
, "#define SUBWCREV\n");
73 puts("didn't get getbuildinfo2.c from svn. Copying from Modules and clearing getbuildinfo2.h");
74 strcat_s(command
, sizeof(command
), "copy ..\\Modules\\getbuildinfo.c getbuildinfo2.c");
75 puts(command
); fflush(stdout
);
76 if (system(command
) < 0)