make the package a package

This commit is contained in:
saces 2026-02-10 00:08:30 +01:00
parent 914faa6596
commit aed1337137
7 changed files with 58 additions and 1 deletions

8
pygomx-module/.gitignore vendored Normal file
View file

@ -0,0 +1,8 @@
dist/
build/
*.egg-info
*.so
*.h
*.c
*.o
*.a

View file

@ -0,0 +1 @@
include *.so

26
pygomx-module/Makefile Normal file
View file

@ -0,0 +1,26 @@
SOURCE_GO=$(shell find ../libmxclient/ -iname "*.go")
.PHONY:
all: _pygomx.o libmxclient.h
mkdir -p build/lib
cp *.so build/lib
_pygomx.o: libmxclient.h build_ffi.py
python3 build_ffi.py
libmxclient.h: ../libmxclient/go.mod ../libmxclient/go.sum $(SOURCE_GO)
cd ../libmxclient/ && \
CGO_ENABLED=1 go build -buildmode=c-archive -o ../pygomx-module/libmxclient.a .
.PHONY:
clean:
-rm _pygomx.*
-rm libmxclient.*
-rm -r dist/
-rm -r build/
-rm -r pygomx_module.egg-info
.PHONY:
install: all
python setup.py bdist_wheel
python setup.py install

14
pygomx-module/README.txt Normal file
View file

@ -0,0 +1,14 @@
pygomx-module
=============
python package with the pygomx binaries
build wheel:
make
python setup.py bdist_wheel
install:
python setup.py install

View file

@ -8,7 +8,9 @@ ffibuilder.set_source(
source=""" //passed to the real C compiler
#include "libmxclient.h"
""",
libraries=["mxclient"],
libraries=["mxclient", "olm"],
library_dirs=["."],
include_dirs=["."],
)
ffibuilder.cdef(

View file

@ -0,0 +1,3 @@
cffi
setuptools>=80
wheel

3
pygomx-module/setup.py Normal file
View file

@ -0,0 +1,3 @@
from setuptools import setup
setup(name="pygomx-module", version="0.0.1", py_modules=["_pygomx"])