make_msvc_package.py: clear the "-dev" version suffix

With MSVC, converting an empty macro value with STRINGIFY doesn't seem to
work.  (Maybe it's producing nothing rather than the blank literal, ""?)
Work around it by allowing __none__ as a substitute for blank.
This commit is contained in:
Ryan Prichard 2016-06-01 21:42:36 -05:00
parent 4130c88619
commit ce5c95cd4f
3 changed files with 14 additions and 4 deletions

View File

@ -18,7 +18,7 @@ with open(topDir + "/VERSION.txt", "rt") as f:
def writeBuildInfo(): def writeBuildInfo():
with open(topDir + "/BUILD_INFO.txt", "w") as f: with open(topDir + "/BUILD_INFO.txt", "w") as f:
f.write("VERSION_SUFFIX=\n") f.write("VERSION_SUFFIX=__none__\n")
f.write("COMMIT_HASH=" + commitHash + "\n") f.write("COMMIT_HASH=" + commitHash + "\n")
def rmrf(patterns): def rmrf(patterns):

View File

@ -102,7 +102,8 @@ def build(arch, packageDir, xp=False):
"../build-gyp/gyp_main.py", "../build-gyp/gyp_main.py",
"winpty.gyp", "winpty.gyp",
"-I", "configurations.gypi", "-I", "configurations.gypi",
"-G", "msvs_version=" + versionInfo["gyp_version"]] + "-G", "msvs_version=" + versionInfo["gyp_version"],
"-D", "VERSION_SUFFIX=__none__"] +
(["-D", "WINPTY_MSBUILD_TOOLSET=" + versionInfo["xp_toolset"]] if xp else []), (["-D", "WINPTY_MSBUILD_TOOLSET=" + versionInfo["xp_toolset"]] if xp else []),
cwd="src") cwd="src")
devCmdPath = os.path.join(os.environ[versionInfo["common_tools_env"]], "VsDevCmd.bat") devCmdPath = os.path.join(os.environ[versionInfo["common_tools_env"]], "VsDevCmd.bat")

View File

@ -21,20 +21,29 @@
#include "WinptyVersion.h" #include "WinptyVersion.h"
#include <stdio.h> #include <stdio.h>
#include <string.h>
#include "DebugClient.h" #include "DebugClient.h"
#define XSTRINGIFY(x) #x #define XSTRINGIFY(x) #x
#define STRINGIFY(x) XSTRINGIFY(x) #define STRINGIFY(x) XSTRINGIFY(x)
static const char *versionSuffix() {
const char *ret = STRINGIFY(WINPTY_VERSION_SUFFIX);
if (!strcmp(ret, "__none__")) {
return "";
}
return ret;
}
void dumpVersionToStdout() { void dumpVersionToStdout() {
printf("winpty version %s%s\n", STRINGIFY(WINPTY_VERSION), STRINGIFY(WINPTY_VERSION_SUFFIX)); printf("winpty version %s%s\n", STRINGIFY(WINPTY_VERSION), versionSuffix());
printf("commit %s\n", STRINGIFY(WINPTY_COMMIT_HASH)); printf("commit %s\n", STRINGIFY(WINPTY_COMMIT_HASH));
} }
void dumpVersionToTrace() { void dumpVersionToTrace() {
trace("winpty version %s%s (commit %s)", trace("winpty version %s%s (commit %s)",
STRINGIFY(WINPTY_VERSION), STRINGIFY(WINPTY_VERSION),
STRINGIFY(WINPTY_VERSION_SUFFIX), versionSuffix(),
STRINGIFY(WINPTY_COMMIT_HASH)); STRINGIFY(WINPTY_COMMIT_HASH));
} }