diff --git a/GNUmakefile b/GNUmakefile index bf7c13528..af8be3570 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -10,7 +10,6 @@ SUBPROJECTS = \ SoObjects \ Main \ UI \ - Tools \ - Bundles/Sample + Tools include $(GNUSTEP_MAKEFILES)/aggregate.make diff --git a/Main/GNUmakefile b/Main/GNUmakefile index 329d12909..382776728 100644 --- a/Main/GNUmakefile +++ b/Main/GNUmakefile @@ -4,10 +4,9 @@ include ../config.make include $(GNUSTEP_MAKEFILES)/common.make include ../Version -ADDITIONAL_INCLUDE_DIRS += -I/usr/include/python2.6/ +ADDITIONAL_INCLUDE_DIRS += ADDITIONAL_LIB_DIRS += -L../SOPE/GDLContentStore/obj/ ADDITIONAL_LDFLAGS += -Wl,--no-as-needed -ADDITIONAL_LDFLAGS += -lpython2.6 SOGOD = sogod TOOL_NAME = $(SOGOD) diff --git a/Main/SOGo.h b/Main/SOGo.h index 25c3f878d..02bce3c4c 100644 --- a/Main/SOGo.h +++ b/Main/SOGo.h @@ -33,7 +33,6 @@ @interface SOGo : SoApplication { - NSMutableArray *bundles; SOGoCache *cache; } diff --git a/Main/SOGo.m b/Main/SOGo.m index 658c2fd86..7b0bf80aa 100644 --- a/Main/SOGo.m +++ b/Main/SOGo.m @@ -25,8 +25,6 @@ #import #import #import -#import -#import #import #import #import @@ -67,8 +65,6 @@ #import #import -#include - #import "NSException+Stacktrace.h" #import "SOGo.h" @@ -151,116 +147,6 @@ static BOOL debugLeaks; [[SOGoProductLoader productLoader] loadAllProducts]; } -- (void) _loadBundles -{ - NSFileManager *aFileManager; - NSMutableArray *allPaths; - NSArray *allFiles; - NSString *aPath; - int i, j; - - bundles = [[NSMutableArray alloc] init]; - - aFileManager = [NSFileManager defaultManager]; - allPaths = [[NSMutableArray alloc] initWithArray: NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, - NSLocalDomainMask| - NSNetworkDomainMask| - NSSystemDomainMask| - NSUserDomainMask, - YES)]; - for (i = 0; i < [allPaths count]; i++) - { - // We remove any potential duplicate paths in our allPaths array. - [allPaths removeObject: [allPaths objectAtIndex: i] inRange: NSMakeRange(i+1, [allPaths count]-i-1)]; - - aPath = [NSString stringWithFormat: @"%@/SOGo", [allPaths objectAtIndex: i]]; - allFiles = [aFileManager directoryContentsAtPath: aPath]; - - for (j = 0; j < [allFiles count]; j++) - { - NSString *aString; - - aString = [allFiles objectAtIndex: j]; - - // If we found a bundle, let's load it! - if ([[aString pathExtension] isEqualToString: @"bundle"]) - { - NSBundle *aBundle; - NSString *path; - - path = [NSString stringWithFormat: @"%@/%@", aPath, aString]; - aBundle = [NSBundle bundleWithPath: path]; - - if (aBundle) - { - PyObject *pName, *pModule; - NSString *ppath; - - NSLog(@"Loaded bundle at path %@ successfully...", path); - - // We add that path to the PYTHONPATH environment - ppath = [NSString stringWithFormat: @"%@/Resources/:%s", path, getenv("PYTHONPATH")]; - NSLog(@"Setting environment to %@", ppath); - setenv("PYTHONPATH", [ppath UTF8String], 1); - NSLog(@"New environment: %s", getenv("PYTHONPATH")); - - Py_Initialize(); - pName = PyString_FromString("main"); - - if (pName) - { - NSLog(@"Trying to initialize module..."); - pModule = PyImport_Import(pName); - Py_DECREF(pName); - - if (pModule != NULL) - { - id aModule; - Class c; - int len; - - NSLog(@"Loaded main Python file at path %@", path); - - len = [aString length]; - - c = NSClassFromString([aString substringToIndex: (len-7)]); - aModule = [c new]; - - if (aModule) - { - [bundles addObject: aModule]; - RELEASE(aModule); - - NSLog(@"Successfully instanciated Sample"); - - if ([aModule respondsToSelector: @selector(userWasCreated:atDate:)]) - { - [aModule userWasCreated: @"foo" atDate: @"bar"]; - } - } - else - { - NSLog(@"Failed to instanciate Sample"); - } - } - else - { - NSLog(@"Failed to load module."); - } - } - else - { - NSLog(@"Failed to load module. You MUST have main.py in your SOGo Python bundle."); - } - } - } - } - } -} - -// -// -// - (id) init { if ((self = [super init])) @@ -271,9 +157,6 @@ static BOOL debugLeaks; rm = [[WEResourceManager alloc] init]; [self setResourceManager:rm]; [rm release]; - - /* load all bundles */ - [self _loadBundles]; } return self;