diff mbox series

[2/2] support/dependencies/dependencies.sh: check for Python argparse module

Message ID 20180303143620.16859-2-thomas.petazzoni@bootlin.com
State Accepted
Commit 8cde7e6af9193545819c05369b87c8a61b2a61fb
Headers show
Series None | expand

Commit Message

Thomas Petazzoni March 3, 2018, 2:36 p.m. UTC
The script support/scripts/check-uniq-files uses the argparse Python
module. In most recent Python versions (starting with 2.7), the
argparse module is part of the standard library, and we already check
for the availability of Python in
support/dependencies/dependencies.sh.

However, when running on an ancient distribution with Python 2.6, the
argparse module is not part of the Python standard library, but
available as an external module. Without this module, the build fails,
because check-uniq-files, which is used in target-finalize, fails to
run.

To avoid this failure, this commit adds a check in
support/dependencies/dependencies.sh to verify that the argparse
module is available.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
 support/dependencies/dependencies.sh | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Yann E. MORIN March 3, 2018, 4:07 p.m. UTC | #1
Thomas, All,

On 2018-03-03 15:36 +0100, Thomas Petazzoni spake thusly:
> The script support/scripts/check-uniq-files uses the argparse Python
> module. In most recent Python versions (starting with 2.7), the
> argparse module is part of the standard library, and we already check
> for the availability of Python in
> support/dependencies/dependencies.sh.
> 
> However, when running on an ancient distribution with Python 2.6, the
> argparse module is not part of the Python standard library, but
> available as an external module. Without this module, the build fails,
> because check-uniq-files, which is used in target-finalize, fails to
> run.
> 
> To avoid this failure, this commit adds a check in
> support/dependencies/dependencies.sh to verify that the argparse
> module is available.
> 
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>

Acked-by: "Yann E. MORIN" <yann.morin.1998@free.fr>

Regards,
Yann E. MORIN.

> ---
>  support/dependencies/dependencies.sh | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/support/dependencies/dependencies.sh b/support/dependencies/dependencies.sh
> index 1804e85508..423fed8110 100755
> --- a/support/dependencies/dependencies.sh
> +++ b/support/dependencies/dependencies.sh
> @@ -288,3 +288,8 @@ if [ -n "$missing_perl_modules" ] ; then
>  	echo
>  	exit 1
>  fi
> +
> +if ! python -c "import argparse" > /dev/null 2>&1 ; then
> +	echo "Your Python installation is not complete enough: argparse module is missing"
> +	exit 1
> +fi
> -- 
> 2.14.3
>
Peter Korsgaard March 3, 2018, 4:19 p.m. UTC | #2
>>>>> "Thomas" == Thomas Petazzoni <thomas.petazzoni@bootlin.com> writes:

 > The script support/scripts/check-uniq-files uses the argparse Python
 > module. In most recent Python versions (starting with 2.7), the
 > argparse module is part of the standard library, and we already check
 > for the availability of Python in
 > support/dependencies/dependencies.sh.

 > However, when running on an ancient distribution with Python 2.6, the
 > argparse module is not part of the Python standard library, but
 > available as an external module. Without this module, the build fails,
 > because check-uniq-files, which is used in target-finalize, fails to
 > run.

 > To avoid this failure, this commit adds a check in
 > support/dependencies/dependencies.sh to verify that the argparse
 > module is available.

 > Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>

Committed, thanks.
diff mbox series

Patch

diff --git a/support/dependencies/dependencies.sh b/support/dependencies/dependencies.sh
index 1804e85508..423fed8110 100755
--- a/support/dependencies/dependencies.sh
+++ b/support/dependencies/dependencies.sh
@@ -288,3 +288,8 @@  if [ -n "$missing_perl_modules" ] ; then
 	echo
 	exit 1
 fi
+
+if ! python -c "import argparse" > /dev/null 2>&1 ; then
+	echo "Your Python installation is not complete enough: argparse module is missing"
+	exit 1
+fi