Use $(PYTHON) instead of "python" in every Makefile

This fixes the build with "make PYTHON=python2" on systems where python
is python3.

For PYLIBVER and PYTHONLIBDIR definitions, I tested Python 2.5, 2.6, 2.7,
3.3 and 3.4.  For each of them, these commands print the expected result:

    python -c 'import sys;print("python%d.%d" % sys.version_info[0:2])'"
    python -c "from distutils.sysconfig import *;print(get_python_lib(1))"

Acked-by: Steve Lawrence <slawrence@tresys.com>
This commit is contained in:
Nicolas Iooss 2014-09-10 21:01:28 +02:00 committed by Steve Lawrence
parent 44035fcab4
commit e4d693ae87
6 changed files with 17 additions and 8 deletions

View File

@ -1,10 +1,11 @@
PYTHON ?= python
# Installation directories.
PREFIX ?= $(DESTDIR)/usr
BINDIR ?= $(PREFIX)/bin
LIBDIR ?= $(PREFIX)/lib
MANDIR ?= $(PREFIX)/share/man
LOCALEDIR ?= /usr/share/locale
PYTHON ?= /usr/bin/python
all: audit2why

View File

@ -1,3 +1,5 @@
PYTHON ?= python
# Installation directories.
PREFIX ?= $(DESTDIR)/usr
SYSCONFDIR ?= $(DESTDIR)/etc/sysconfig
@ -32,7 +34,7 @@ install: all
install -m 644 sandbox.conf $(SYSCONFDIR)/sandbox
test:
@python test_sandbox.py -v
@$(PYTHON) test_sandbox.py -v
clean:
-rm -f seunshare *.o *~

View File

@ -1,9 +1,11 @@
PYTHON ?= python
# Installation directories.
PREFIX ?= $(DESTDIR)/usr
LIBDIR ?= $(PREFIX)/lib
SBINDIR ?= $(PREFIX)/sbin
MANDIR = $(PREFIX)/share/man
PYLIBVER ?= $(shell python -c 'import sys;print "python%d.%d" % sys.version_info[0:2]')
PYLIBVER ?= $(shell $(PYTHON) -c 'import sys;print("python%d.%d" % sys.version_info[0:2])')
PYTHONLIBDIR ?= $(LIBDIR)/$(PYLIBVER)
BASHCOMPLETIONDIR ?= $(DESTDIR)/usr/share/bash-completion/completions
@ -24,7 +26,7 @@ install: all
install -m 644 $(BASHCOMPLETIONS) $(BASHCOMPLETIONDIR)/semanage
test:
@python test-semanage.py -a
@$(PYTHON) test-semanage.py -a
clean:
indent:

View File

@ -1,3 +1,5 @@
PYTHON ?= python
# Installation directories.
PREFIX ?= $(DESTDIR)/usr
SYSCONFDIR ?= $(DESTDIR)/etc/sysconfig
@ -7,7 +9,6 @@ SBINDIR ?= $(PREFIX)/sbin
DATADIR ?= $(PREFIX)/share
MANDIR ?= $(PREFIX)/share/man
LOCALEDIR ?= /usr/share/locale
PYTHON ?= /usr/bin/python
BASHCOMPLETIONDIR ?= $(DESTDIR)/usr/share/bash-completion/completions
SHAREDIR ?= $(PREFIX)/share/sandbox
override CFLAGS = -I$(PREFIX)/include -DPACKAGE="policycoreutils" -Wall -Werror -Wextra -W -DSHARED -shared
@ -27,7 +28,7 @@ sepolgen:
ln -sf sepolicy sepolgen
test:
@python test_sepolicy.py -v
@$(PYTHON) test_sepolicy.py -v
install:
$(PYTHON) setup.py install `test -n "$(DESTDIR)" && echo --root $(DESTDIR)`

View File

@ -1,4 +1,5 @@
PYTHONLIBDIR ?= $(shell python -c "from distutils.sysconfig import *; print get_python_lib(1)")
PYTHON ?= python
PYTHONLIBDIR ?= $(shell $(PYTHON) -c "from distutils.sysconfig import *; print(get_python_lib(1))")
PACKAGEDIR ?= $(DESTDIR)/$(PYTHONLIBDIR)/sepolgen
all:

View File

@ -1,3 +1,5 @@
PYTHON ?= python
clean:
rm -f *~ *.pyc
rm -f parser.out parsetab.py
@ -6,4 +8,4 @@ clean:
rm -f output
test:
python run-tests.py
$(PYTHON) run-tests.py