[134511] trunk/base/src/macports1.0
cal at macports.org
cal at macports.org
Fri Mar 27 14:15:41 PDT 2015
Revision: 134511
https://trac.macports.org/changeset/134511
Author: cal at macports.org
Date: 2015-03-27 14:15:41 -0700 (Fri, 27 Mar 2015)
Log Message:
-----------
base: provide macports::version as pure Tcl, and macports_version in Portfile ctxt
Use a pure-Tcl macports::version rather than using C to read a Tcl variable and
pass it back to Tcl(?!). Also make macports::version available in Portfiles as
macports_version so Portfiles can check for the base version and return helpful
error messages rather than failing.
Modified Paths:
--------------
trunk/base/src/macports1.0/macports.c
trunk/base/src/macports1.0/macports.tcl
Modified: trunk/base/src/macports1.0/macports.c
===================================================================
--- trunk/base/src/macports1.0/macports.c 2015-03-27 21:12:03 UTC (rev 134510)
+++ trunk/base/src/macports1.0/macports.c 2015-03-27 21:15:41 UTC (rev 134511)
@@ -40,23 +40,11 @@
#include "get_systemconfiguration_proxies.h"
#include "sysctl.h"
-static int
-macports__version(ClientData clientData UNUSED, Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[])
-{
- if (objc != 1) {
- Tcl_WrongNumArgs(interp, 1, objv, NULL);
- return TCL_ERROR;
- }
- Tcl_SetObjResult(interp, Tcl_GetVar2Ex(interp, "macports::autoconf::macports_version", NULL, 0));
- return TCL_OK;
-}
-
int
Macports_Init(Tcl_Interp *interp)
{
if (Tcl_InitStubs(interp, "8.4", 0) == NULL)
return TCL_ERROR;
- Tcl_CreateObjCommand(interp, "macports::version", macports__version, NULL, NULL);
Tcl_CreateObjCommand(interp, "get_systemconfiguration_proxies", GetSystemConfigurationProxiesCmd, NULL, NULL);
Tcl_CreateObjCommand(interp, "sysctl", SysctlCmd, NULL, NULL);
if (Tcl_PkgProvide(interp, "macports", "1.0") != TCL_OK)
Modified: trunk/base/src/macports1.0/macports.tcl
===================================================================
--- trunk/base/src/macports1.0/macports.tcl 2015-03-27 21:12:03 UTC (rev 134510)
+++ trunk/base/src/macports1.0/macports.tcl 2015-03-27 21:15:41 UTC (rev 134511)
@@ -80,6 +80,19 @@
variable ui_prefix "---> "
}
+##
+# Return the version of MacPorts you are running
+#
+# This proc never fails and always returns the current version in the format
+# major.minor.patch. Note that the value of patch will not be meaningful for
+# trunk releases, but we guarantee that it will compare to be greater than any
+# released versions from the same major.minor.x series. You should use the
+# MacPorts-provided Tcl extension "vercmp" to do version number comparisons on
+# the return value of this function.
+proc macports::version {} {
+ return ${macports::autoconf::macports_version}
+}
+
# Provided UI instantiations
# For standard messages, the following priorities are defined
# debug, info, msg, warn, error
@@ -1326,6 +1339,7 @@
$workername alias ui_warn_once ui_warn_once
# Export some utility functions defined here.
+ $workername alias macports_version macports::version
$workername alias macports_create_thread macports::create_thread
$workername alias getportworkpath_from_buildpath macports::getportworkpath_from_buildpath
$workername alias getportresourcepath macports::getportresourcepath
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20150327/61076d26/attachment.html>
More information about the macports-changes
mailing list