From 9075ab5967a3ef32683aa60ab1a55530a4b1ebb6 Mon Sep 17 00:00:00 2001 From: Akilan Date: Thu, 24 Apr 2025 15:51:47 +0100 Subject: [PATCH] added python bindings --- .gitignore | 3 +++ Bindings/python/.DS_Store | Bin 8196 -> 8196 bytes Docs/index.org | 2 +- build-python-package.sh | 11 +++++++++-- 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 1926a85..d7c04f9 100644 --- a/.gitignore +++ b/.gitignore @@ -43,6 +43,9 @@ p2prc.PublicKeyBareMetal # Ignore pem files *.pem +# ignore virtual env file +venv + # Nix and Nix flake files result result-* diff --git a/Bindings/python/.DS_Store b/Bindings/python/.DS_Store index 14f75daedf743e82a13d08ddc0e45375ba4cd72a..92cea3280fdff96cc7a82bcb0aa611ba565c8cd1 100644 GIT binary patch delta 75 zcmZp1XmQw}F2J~RvW7sRhGccMiK&5(g07i)t&T#qr5TWIXkcnuTg%BIs;qAv6rY`w eo0s1`d7pqhW6$P$0&47=*(JWQZ2l#}&I|xH+7^-k delta 71 zcmZp1XmQw}F2J~LvW7sRs#tZku7Qq%u0gGiLbbUOkZECVT3gG>A*!rz9TcCPlbe^{ aG5Mf?JY(nPhXQKsn^`1&vTPD%X9fV}!W8KM diff --git a/Docs/index.org b/Docs/index.org index 13d317f..ccd91c9 100644 --- a/Docs/index.org +++ b/Docs/index.org @@ -641,7 +641,7 @@ cd Bindings/python/export/ # list files ls # Expected output -SharedObjects/ p2prc.py +SharedObjects/ library.py requirements.txt #+end_src Above shows a generated folder which consists of a folder called diff --git a/build-python-package.sh b/build-python-package.sh index 93a11d1..8004db6 100644 --- a/build-python-package.sh +++ b/build-python-package.sh @@ -6,12 +6,19 @@ mkdir Bindings/python/export # Creating SharedObjects directory for python mkdir Bindings/python/export/SharedObjects +# Builds p2prc.h and p2prc.so file +# as apart of Go FFI to interacted +# with later on. sh build-bindings.sh +# Copy the shared object files as well to ensure +# that python can interact with the latest snapshot +# of P2PRC cp Bindings/p2prc.h Bindings/python/export/SharedObjects/ cp Bindings/p2prc.so Bindings/python/export/SharedObjects/ -cp Bindings/python/p2prc.py Bindings/python/export/ +# Copy python library and tests as export as well +cp Bindings/python/* Bindings/python/export/ echo "Output is in the Directory Bindings/python/export/" @@ -25,4 +32,4 @@ echo "Output is in the Directory Bindings/python/export/" # env GOOS=linux GOARCH=${arch} go build -buildmode=c-shared -o python/export/SharedObjects/linux-${arch}/p2prc.so # echo "GOOS=linux GOARCH=${arch} go build -buildmode=c-shared -o python/export/SharedObjects/linux-${arch}/p2prc.so" # cd .. -#done \ No newline at end of file +#done