diff --git a/debian/python-saithrift.install b/debian/python-saithrift.install index b98491588..2823a1da2 100644 --- a/debian/python-saithrift.install +++ b/debian/python-saithrift.install @@ -1 +1,2 @@ -debian/usr/local/lib/python2.7/site-packages/* /usr/lib/python2.7/dist-packages/ +#compatiable with bookworm python 3.11 environment and build with python3 +debian/usr/local/local/lib/python3*/dist-packages/* /usr/lib/python3/dist-packages/ diff --git a/test/saithriftv2/Makefile b/test/saithriftv2/Makefile index 7cd624bc5..3f4afe3b8 100644 --- a/test/saithriftv2/Makefile +++ b/test/saithriftv2/Makefile @@ -38,7 +38,10 @@ CTYPESGEN = /usr/local/bin/ctypesgen.py endif ifeq ($(platform),vs) -LIBS = -lthrift -lpthread -lsaivs -lsaimeta -lsaimetadata -lzmq +LIBS = -lthrift -lpthread -lsaivs -lsaimeta -lsaimetadata -lzmq -lswsscommon +else ifeq ($(platform),vpp) +LIBS = -lthrift -lpthread -lsaivs -lsaimeta -lsaimetadata -lzmq \ + -lvlib -lvlibapi -lvppapiclient -lvlibmemoryclient -lvppinfra -lswsscommon else LIBS = -lthrift -lpthread -lsai -lsaimetadata endif @@ -74,18 +77,23 @@ $(METADIR)sai.thrift: # rm gen-cpp/gen-py is needed since thrift don't override existing files # even if sai.thrift file changed :( -$(CPP_SOURCES): $(METADIR)sai.thrift +gen-cpp/sai_rpc.cpp: $(METADIR)sai.thrift rm -rf gen-cpp $(THRIFT) -o ./ --gen cpp -r $^ -$(PY_SOURCES): $(METADIR)sai.thrift +$(filter-out gen-cpp/sai_rpc.cpp, $(CPP_SOURCES)): gen-cpp/sai_rpc.cpp + +gen-py/sai/sai_rpc.py: $(METADIR)sai.thrift rm -rf gen-py $(THRIFT) -o ./ --gen py -r $^ $(INSTALL) -vCD $(METADIR)sai_adapter.py gen-py/sai/sai_adapter.py +$(filter-out gen-py/sai/sai_rpc.py, $(PY_SOURCES)): gen-py/sai/sai_rpc.py + # TODO should depend on ../../inc/sai*.h ../../experimental/sai*.h and not /usr/include/sai/sai*.h $(SAI_PY_HEADERS): $(SAI_HEADERS) + mkdir -p gen-py/sai $(CTYPESGEN) --output-language=py32 -I/usr/include -I$(SAI_HEADER_DIR) -I../../experimental -I../../custom --include /usr/include/linux/limits.h $^ -o $@ python3 convert_header.py -i $(SAI_PY_HEADERS) -o ./new_header.py mv $(SAI_PY_HEADERS) ./sai_headers.py.bk @@ -97,7 +105,7 @@ $(METADIR)saimetadata.h: $(ODIR)/%.o: gen-cpp/%.cpp $(CXX) $(CPPFLAGS) -c $< -o $@ -$(ODIR)/sai_rpc_server.o: $(METADIR)sai_rpc_frontend.cpp $(METADIR)saimetadata.h +$(ODIR)/sai_rpc_server.o: $(METADIR)sai_rpc_frontend.cpp $(METADIR)saimetadata.h $(CPP_SOURCES) $(CXX) $(CPPFLAGS) -c $(METADIR)sai_rpc_frontend.cpp -o $@ -I$(METADIR) -I./gen-cpp -I../../inc -I../../experimental -I../../custom $(ODIR)/saiserver.o: src/saiserver.cpp src/switch_sai_rpc_server.h $(CPP_SOURCES) diff --git a/test/saithriftv2/convert_header.py b/test/saithriftv2/convert_header.py index 2c5a958cf..9c08aac34 100644 --- a/test/saithriftv2/convert_header.py +++ b/test/saithriftv2/convert_header.py @@ -47,7 +47,7 @@ class sai_common_api(SAIEnum): import enum class SAIEnum(enum.IntEnum): def __str__(self): - return super().__str__().split(\".\")[1]\n""" + return self.name\n""" ENUM_PREFIX = "enum__sai_" SAI_NAME = "SAI" ENUM_TYPE = "= c_int"