فهرست منبع

Fix "%typemap(out) char **"
Generalise build rules
List my_typemaps.i and renames.i as dependencies for %_wrap.c
Discard output when running test.py to byte-compile modules


git-svn-id: https://svn.osgeo.org/grass/grass/trunk@33927 15284696-431f-4ddb-bdfa-cd5b030d7da7

Glynn Clements 16 سال پیش
والد
کامیت
5524bcabcb
3فایلهای تغییر یافته به همراه7 افزوده شده و 7 حذف شده
  1. 5 5
      swig/python/Makefile
  2. 1 1
      swig/python/NumPtr/Makefile
  3. 1 1
      swig/python/my_typemaps.i

+ 5 - 5
swig/python/Makefile

@@ -14,16 +14,16 @@ CLEAN_SUBDIRS = NumPtr
 
 default: _$(LIB_NAME).so numptr
 
-$(LIB_NAME)_wrap.c: $(LIB_NAME).i
+%_wrap.c: %.i my_typemaps.i renames.i
 	$(SWIG) $(ARCH_INC) -python -shadow $<
 
-$(LIB_NAME)_wrap.o: $(LIB_NAME)_wrap.c
+%_wrap.o: %_wrap.c
 	$(CC) $(CFLAGS) $(INCLUDE_DIRS) $<
 
-_$(LIB_NAME).so: $(LIB_NAME)_wrap.o
-	$(LD) $(LDFLAGS) $< -o _$(LIB_NAME).so
+_%.so: %_wrap.o
+	$(LD) $(LDFLAGS) $< -o $@
 	# build bytecode .pyc file; ignore undefined symbol error
-	echo "import $(LIB_NAME)" | python; true
+	echo "import $*" | python; true
 
 numptr:
 	$(MAKE) -C NumPtr

+ 1 - 1
swig/python/NumPtr/Makefile

@@ -5,7 +5,7 @@ all: numptr
 numptr:
 	python setup.py build --build-lib build/lib
 	# build bytecode .pyc file
-	python build/lib/test.py
+	python build/lib/test.py >& /dev/null
 
 clean:
 	-rm -rf build/

+ 1 - 1
swig/python/my_typemaps.i

@@ -33,7 +33,7 @@ typedef char * string_allows_none;
 		for(i=0;i<len;i++) {
 			stringobject=PyString_FromString($1[i]);
 			if(!stringobject) return NULL;
-			PyList_SetItem($1,i,stringobject);
+			PyList_SetItem($result,i,stringobject);
 		}
 //		G_free_list($1);
 	}