ia64/xen-unstable

changeset 19594:bf946cc3008b

Permit user to suppress passing --prefix to setup.py

We change all invocations of setup.py as follows:

* use $(PYTHON) instead of `python' so that the user can specify
an alternative python version if they need to. If not set it
defaults to `python' in Config.mk.

* pass --prefix=$(PREFIX) via a new make variable
$(PYTHON_PREFIX_ARG). This allows a user to suppress the
--prefix=... argument entirely by setting PYTHON_PREFIX_ARG=''.
This will work around the bug described here
https://bugs.launchpad.net/ubuntu/+bug/362570
where passing --prefix=/usr/local (which ought to have no effect as
/usr/local is the default prefix) changes which subdirectory
distutils chooses, and results in the files being installed in
site-packages which is not on the default search path.

Users not affected by this python packaging bug should not set
PYTHON_PREFIX_ARG and their builds will not be affected. (Provided
PREFIX did not contain spaces. People who put spaces in PREFIX are
being quite optimistic.)

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Thu May 07 19:32:10 2009 +0100 (2009-05-07)
parents a1a0bd345acc
children 2656ab6fa828
files Config.mk tools/pygrub/Makefile tools/python/Makefile tools/security/Makefile
line diff
     1.1 --- a/Config.mk	Thu May 07 10:03:18 2009 +0100
     1.2 +++ b/Config.mk	Thu May 07 19:32:10 2009 +0100
     1.3 @@ -35,6 +35,12 @@ EXTRA_INCLUDES += $(EXTRA_PREFIX)/includ
     1.4  EXTRA_LIB += $(EXTRA_PREFIX)/$(LIBLEAFDIR)
     1.5  endif
     1.6  
     1.7 +PYTHON      ?= python
     1.8 +PYTHON_PREFIX_ARG ?= --prefix="$(PREFIX)"
     1.9 +# The above requires that PREFIX contains *no spaces*. This variable is here
    1.10 +# to permit the user to set PYTHON_PREFIX_ARG to '' to workaround this bug:
    1.11 +#  https://bugs.launchpad.net/ubuntu/+bug/362570
    1.12 +
    1.13  # cc-option: Check if compiler supports first option, else fall back to second.
    1.14  # Usage: cflags-y += $(call cc-option,$(CC),-march=winchip-c6,-march=i586)
    1.15  cc-option = $(shell if test -z "`$(1) $(2) -S -o /dev/null -xc \
     2.1 --- a/tools/pygrub/Makefile	Thu May 07 10:03:18 2009 +0100
     2.2 +++ b/tools/pygrub/Makefile	Thu May 07 19:32:10 2009 +0100
     2.3 @@ -6,12 +6,12 @@ include $(XEN_ROOT)/tools/Rules.mk
     2.4  all: build
     2.5  .PHONY: build
     2.6  build:
     2.7 -	CC="$(CC)" CFLAGS="$(CFLAGS)" python setup.py build
     2.8 +	CC="$(CC)" CFLAGS="$(CFLAGS)" $(PYTHON) setup.py build
     2.9  
    2.10  .PHONY: install
    2.11  install: all
    2.12 -	CC="$(CC)" CFLAGS="$(CFLAGS)" python setup.py install \
    2.13 -		--prefix="$(PREFIX)" --root="$(DESTDIR)" --force
    2.14 +	CC="$(CC)" CFLAGS="$(CFLAGS)" $(PYTHON) setup.py install \
    2.15 +		$(PYTHON_PREFIX_ARG) --root="$(DESTDIR)" --force
    2.16  	$(INSTALL_DIR) $(DESTDIR)/var/run/xend/boot
    2.17  
    2.18  .PHONY: clean
     3.1 --- a/tools/python/Makefile	Thu May 07 10:03:18 2009 +0100
     3.2 +++ b/tools/python/Makefile	Thu May 07 19:32:10 2009 +0100
     3.3 @@ -16,7 +16,7 @@ NLSDIR = $(SHAREDIR)/locale
     3.4  
     3.5  .PHONY: build buildpy
     3.6  buildpy: 
     3.7 -	CC="$(CC)" CFLAGS="$(CFLAGS)" python setup.py build
     3.8 +	CC="$(CC)" CFLAGS="$(CFLAGS)" $(PYTHON) setup.py build
     3.9  
    3.10  build: buildpy refresh-pot refresh-po $(CATALOGS)
    3.11  
    3.12 @@ -55,8 +55,8 @@ refresh-po: $(POTFILE)
    3.13  
    3.14  .PHONY: install
    3.15  install: install-messages install-dtd
    3.16 -	CC="$(CC)" CFLAGS="$(CFLAGS)" python setup.py install \
    3.17 -		--prefix="$(PREFIX)" --root="$(DESTDIR)" --force
    3.18 +	CC="$(CC)" CFLAGS="$(CFLAGS)" $(PYTHON) setup.py install \
    3.19 +		$(PYTHON_PREFIX_ARG) --root="$(DESTDIR)" --force
    3.20  
    3.21  install-dtd: all
    3.22  	$(INSTALL_DIR) $(DESTDIR)$(DOCDIR)
     4.1 --- a/tools/security/Makefile	Thu May 07 10:03:18 2009 +0100
     4.2 +++ b/tools/security/Makefile	Thu May 07 19:32:10 2009 +0100
     4.3 @@ -60,8 +60,8 @@ install: all $(ACM_CONFIG_FILE)
     4.4  	$(INSTALL_DATA) $(ACM_INST_HTML) $(DESTDIR)$(ACM_SECGEN_HTMLDIR)
     4.5  	$(INSTALL_DIR) $(DESTDIR)$(ACM_SECGEN_CGIDIR)
     4.6  	$(INSTALL_PROG) $(ACM_INST_CGI) $(DESTDIR)$(ACM_SECGEN_CGIDIR)
     4.7 -	python python/setup.py install \
     4.8 -		--prefix="$(PREFIX)" --root="$(DESTDIR)" --force
     4.9 +	$(PYTHON) python/setup.py install $(PYTHON_PREFIX_ARG) \
    4.10 +		--root="$(DESTDIR)" --force
    4.11  else
    4.12  .PHONY: all
    4.13  all:
    4.14 @@ -72,7 +72,7 @@ endif
    4.15  
    4.16  .PHONY: build
    4.17  build: $(ACM_INST_TOOLS) $(ACM_NOINST_TOOLS)
    4.18 -	python python/setup.py build
    4.19 +	$(PYTHON) python/setup.py build
    4.20  	chmod 700 $(ACM_SCRIPTS)
    4.21  
    4.22  xensec_tool: $(OBJS_TOOL)