[48606] users/toby/objcports
toby at macports.org
toby at macports.org
Wed Mar 25 23:09:26 PDT 2009
Revision: 48606
http://trac.macports.org/changeset/48606
Author: toby at macports.org
Date: 2009-03-25 23:09:25 -0700 (Wed, 25 Mar 2009)
Log Message:
-----------
distinguish between variables that can merely be set, and variables that we can append/delete to/from
Modified Paths:
--------------
users/toby/objcports/MPParser.m
users/toby/objcports/MPPort.h
users/toby/objcports/MPPort.m
users/toby/objcports/variables.plist
Modified: users/toby/objcports/MPParser.m
===================================================================
--- users/toby/objcports/MPParser.m 2009-03-26 06:01:45 UTC (rev 48605)
+++ users/toby/objcports/MPParser.m 2009-03-26 06:09:25 UTC (rev 48606)
@@ -35,8 +35,10 @@
command_create(_interp, [[@"post-" stringByAppendingString:target] UTF8String], self);
}
- for (NSString *opt in [_port options]) {
+ for (NSString *opt in [_port settableVariables]) {
command_create(_interp, [opt UTF8String], self);
+ }
+ for (NSString *opt in [_port modifiableVariables]) {
command_create(_interp, [[opt stringByAppendingString:@"-append"] UTF8String], self);
command_create(_interp, [[opt stringByAppendingString:@"-delete"] UTF8String], self);
}
@@ -134,11 +136,11 @@
// XXX: store for later use...
} else {
if ([command hasSuffix:@"-append"]) {
- [_port option:[command substringWithRange:NSMakeRange(0, [command length] - 7)] append:args];
+ [_port variable:[command substringWithRange:NSMakeRange(0, [command length] - 7)] append:args];
} else if ([command hasSuffix:@"-delete"]) {
- [_port option:[command substringWithRange:NSMakeRange(0, [command length] - 7)] delete:args];
+ [_port variable:[command substringWithRange:NSMakeRange(0, [command length] - 7)] delete:args];
} else {
- [_port option:command set:args];
+ [_port variable:command set:args];
}
}
}
Modified: users/toby/objcports/MPPort.h
===================================================================
--- users/toby/objcports/MPPort.h 2009-03-26 06:01:45 UTC (rev 48605)
+++ users/toby/objcports/MPPort.h 2009-03-26 06:09:25 UTC (rev 48606)
@@ -22,11 +22,13 @@
- (NSArray *)variables;
- (NSString *)variable:(NSString *)name;
-- (NSArray *)options;
-- (void)option:(NSString *)option set:(NSArray *)value;
-- (void)option:(NSString *)option append:(NSArray *)value;
-- (void)option:(NSString *)option delete:(NSArray *)value;
+- (NSArray *)settableVariables;
+- (void)variable:(NSString *)var set:(NSArray *)value;
+- (NSArray *)modifiableVariables;
+- (void)variable:(NSString *)var append:(NSArray *)value;
+- (void)variable:(NSString *)var delete:(NSArray *)value;
+
- (BOOL)addPlatform:(NSArray *)platform;
- (NSArray *)platforms;
Modified: users/toby/objcports/MPPort.m
===================================================================
--- users/toby/objcports/MPPort.m 2009-03-26 06:01:45 UTC (rev 48605)
+++ users/toby/objcports/MPPort.m 2009-03-26 06:09:25 UTC (rev 48606)
@@ -112,34 +112,45 @@
return ret;
}
-- (NSArray *)options
+- (NSArray *)settableVariables
{
- NSMutableArray *options = [NSMutableArray arrayWithCapacity:0];
+ NSMutableArray *ret = [NSMutableArray arrayWithCapacity:0];
for (NSString *var in [self variables]) {
if (![[[_variableInfo objectForKey:var] objectForKey:@"Constant"] boolValue]) {
- [options addObject:var];
+ [ret addObject:var];
}
}
- return options;
+ return ret;
}
-- (void)option:(NSString *)option set:(NSArray *)value
+- (void)variable:(NSString *)var set:(NSArray *)value
{
- [_variables setObject:[value componentsJoinedByString:@" "] forKey:option];
+ [_variables setObject:[value componentsJoinedByString:@" "] forKey:var];
}
-- (void)option:(NSString *)option append:(NSArray *)value
+- (NSArray *)modifiableVariables
{
- [_variables setObject:[NSString stringWithFormat:@"%@ %@", [_variables objectForKey:option], [value componentsJoinedByString:@" "]] forKey:option];
+ NSMutableArray *ret = [NSMutableArray arrayWithCapacity:0];
+ for (NSString *var in [self variables]) {
+ if ([[[_variableInfo objectForKey:var] objectForKey:@"AppendDelete"] boolValue]) {
+ [ret addObject:var];
+ }
+ }
+ return ret;
}
-- (void)option:(NSString *)option delete:(NSArray *)value
+- (void)variable:(NSString *)var append:(NSArray *)value
{
- NSMutableArray *tmp = [[[_variables objectForKey:option] componentsSeparatedByString:@" "] mutableCopy];
+ [_variables setObject:[NSString stringWithFormat:@"%@ %@", [_variables objectForKey:var], [value componentsJoinedByString:@" "]] forKey:var];
+}
+
+- (void)variable:(NSString *)var delete:(NSArray *)value
+{
+ NSMutableArray *tmp = [[[_variables objectForKey:var] componentsSeparatedByString:@" "] mutableCopy];
for (NSString *v in value) {
[tmp removeObject:v];
}
- [_variables setObject:[tmp componentsJoinedByString:@" "] forKey:option];
+ [_variables setObject:[tmp componentsJoinedByString:@" "] forKey:var];
[tmp release];
}
Modified: users/toby/objcports/variables.plist
===================================================================
--- users/toby/objcports/variables.plist 2009-03-26 06:01:45 UTC (rev 48605)
+++ users/toby/objcports/variables.plist 2009-03-26 06:09:25 UTC (rev 48606)
@@ -36,6 +36,20 @@
<dict/>
<key>depends_lib</key>
<dict/>
+ <key>distname</key>
+ <dict/>
+ <key>worksrcdir</key>
+ <dict/>
+ <key>configure.cppflags</key>
+ <dict>
+ <key>AppendDelete</key>
+ <true/>
+ </dict>
+ <key>configure.cflags</key>
+ <dict>
+ <key>AppendDelete</key>
+ <true/>
+ </dict>
<key>os.platform</key>
<dict>
<key>Constant</key>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20090325/c217dc38/attachment.html>
More information about the macports-changes
mailing list