[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] Permit user to suppress passing --prefix to setup.py



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1241721130 -3600
# Node ID bf946cc3008bcb927bf28de87160cc4ec2b180c0
# Parent  a1a0bd345acc99805ee534cf95a43e46402977f1
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@xxxxxxxxxxxxx>
---
 Config.mk               |    6 ++++++
 tools/pygrub/Makefile   |    6 +++---
 tools/python/Makefile   |    6 +++---
 tools/security/Makefile |    6 +++---
 4 files changed, 15 insertions(+), 9 deletions(-)

diff -r a1a0bd345acc -r bf946cc3008b Config.mk
--- a/Config.mk Thu May 07 10:03:18 2009 +0100
+++ b/Config.mk Thu May 07 19:32:10 2009 +0100
@@ -34,6 +34,12 @@ EXTRA_INCLUDES += $(EXTRA_PREFIX)/includ
 EXTRA_INCLUDES += $(EXTRA_PREFIX)/include
 EXTRA_LIB += $(EXTRA_PREFIX)/$(LIBLEAFDIR)
 endif
+
+PYTHON      ?= python
+PYTHON_PREFIX_ARG ?= --prefix="$(PREFIX)"
+# The above requires that PREFIX contains *no spaces*. This variable is here
+# to permit the user to set PYTHON_PREFIX_ARG to '' to workaround this bug:
+#  https://bugs.launchpad.net/ubuntu/+bug/362570
 
 # cc-option: Check if compiler supports first option, else fall back to second.
 # Usage: cflags-y += $(call cc-option,$(CC),-march=winchip-c6,-march=i586)
diff -r a1a0bd345acc -r bf946cc3008b tools/pygrub/Makefile
--- a/tools/pygrub/Makefile     Thu May 07 10:03:18 2009 +0100
+++ b/tools/pygrub/Makefile     Thu May 07 19:32:10 2009 +0100
@@ -6,12 +6,12 @@ all: build
 all: build
 .PHONY: build
 build:
-       CC="$(CC)" CFLAGS="$(CFLAGS)" python setup.py build
+       CC="$(CC)" CFLAGS="$(CFLAGS)" $(PYTHON) setup.py build
 
 .PHONY: install
 install: all
-       CC="$(CC)" CFLAGS="$(CFLAGS)" python setup.py install \
-               --prefix="$(PREFIX)" --root="$(DESTDIR)" --force
+       CC="$(CC)" CFLAGS="$(CFLAGS)" $(PYTHON) setup.py install \
+               $(PYTHON_PREFIX_ARG) --root="$(DESTDIR)" --force
        $(INSTALL_DIR) $(DESTDIR)/var/run/xend/boot
 
 .PHONY: clean
diff -r a1a0bd345acc -r bf946cc3008b tools/python/Makefile
--- a/tools/python/Makefile     Thu May 07 10:03:18 2009 +0100
+++ b/tools/python/Makefile     Thu May 07 19:32:10 2009 +0100
@@ -16,7 +16,7 @@ NLSDIR = $(SHAREDIR)/locale
 
 .PHONY: build buildpy
 buildpy: 
-       CC="$(CC)" CFLAGS="$(CFLAGS)" python setup.py build
+       CC="$(CC)" CFLAGS="$(CFLAGS)" $(PYTHON) setup.py build
 
 build: buildpy refresh-pot refresh-po $(CATALOGS)
 
@@ -55,8 +55,8 @@ refresh-po: $(POTFILE)
 
 .PHONY: install
 install: install-messages install-dtd
-       CC="$(CC)" CFLAGS="$(CFLAGS)" python setup.py install \
-               --prefix="$(PREFIX)" --root="$(DESTDIR)" --force
+       CC="$(CC)" CFLAGS="$(CFLAGS)" $(PYTHON) setup.py install \
+               $(PYTHON_PREFIX_ARG) --root="$(DESTDIR)" --force
 
 install-dtd: all
        $(INSTALL_DIR) $(DESTDIR)$(DOCDIR)
diff -r a1a0bd345acc -r bf946cc3008b tools/security/Makefile
--- a/tools/security/Makefile   Thu May 07 10:03:18 2009 +0100
+++ b/tools/security/Makefile   Thu May 07 19:32:10 2009 +0100
@@ -60,8 +60,8 @@ install: all $(ACM_CONFIG_FILE)
        $(INSTALL_DATA) $(ACM_INST_HTML) $(DESTDIR)$(ACM_SECGEN_HTMLDIR)
        $(INSTALL_DIR) $(DESTDIR)$(ACM_SECGEN_CGIDIR)
        $(INSTALL_PROG) $(ACM_INST_CGI) $(DESTDIR)$(ACM_SECGEN_CGIDIR)
-       python python/setup.py install \
-               --prefix="$(PREFIX)" --root="$(DESTDIR)" --force
+       $(PYTHON) python/setup.py install $(PYTHON_PREFIX_ARG) \
+               --root="$(DESTDIR)" --force
 else
 .PHONY: all
 all:
@@ -72,7 +72,7 @@ endif
 
 .PHONY: build
 build: $(ACM_INST_TOOLS) $(ACM_NOINST_TOOLS)
-       python python/setup.py build
+       $(PYTHON) python/setup.py build
        chmod 700 $(ACM_SCRIPTS)
 
 xensec_tool: $(OBJS_TOOL)

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.