diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2016-03-11 09:33:35 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2016-03-11 09:33:35 (GMT) |
commit | a284f6ce98ab3ba17bfef4ba1216feac2c720633 (patch) | |
tree | ef7663727e70f36e3cb47a4137119cd18e4682b3 /generic | |
parent | 06d40a2add362702cee3dd03ab5a9b1ae13805b8 (diff) | |
parent | 61616431840c438a6934e3745b7b422f2a1d53c8 (diff) | |
download | tcl-a284f6ce98ab3ba17bfef4ba1216feac2c720633.zip tcl-a284f6ce98ab3ba17bfef4ba1216feac2c720633.tar.gz tcl-a284f6ce98ab3ba17bfef4ba1216feac2c720633.tar.bz2 |
Allow unstable Tcl releases to use unstable packages by default (this makes "package require Tk" find the expected 8.7a0 version in stead of 8.6). Make many "package" test-cases work even when the environment variable TCL_PKG_PREFER_LATEST is set.
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tclBasic.c | 5 | ||||
-rw-r--r-- | generic/tclTest.c | 35 |
2 files changed, 38 insertions, 2 deletions
diff --git a/generic/tclBasic.c b/generic/tclBasic.c index e5d7406..505f6c2 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -580,11 +580,12 @@ Tcl_CreateInterp(void) iPtr->packageUnknown = NULL; /* TIP #268 */ +#if (TCL_RELEASE_LEVEL == TCL_FINAL_RELEASE) if (getenv("TCL_PKG_PREFER_LATEST") == NULL) { iPtr->packagePrefer = PKG_PREFER_STABLE; - } else { + } else +#endif iPtr->packagePrefer = PKG_PREFER_LATEST; - } iPtr->cmdCount = 0; TclInitLiteralTable(&iPtr->literalTable); diff --git a/generic/tclTest.c b/generic/tclTest.c index 4695ab5..7c30d36 100644 --- a/generic/tclTest.c +++ b/generic/tclTest.c @@ -323,6 +323,9 @@ static int TestparsevarObjCmd(ClientData dummy, static int TestparsevarnameObjCmd(ClientData dummy, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); +static int TestpreferstableObjCmd(ClientData dummy, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); static int TestregexpObjCmd(ClientData dummy, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); @@ -653,6 +656,8 @@ Tcltest_Init( NULL, NULL); Tcl_CreateObjCommand(interp, "testparsevarname", TestparsevarnameObjCmd, NULL, NULL); + Tcl_CreateObjCommand(interp, "testpreferstable", TestpreferstableObjCmd, + NULL, NULL); Tcl_CreateObjCommand(interp, "testregexp", TestregexpObjCmd, NULL, NULL); Tcl_CreateObjCommand(interp, "testreturn", TestreturnObjCmd, @@ -3794,6 +3799,36 @@ TestparsevarnameObjCmd( /* *---------------------------------------------------------------------- * + * TestpreferstableObjCmd -- + * + * This procedure implements the "testpreferstable" command. It is + * used for being able to test the "package" command even when the + * environment variable TCL_PKG_PREFER_LATEST is set in your environment. + * + * Results: + * A standard Tcl result. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +static int +TestpreferstableObjCmd( + ClientData clientData, /* Not used. */ + Tcl_Interp *interp, /* Current interpreter. */ + int objc, /* Number of arguments. */ + Tcl_Obj *const objv[]) /* The argument objects. */ +{ + Interp *iPtr = (Interp *) interp; + iPtr->packagePrefer = PKG_PREFER_STABLE; + return TCL_OK; +} + +/* + *---------------------------------------------------------------------- + * * TestregexpObjCmd -- * * This procedure implements the "testregexp" command. It is used to give |