diff --git a/ChangeLog b/ChangeLog index 7b32da39..85e8de67 100644 --- a/ChangeLog +++ b/ChangeLog @@ -22836,3 +22836,7 @@ 2021-12-23 Fred Gleason * Refactored the build of the 'python3-rivwebpyapi' deb package so as to include proper PyPI package metadata. +2021-12-23 Fred Gleason + * Added an 'AR_PYTHON_MODULE()' autoconf macro. + * Added a test for the PyPI module build chain to 'configure.ac'. + * Bumped the minimum Python version dependency from 3.4 to 3.6. diff --git a/INSTALL b/INSTALL index ccc080a9..a7f9f68a 100644 --- a/INSTALL +++ b/INSTALL @@ -50,7 +50,7 @@ OggVorbis - Open Source Audio Coding Library. Needed for OggVorbis importing and exporting. Included with most distros, or available at: http://www.xiph.org/. -Python, v3.4 or later +Python, v3.6 or later Open source scripting language. Included with most distros, or available at: https://www.python.org/. @@ -127,6 +127,9 @@ Available at http://www.underbit.com/products/mad/. TwoLAME - MPEG Layer 2 Encoder Library. Needed for MPEG Layer 2 exporting and capture. Available at http://www.twolame.org/. +Python3 'build' and 'twine' modules. Needed to build DEB packages using +the 'make deb' target. Available from the Python Packaging Index (PyPI). + DOCUMENTATION ------------- diff --git a/acinclude.m4 b/acinclude.m4 index 8aa8ae48..cf12e230 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -2,7 +2,7 @@ # # Local Autoconf macro definitions # -# (C) Copyright 2006-2019 Fred Gleason +# (C) Copyright 2006-2021 Fred Gleason # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 as @@ -63,6 +63,38 @@ AC_DEFUN([AR_GET_DISTRO],[] ] ) +# +# AR_PYTHON_MODULE(modname,[ACTION-IF-DETECTED],[ACTION-IF-NOT-DETECTED]) +# +# Check for the existence of the {modname} python3 module. +# +# On successful detection, ACTION-IF-DETECTED is executed if present. If +# the detection fails, then ACTION-IF-NOT-DETECTED is triggered. +# +# Based on code from the AX_PYTHON_MODULE() macro by Andrew Collier. +# +# Copyright (c) 2008 Andrew Collier +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. +# +AC_DEFUN([AR_PYTHON_MODULE],[ + PYTHON="python3" + PYTHON_NAME=`basename $PYTHON` + AC_MSG_CHECKING($PYTHON_NAME module: $1) + $PYTHON -c "import $1" 2>/dev/null + if test $? -eq 0; + then + AC_MSG_RESULT(yes) + $2 + else + AC_MSG_RESULT(no) + $3 + fi +]) + # =========================================================================== # https://www.gnu.org/software/autoconf-archive/ax_count_cpus.html # =========================================================================== diff --git a/apis/rivwebpyapi/Makefile.am b/apis/rivwebpyapi/Makefile.am index 7c1ac357..01e28ce6 100644 --- a/apis/rivwebpyapi/Makefile.am +++ b/apis/rivwebpyapi/Makefile.am @@ -23,7 +23,7 @@ SUBDIRS = api\ tests -all: pypi +all: @PYPI@ pypi: rm -rf pypi diff --git a/configure.ac b/configure.ac index 6f560bf9..73fba4d9 100644 --- a/configure.ac +++ b/configure.ac @@ -340,6 +340,22 @@ else AC_ARG_VAR(pyexecdir,[the Python extension modules directory]) fi +# +# Check for PyPI Module Build Chain +# +AR_PYTHON_MODULE([build],[BUILD_FOUND=yes],[]) +AR_PYTHON_MODULE([twine],[TWINE_FOUND=yes],[]) +if test $BUILD_FOUND ; then + if test $TWINE_FOUND ; then + PYPI_FOUND=yes + AC_SUBST(PYPI,pypi) + else + AC_SUBST(PYPI,"") + fi +else + AC_SUBST(PYPI,"") +fi + # # Check for FLAC # @@ -718,6 +734,11 @@ AC_MSG_NOTICE("| Update I18N Data ... Yes |") else AC_MSG_NOTICE("| Update I18N Data ... No |") fi +if test $PYPI_FOUND ; then +AC_MSG_NOTICE("| PyPI Module Build Chain Detected ... Yes |") +else +AC_MSG_NOTICE("| PyPI Module Build Chain Detected ... No |") +fi AC_MSG_NOTICE("| |") AC_MSG_NOTICE("| Configured Audio Drivers: |") if test -z $USING_ALSA ; then