[37865] branches/gsoc08-framework/MacPorts.Framework

armahg at macports.org armahg at macports.org
Thu Jun 26 16:54:02 PDT 2008


Revision: 37865
          http://trac.macosforge.org/projects/macports/changeset/37865
Author:   armahg at macports.org
Date:     2008-06-26 16:54:01 -0700 (Thu, 26 Jun 2008)
Log Message:
-----------
Made initial changes for addingNotifications

Modified Paths:
--------------
    branches/gsoc08-framework/MacPorts.Framework/MPInterpreter.m
    branches/gsoc08-framework/MacPorts.Framework/MPInterpreterTest.m
    branches/gsoc08-framework/MacPorts.Framework/MPMacPorts.h
    branches/gsoc08-framework/MacPorts.Framework/MPPort.h
    branches/gsoc08-framework/MacPorts.Framework/MacPorts.Framework.xcodeproj/project.pbxproj
    branches/gsoc08-framework/MacPorts.Framework/dummycommit.test
    branches/gsoc08-framework/MacPorts.Framework/init.tcl

Modified: branches/gsoc08-framework/MacPorts.Framework/MPInterpreter.m
===================================================================
--- branches/gsoc08-framework/MacPorts.Framework/MPInterpreter.m	2008-06-26 22:10:50 UTC (rev 37864)
+++ branches/gsoc08-framework/MacPorts.Framework/MPInterpreter.m	2008-06-26 23:54:01 UTC (rev 37865)
@@ -129,7 +129,7 @@
 }
 
 - (NSDictionary *)dictionaryFromTclListAsString:(NSString *)list {
-	return [NSDictionary dictionaryWithDictionary:[self  :list]];
+	return [NSDictionary dictionaryWithDictionary:[self  mutableDictionaryFromTclListAsString:list]];
 }
 
 - (NSMutableDictionary *)mutableDictionaryFromTclListAsString:(NSString *)list {

Modified: branches/gsoc08-framework/MacPorts.Framework/MPInterpreterTest.m
===================================================================
--- branches/gsoc08-framework/MacPorts.Framework/MPInterpreterTest.m	2008-06-26 22:10:50 UTC (rev 37864)
+++ branches/gsoc08-framework/MacPorts.Framework/MPInterpreterTest.m	2008-06-26 23:54:01 UTC (rev 37865)
@@ -65,7 +65,7 @@
 - (void)testMutableDictionaryFromTclListAsString {
 	
 }
-- (void)testEvaluateStringAsString; {
+- (void)testEvaluateStringAsString {
 	
 }
 

Modified: branches/gsoc08-framework/MacPorts.Framework/MPMacPorts.h
===================================================================
--- branches/gsoc08-framework/MacPorts.Framework/MPMacPorts.h	2008-06-26 22:10:50 UTC (rev 37864)
+++ branches/gsoc08-framework/MacPorts.Framework/MPMacPorts.h	2008-06-26 23:54:01 UTC (rev 37865)
@@ -33,12 +33,15 @@
  *	POSSIBILITY OF SUCH DAMAGE.
  */
 
+
 #import <Cocoa/Cocoa.h>
 #import "MPInterpreter.h"
 #import "MPPort.h"
 
+
 #define MPPortsAll	@".+"
 
+
 /*!
  @class MPMacPorts
  @abstract Object representation of the MacPorts system

Modified: branches/gsoc08-framework/MacPorts.Framework/MPPort.h
===================================================================
--- branches/gsoc08-framework/MacPorts.Framework/MPPort.h	2008-06-26 22:10:50 UTC (rev 37864)
+++ branches/gsoc08-framework/MacPorts.Framework/MPPort.h	2008-06-26 23:54:01 UTC (rev 37865)
@@ -33,10 +33,6 @@
  *	POSSIBILITY OF SUCH DAMAGE.
  */
 
-/*!
- @class MPPort
- @abstract	A representation of a port.
- */
 
 #import <Cocoa/Cocoa.h>
 #import "MPInterpreter.h"
@@ -44,6 +40,9 @@
 #import "MPReceipt.h"
 #import "MPRegistry.h"
 
+
+
+
 #define	MPPortStateUnknown		0
 #define MPPortStateLearnState	1
 
@@ -54,9 +53,11 @@
 
 #define MPPortWillExecuteTarget	@"org.macports.framework.port.willExecuteTarget"
 #define MPPortDidExecuteTarget	@"org.macports.framework.port.didExecuteTarget"
-
+/*!
+ @class MPPort
+ @abstract	A representation of a port.
+ */
 @interface MPPort : MPMutableDictionary {
-
 }
 
 /*!

Modified: branches/gsoc08-framework/MacPorts.Framework/MacPorts.Framework.xcodeproj/project.pbxproj
===================================================================
--- branches/gsoc08-framework/MacPorts.Framework/MacPorts.Framework.xcodeproj/project.pbxproj	2008-06-26 22:10:50 UTC (rev 37864)
+++ branches/gsoc08-framework/MacPorts.Framework/MacPorts.Framework.xcodeproj/project.pbxproj	2008-06-26 23:54:01 UTC (rev 37865)
@@ -38,6 +38,7 @@
 		48E993940C82CAAE00219DDF /* MPMacPorts.h in Headers */ = {isa = PBXBuildFile; fileRef = 48E993920C82CAAE00219DDF /* MPMacPorts.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		48E993950C82CAAE00219DDF /* MPMacPorts.m in Sources */ = {isa = PBXBuildFile; fileRef = 48E993930C82CAAE00219DDF /* MPMacPorts.m */; };
 		48E9939F0C82CEB000219DDF /* init.tcl in Resources */ = {isa = PBXBuildFile; fileRef = 48E9939E0C82CEB000219DDF /* init.tcl */; };
+		6E270BE10E1458DE00BAE687 /* init.tcl.original in Resources */ = {isa = PBXBuildFile; fileRef = 6E270BE00E1458DE00BAE687 /* init.tcl.original */; };
 		6E49F37B0DFFAB0B0030C3AF /* MPInterpreterTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 489DD92E0C94674B00595506 /* MPInterpreterTest.m */; };
 		6E49F37F0DFFAFF80030C3AF /* MacPorts.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8DC2EF5B0486A6940098B216 /* MacPorts.framework */; };
 		6EA293580E05C8FC00902D12 /* notifications.m in Sources */ = {isa = PBXBuildFile; fileRef = 6EA293570E05C8FC00902D12 /* notifications.m */; };
@@ -85,6 +86,7 @@
 		48E9939E0C82CEB000219DDF /* init.tcl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = init.tcl; sourceTree = "<group>"; };
 		48F811BE0CE4636A009630DE /* MPRegistry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPRegistry.h; sourceTree = "<group>"; };
 		48F811BF0CE4638C009630DE /* MPRegistry.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPRegistry.m; sourceTree = "<group>"; };
+		6E270BE00E1458DE00BAE687 /* init.tcl.original */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = init.tcl.original; sourceTree = "<group>"; };
 		6E88D1CA0DF4B90B00684E9F /* MPMacPortsTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPMacPortsTest.h; sourceTree = "<group>"; };
 		6E88D1CB0DF4B90B00684E9F /* MPMacPortsTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPMacPortsTest.m; sourceTree = "<group>"; };
 		6EA0F56E0DFEB55E00C15082 /* Tcl.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Tcl.framework; path = System/Library/Frameworks/Tcl.framework; sourceTree = SDKROOT; };
@@ -157,6 +159,7 @@
 				089C1666FE841158C02AAC07 /* InfoPlist.strings */,
 				489DD8F50C94365F00595506 /* Test-Info.plist */,
 				6EAFD8B70DEC614E00E97270 /* dummycommit.test */,
+				6E270BE00E1458DE00BAE687 /* init.tcl.original */,
 			);
 			name = Resources;
 			sourceTree = "<group>";
@@ -334,6 +337,7 @@
 			files = (
 				8DC2EF530486A6940098B216 /* InfoPlist.strings in Resources */,
 				48E9939F0C82CEB000219DDF /* init.tcl in Resources */,
+				6E270BE10E1458DE00BAE687 /* init.tcl.original in Resources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -533,8 +537,7 @@
 		489DD8F80C94366000595506 /* Release */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
-				ARCHS = "$(ARCHS_STANDARD_32_BIT_PRE_XCODE_3_1)";
-				ARCHS_STANDARD_32_BIT_PRE_XCODE_3_1 = "ppc i386";
+				ARCHS = "$(NATIVE_ARCH)";
 				COPY_PHASE_STRIP = YES;
 				FRAMEWORK_SEARCH_PATHS = (
 					"$(value)",

Modified: branches/gsoc08-framework/MacPorts.Framework/dummycommit.test
===================================================================
--- branches/gsoc08-framework/MacPorts.Framework/dummycommit.test	2008-06-26 22:10:50 UTC (rev 37864)
+++ branches/gsoc08-framework/MacPorts.Framework/dummycommit.test	2008-06-26 23:54:01 UTC (rev 37865)
@@ -1,23 +1,3 @@
-I have modified this file
-Now I should do another commit to make sure my
-modifications are ok.
 
-George.
 
-//NSString * initFile = [[NSBundle bundleWithIdentifier:@"org.macports.frameworks.macports"]
-		//					   pathForResource:@"init" 
-		//					   ofType:@"tcl"];
-		NSBundle * tbun = [NSBundle bundleWithIdentifier:@"org.macports.frameworks.macports"];
-		if(tbun) {
-			NSLog(@"File found with path %@", [[NSBundle bundleForClass:[MPInterpreter class]] bundlePath]);
-		}
-		else{
-			NSLog(@"File not found with path %@", [[NSBundle bundleForClass:[MPInterpreter class]] bundlePath]);
-		}
-		
-		if( Tcl_EvalFile(_interpreter, [[tbun pathForResource:@"init"
-													   ofType:@"tcl"] UTF8String]) != TCL_OK) {
-			NSLog(@"Error in Tcl_EvalFile: %s", Tcl_GetStringResult(_interpreter));
-			Tcl_DeleteInterp(_interpreter);
-		}
-		
\ No newline at end of file
+

Modified: branches/gsoc08-framework/MacPorts.Framework/init.tcl
===================================================================
--- branches/gsoc08-framework/MacPorts.Framework/init.tcl	2008-06-26 22:10:50 UTC (rev 37864)
+++ branches/gsoc08-framework/MacPorts.Framework/init.tcl	2008-06-26 23:54:01 UTC (rev 37865)
@@ -1,7 +1,13 @@
+#catch {source \
+#	[file join "/Library/Tcl" macports1.0 macports_fastload.tcl]}
+
+#Trying my own MacPorts build rather than default one on the system
 catch {source \
-	[file join "/Library/Tcl" macports1.0 macports_fastload.tcl]}
-	
+	[file join "/Users/Armahg/macportsbuild/build1/Library/Tcl" macports1.0 macports_fastload.tcl]}
+
+
 package require macports
+package require notifications
 
 # ui_options accessor
 proc ui_isset {val} {
@@ -66,6 +72,64 @@
 }
 
 
+#Modifying UI initialization to enable notifications
+proc ui_init {priority prefix channels message} {
+    # Get the list of channels.
+    try {
+        set channels [ui_channels $priority]
+    } catch * {
+        set channels [ui_channels_default $priority]
+    }
+
+    # Simplify ui_$priority.
+    set nbchans [llength $channels]
+    if {$nbchans == 0} {
+        proc ::ui_$priority {str} {
+		notifications send global testMacPortstNotification "$prefix\$str"
+		}
+    } else {
+        try {
+            set prefix [ui_prefix $priority]
+        } catch * {
+            set prefix [ui_prefix_default $priority]
+        }
+            
+		if {$nbchans == 1} {
+                set chan [lindex $channels 0]
+				
+				#Redefine ui_$priority here to also throw notifications of some sort
+				proc ::ui_$priority {str} {
+					#[subst { puts $chan "$prefix\$str" }]
+					subst { puts $chan "$prefix\$str" }
+
+					#Send notifications using NSDistributedNotificationCenter for now
+					#We need a way to name notifications based on given input, using
+					#testMacPortsNotification for now
+					notifications send global testMacPortstNotification "$prefix\$str"
+				}
+				
+				
+            } else {
+			
+			
+                proc ::ui_$priority {str} {
+					subst {
+						foreach chan \$channels {
+							puts $chan "$prefix\$str"
+						}
+					}
+					#Should we discriminate based on channel?
+					notifications send global testMacPortsNotification "$prefix\$str"
+				}
+            }
+			
+        # Call ui_$priority
+        ::ui_$priority $message
+    }
+}
+
+
+
 # Initialize dport
 # This must be done following parse of global options, as some options are
 # evaluated by dportinit.
@@ -73,6 +137,4 @@
 	global errorInfo
 	puts "$errorInfo"
 	fatal "Failed to initialize ports system, $result"
-}
-
-
+}
\ No newline at end of file
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-changes/attachments/20080626/642e3250/attachment-0001.htm 


More information about the macports-changes mailing list