bug in Library creation,

still a problem in Python object management
This commit is contained in:
Christophe Alexandre 2008-04-23 14:37:45 +00:00
parent ebe8b9bb13
commit a2d9ab4087
4 changed files with 6 additions and 79 deletions

View File

@ -35,3 +35,4 @@ SET_TARGET_PROPERTIES(Hurricane
TARGET_LINK_LIBRARIES(Hurricane isobar hurricane ${PYTHON_LIBRARIES})
INSTALL(TARGETS isobar DESTINATION /lib)
INSTALL(TARGETS Hurricane DESTINATION /lib/python)

View File

@ -1,5 +0,0 @@
src_dir=${HURRICANE_SOURCE_DIR}/src/pyext
build_dir=${HURRICANE_BINARY_DIR}/src/pyext
sources=@sources@
include_dirs=@include_dirs@
library_dirs=@library_dirs@

View File

@ -66,14 +66,14 @@ using namespace Hurricane;
extern "C" {
# define METHOD_HEAD(function) GENERIC_METHOD_HEAD(Library,lib,function)
#define METHOD_HEAD(function) GENERIC_METHOD_HEAD(Library,lib,function)
// x=================================================================x
// | "PyLibrary" Python Module Code Part |
// x=================================================================x
# if defined(__PYTHON_MODULE__)
#if defined(__PYTHON_MODULE__)
// x-------------------------------------------------------------x
@ -180,7 +180,7 @@ extern "C" {
DataBase* db = PYDATABASE_O(arg0);
library = Library::create(db, *PYNAME_O(arg1));
HCATCH
} else if (ParseTwoArg("Library.new", args, ":db:name", &arg0, &arg1)) {
} else if (ParseTwoArg("Library.new", args, ":library:name", &arg0, &arg1)) {
HTRY
Library* masterLibrary = PYLIBRARY_O(arg0);
library = Library::create(masterLibrary, *PYNAME_O(arg1));
@ -197,7 +197,7 @@ extern "C" {
PyTypeObjectConstructor(Library)
# else // End of Python Module Code Part.
#else // End of Python Module Code Part.
// x=================================================================x
@ -217,7 +217,7 @@ extern "C" {
PyTypeRootObjectDefinitions(Library)
# endif // End of Shared Library Code Part.
#endif // End of Shared Library Code Part.
} // End of extern "C".

View File

@ -1,69 +0,0 @@
import sys
class BuildConfigurationFileReader:
def __init__(self):
src_dir=""
self.sources = ""
self.include_dirs = ""
self.library_dirs = ""
def load(self):
f = open("PyExtensionBuild.conf")
try:
for line in f:
if (line == "\n"):
continue
args = line.split("=", 1)
if (len(args) > 0):
if (len(args) != 2):
print "Error in configuration file"
print args
sys.exit(55)
if (args[0]=="src_dir"):
self.src_dir = args[1].strip("\n")
if (args[0]=="sources"):
self.sources = args[1].strip("\n").split(";")
self.sources = map(lambda s : self.src_dir + "/" + s, self.sources)
elif (args[0]=="include_dirs"):
self.include_dirs=[args[1].strip("\n")]
print self.include_dirs
elif (args[0]=="library_dirs"):
self.library_dirs=args[1].strip("\n").split(":")
finally:
f.close()
if (len(self.sources)==0 or len(self.include_dirs)==0 or len(self.library_dirs)==0):
print "Error in configuration file"
print self.sources
print self.include_dirs
print self.library_dirs
sys.exit(55)
class PyBuilder:
def __init__(self, sources, library_dirs, include_dirs):
self.sources = sources
self.libraryDirs = library_dirs
self.libraries = ['isobar', 'hurricane']
self.includeDirs = include_dirs
def build(self, build=False):
from distutils.core import setup, Extension
hurricane = Extension('Hurricane',
include_dirs=self.includeDirs,
libraries=self.libraries,
library_dirs=self.libraryDirs,
sources=self.sources,
define_macros=[('__PYTHON_MODULE__', '1')])
build = ('build' in sys.argv)
if (build):
setup(name='Hurricane',
version='2.0',
description = "Python Module for Hurricane",
author='Coriolis Team',
ext_modules=[hurricane])
if (__name__=='__main__'):
r = BuildConfigurationFileReader()
r.load()
b = PyBuilder(r.sources, r.library_dirs, r.include_dirs)
build = ('build' in sys.argv)
b.build(build)