On Tue, 17 Oct 2023 at 12:30, Bartosz Golaszewski <brgl@xxxxxxxx> wrote: > > On Mon, Oct 16, 2023 at 5:18 PM Phil Howard <phil@xxxxxxxxxxxxx> wrote: > > > > Optionally vendor libgpiod source into sdist so that the > > Python module can be built from source, even with a missing > > or mismatched system libgpiod. > > > > Add optional environment variable "LINK_SYSTEM_LIBGPIOD=1" > > so that the sdist package can optionally be built and > > linked against a compatible system libgpiod. > > > > eg: LINK_SYSTEM_LIBGPIOD=1 pip install libgpiod > > > > Update build to add an additional sdist target for upload > > to pypi. Call setup.py with "GPIOD_VERSION_STR" set, which > > triggers a vendored package build. "GPIOD_VERSION_STR" is > > saved to "gpiod-version-str.txt" and included in the sdist > > for standalone builds. > > > > "GPIOD_VERSION_STR" must be specified in order to produce > > a standalone buildable sdist package, this requirement > > implicitly preserves the old build behaviour. > > > > Signed-off-by: Phil Howard <phil@xxxxxxxxxxxxx> > > --- > > bindings/python/MANIFEST.in | 5 ++ > > bindings/python/Makefile.am | 3 + > > bindings/python/setup.py | 122 +++++++++++++++++++++++++++++++----- > > 3 files changed, 114 insertions(+), 16 deletions(-) > > > > diff --git a/bindings/python/MANIFEST.in b/bindings/python/MANIFEST.in > > index c7124d4..acf9391 100644 > > --- a/bindings/python/MANIFEST.in > > +++ b/bindings/python/MANIFEST.in > > @@ -2,6 +2,7 @@ > > # SPDX-FileCopyrightText: 2023 Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxx> > > > > include setup.py > > +include gpiod-version-str.txt > > > > recursive-include gpiod *.py > > recursive-include tests *.py > > @@ -11,3 +12,7 @@ recursive-include gpiod/ext *.h > > > > recursive-include tests/gpiosim *.c > > recursive-include tests/procname *.c > > + > > +recursive-include lib *.c > > +recursive-include lib *.h > > +recursive-include include *.h > > diff --git a/bindings/python/Makefile.am b/bindings/python/Makefile.am > > index 079ceb1..7fadf52 100644 > > --- a/bindings/python/Makefile.am > > +++ b/bindings/python/Makefile.am > > @@ -16,6 +16,9 @@ all-local: > > $(PYTHON) setup.py build_ext --inplace \ > > --include-dirs=$(top_srcdir)/include/:$(top_srcdir)/tests/gpiosim/ \ > > --library-dirs=$(top_builddir)/lib/.libs/:$(top_srcdir)/tests/gpiosim/.libs/ > > + GPIOD_VERSION_STR=$(VERSION_STR) \ > > I suppose I can remove this line now? This is right before a separate invocation of the build, which might want to be split into another Makefile target for clarity. This is required to build an sdist package which includes a valid "gpiod-version-str.txt" and can be built standalone, but doesn't change the original "build_ext" call. > > Bart > > [snip]