summaryrefslogtreecommitdiff
path: root/contrib/python
diff options
context:
space:
mode:
authorW. Trevor King <wking@tremily.us>2018-05-21 11:23:00 -0700
committerW. Trevor King <wking@tremily.us>2018-09-13 22:15:22 -0700
commit356765aa959626d0d027484b2797958c24fe3c15 (patch)
treeee75314dd883a26213bb306b19e18a766f4f0c0f /contrib/python
parentaf6d86dcdf5fbe3b7e2e673c9ae4ce80fb603a1b (diff)
downloadpodman-356765aa959626d0d027484b2797958c24fe3c15.tar.gz
podman-356765aa959626d0d027484b2797958c24fe3c15.tar.bz2
podman-356765aa959626d0d027484b2797958c24fe3c15.zip
contrib/python/*/Makefile: Fallback to unversioned 'python'
And pull these from the PATH by default. This way systems like CentOS that don't have a python3 can still execute 'make clean', which doesn't care about the Python major version. The setup.py shebang, mode change, and ./ prefixing helps address cases where PYTHON is empty. This could be the result of improper user configuration: $ make PYTHON='' clean It could also be the state on systems with no Python installed, in which case you'll see: $ make PYTHON='' clean ./setup.py clean --all /usr/bin/env: 'python': No such file or directory make: *** [Makefile:13: clean] Error 127 I've also shifted the Python invocations to the end of the clean recipies so that as much as possible gets cleaned up even on systems without Python installed. Signed-off-by: W. Trevor King <wking@tremily.us>
Diffstat (limited to 'contrib/python')
-rw-r--r--contrib/python/podman/Makefile4
-rwxr-xr-x[-rw-r--r--]contrib/python/podman/setup.py2
-rw-r--r--contrib/python/pypodman/Makefile4
-rwxr-xr-x[-rw-r--r--]contrib/python/pypodman/setup.py2
4 files changed, 8 insertions, 4 deletions
diff --git a/contrib/python/podman/Makefile b/contrib/python/podman/Makefile
index e7e365a9c..64239755f 100644
--- a/contrib/python/podman/Makefile
+++ b/contrib/python/podman/Makefile
@@ -1,4 +1,4 @@
-PYTHON ?= /usr/bin/python3
+PYTHON ?= $(shell command -v python3 2>/dev/null || command -v python)
DESTDIR ?= /
.PHONY: python-podman
@@ -26,7 +26,7 @@ uninstall:
.PHONY: clean
clean:
- $(PYTHON) setup.py clean --all
rm -rf podman.egg-info dist
find . -depth -name __pycache__ -exec rm -rf {} \;
find . -depth -name \*.pyc -exec rm -f {} \;
+ $(PYTHON) ./setup.py clean --all
diff --git a/contrib/python/podman/setup.py b/contrib/python/podman/setup.py
index 2953ba0dc..9d54bb3ac 100644..100755
--- a/contrib/python/podman/setup.py
+++ b/contrib/python/podman/setup.py
@@ -1,3 +1,5 @@
+#!/usr/bin/env python
+
import os
from setuptools import find_packages, setup
diff --git a/contrib/python/pypodman/Makefile b/contrib/python/pypodman/Makefile
index fb25776fa..430231202 100644
--- a/contrib/python/pypodman/Makefile
+++ b/contrib/python/pypodman/Makefile
@@ -1,4 +1,4 @@
-PYTHON ?= /usr/bin/python3
+PYTHON ?= $(shell command -v python3 2>/dev/null || command -v python)
DESTDIR := /
.PHONY: python-pypodman
@@ -25,7 +25,7 @@ clobber: uninstall clean
.PHONY: clean
clean:
- $(PYTHON) setup.py clean --all
rm -rf pypodman.egg-info dist
find . -depth -name __pycache__ -exec rm -rf {} \;
find . -depth -name \*.pyc -exec rm -f {} \;
+ $(PYTHON) ./setup.py clean --all
diff --git a/contrib/python/pypodman/setup.py b/contrib/python/pypodman/setup.py
index 0f80d4060..f07e89201 100644..100755
--- a/contrib/python/pypodman/setup.py
+++ b/contrib/python/pypodman/setup.py
@@ -1,3 +1,5 @@
+#!/usr/bin/env python
+
import os
from setuptools import find_packages, setup