From 85ab7254fad27b8363326b519d4428121c7b68bf Mon Sep 17 00:00:00 2001 From: david Date: Fri, 16 Nov 2007 22:18:09 +0000 Subject: [PATCH] Re-override distutils's overriding of the Python interpreter path to be "/usr/bin/env python" when DESTDIR is defined. This keeps from hardcoding a specific interpreter location when building for installation on another machine. --- Makefile.in | 13 ++++++++++++- zenmap.spec.in | 2 +- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/Makefile.in b/Makefile.in index 4e5090064..ca9b212eb 100644 --- a/Makefile.in +++ b/Makefile.in @@ -195,8 +195,19 @@ $(ZENMAPDIR)/setup.py: $(ZENMAPDIR)/umitCore/Version.py $(ZENMAPDIR)/share/zenmap/config/zenmap_version: nmap.h cd $(ZENMAPDIR) && $(PYTHON) install_scripts/utils/version_update.py "$(NMAP_VERSION)" +# By default distutils rewrites installed scripts to hardcode the +# location of the Python interpreter they were built with (something +# like #!/usr/bin/python2.4). This is the wrong thing to do when +# installing on a machine other than the one used to do the build. Use +# this as the location of the interpreter whenever we're not doing a +# local installation. +DEFAULT_PYTHON_PATH = /usr/bin/env python + build-zenmap: $(ZENMAPDIR)/setup.py $(ZENMAPDIR)/umitCore/Version.py - cd $(ZENMAPDIR) && $(PYTHON) setup.py build +# When DESTDIR is defined, assume we're building an executable +# distribution rather than a local installation and force a generic +# Python interpreter location. + cd $(ZENMAPDIR) && $(PYTHON) setup.py build $(if $(DESTDIR),--executable "$(DEFAULT_PYTHON_PATH)") install-zenmap: $(ZENMAPDIR)/setup.py cd $(ZENMAPDIR) && $(PYTHON) setup.py install --prefix "$(prefix)" $(if $(DESTDIR),--root "$(DESTDIR)") diff --git a/zenmap.spec.in b/zenmap.spec.in index 368107087..9f803ca07 100644 --- a/zenmap.spec.in +++ b/zenmap.spec.in @@ -44,7 +44,7 @@ from Umit, an Nmap GUI created as part of the Google Summer of Code. %build %configure --without-openssl PYTHON="%{__python}" -make build-zenmap +make build-zenmap DESTDIR=$RPM_BUILD_ROOT %install [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT