Commit cd9fc14c authored by Jérome Perrin's avatar Jérome Perrin

Also set TMPDIR and TEMP environment variables

We were already setting $TMP, but many software uses $TMPDIR or $TEMP.
parent ba0e7204
......@@ -281,10 +281,10 @@ will add it to environmet variables as the following:
CXXFLAGS=-I${buildout:prefix} $CXXFLAGS
LDFLAGS=-L${buildout:prefix}/lib
Besides, the recipe changes environment variable ``TMP`` when building
and installing, and make a corresponding directory 'tmp' in the
``location``. This temporary directory will be removed after
installing finished.
Besides, the recipe changes environment variables ``TMP``, ``TMPDIR`` and
``TEMP`` when building and installing, and make a corresponding directory 'tmp'
in the ``location``. This temporary directory will be removed after installing
finished.
Example usage
=============
......@@ -320,7 +320,9 @@ default build options.
>>> print(system(buildout))
Installing package.
package: [ENV] TEMP = /sample_buildout/parts/package/tmp
package: [ENV] TMP = /sample_buildout/parts/package/tmp
package: [ENV] TMPDIR = /sample_buildout/parts/package/tmp
package: Extracting package to /sample_buildout/parts/package__compile__
configure --prefix=/sample_buildout/parts/package
building package
......@@ -346,7 +348,9 @@ default build options.
>>> print system(buildout)
Uninstalling package.
Installing packagex.
packagex: [ENV] TEMP = /sample_buildout/parts/packagex/tmp
packagex: [ENV] TMP = /sample_buildout/parts/packagex/tmp
packagex: [ENV] TMPDIR = /sample_buildout/parts/packagex/tmp
packagex: Extracting package to /sample_buildout/parts/packagex__compile__
configure --prefix=/sample_buildout/parts/packagex
building package
......@@ -383,7 +387,9 @@ a custom location within the buildout::
>>> print(system(buildout))
Uninstalling packagex.
Installing foobar.
foobar: [ENV] TEMP = /sample_buildout/parts/foobar/tmp
foobar: [ENV] TMP = /sample_buildout/parts/foobar/tmp
foobar: [ENV] TMPDIR = /sample_buildout/parts/foobar/tmp
foobar: Extracting package to /sample_buildout/parts/foobar__compile__
building package
installing package
......@@ -423,7 +429,9 @@ Makefile and using explicit ``make`` options to control the build process.
>>> print(system(buildout))
Uninstalling foobar.
Installing haproxy.
haproxy: [ENV] TEMP = /sample_buildout/parts/haproxy/tmp
haproxy: [ENV] TMP = /sample_buildout/parts/haproxy/tmp
haproxy: [ENV] TMPDIR = /sample_buildout/parts/haproxy/tmp
haproxy: Extracting package to /sample_buildout/parts/haproxy__compile__
Building HAProxy 1.4.8 (dummy package)
TARGET: linux26
......@@ -465,7 +473,9 @@ and building that.
>>> print(system(buildout))
Uninstalling haproxy.
Installing package.
package: [ENV] TEMP = /sample_buildout/parts/package/tmp
package: [ENV] TMP = /sample_buildout/parts/package/tmp
package: [ENV] TMPDIR = /sample_buildout/parts/package/tmp
package: Using local source directory: /checkout/package-0.0.0
configure --prefix=/sample_buildout/parts/package
building package
......@@ -525,7 +535,9 @@ targets and also patches the source code before the scripts are run.
Installing package.
package: [ENV] CFLAGS = -I/sw/include
package: [ENV] LDFLAGS = -L/sw/lib -L/some/extra/lib
package: [ENV] TEMP = /sample_buildout/parts/package/tmp
package: [ENV] TMP = /sample_buildout/parts/package/tmp
package: [ENV] TMPDIR = /sample_buildout/parts/package/tmp
package: Extracting package to /sample_buildout/parts/package__compile__
package: Applying patches
patching file configure
......@@ -609,7 +621,9 @@ and a new buildout to try it out
>>> print(system(buildout))
Uninstalling package.
Installing package.
package: [ENV] TEMP = /sample_buildout/parts/package/tmp
package: [ENV] TMP = /sample_buildout/parts/package/tmp
package: [ENV] TMPDIR = /sample_buildout/parts/package/tmp
package: Extracting package to /sample_buildout/parts/package__compile__
package: Executing pre-configure-hook
hook: This is pre-configure-hook!
......@@ -650,7 +664,9 @@ shell command in the corresponding stage.
>>> print system(buildout)
Uninstalling package.
Installing package.
package: [ENV] TEMP = /sample_buildout/parts/package/tmp
package: [ENV] TMP = /sample_buildout/parts/package/tmp
package: [ENV] TMPDIR = /sample_buildout/parts/package/tmp
package: Extracting package to /sample_buildout/parts/package__compile__
package: Executing pre-configure
Configure part: package
......@@ -692,7 +708,9 @@ are only ``pre-configure`` and ``post-install``. the output will be
#>>> print system(buildout)
Uninstalling package.
Installing package.
package: [ENV] TEMP = /sample_buildout/parts/package/tmp
package: [ENV] TMP = /sample_buildout/parts/package/tmp
package: [ENV] TMPDIR = /sample_buildout/parts/package/tmp
package: Extracting package to /sample_buildout/parts/package__compile__
package: Executing pre-configure
Configure part: Configure in common platform
......@@ -708,7 +726,9 @@ and 'package:cygwin'. The output will be
>>> print system(buildout)
Uninstalling package.
Installing package.
package: [ENV] TEMP = /sample_buildout/parts/package/tmp
package: [ENV] TMP = /sample_buildout/parts/package/tmp
package: [ENV] TMPDIR = /sample_buildout/parts/package/tmp
package: Extracting package to /sample_buildout/parts/package__compile__
package: Executing pre-configure
Configure in the CYGWIN platform
......@@ -757,7 +777,9 @@ Let's see what happens when set prefix in the buildout section:
package: [ENV] CXXFLAGS = /sample-buildout/mylocal/include
package: [ENV] LDFLAGS = /sample-buildout/mylocal/lib
package: [ENV] PATH = /sample_buildout/mylocal/bin:/usr/bin
package: [ENV] TEMP = /sample_buildout/parts/package/tmp
package: [ENV] TMP = /sample_buildout/parts/package/tmp
package: [ENV] TMPDIR = /sample_buildout/parts/package/tmp
package: Extracting package to /sample_buildout/parts/package__compile__
package: Executing pre-configure
configure --prefix=/sample_buildout/mylocal
......@@ -789,7 +811,9 @@ example,
>>> print system(buildout)
Uninstalling package.
Installing package.
package: [ENV] TEMP = /sample_buildout/parts/package/tmp
package: [ENV] TMP = /sample_buildout/parts/package/tmp
package: [ENV] TMPDIR = /sample_buildout/parts/package/tmp
package: Extracting package to /sample_buildout/parts/package__compile__
package: Executing pre-configure
configure --prefix=/sample_buildout/parts/package
......@@ -829,7 +853,9 @@ prefix:
package: [ENV] CXXFLAGS = /sample-buildout/mylocal/include
package: [ENV] LDFLAGS = /sample-buildout/mylocal/lib
package: [ENV] PATH = /sample_buildout/mylocal/bin:/usr/bin
package: [ENV] TEMP = /sample_buildout/parts/package/tmp
package: [ENV] TMP = /sample_buildout/parts/package/tmp
package: [ENV] TMPDIR = /sample_buildout/parts/package/tmp
package: Extracting package to /sample_buildout/parts/package__compile__
configure --prefix=/sample_buildout/mylocal
building package
......@@ -842,7 +868,9 @@ prefix:
package-2: [ENV] CXXFLAGS = /sample-buildout/mylocal/include
package-2: [ENV] LDFLAGS = /sample-buildout/mylocal/lib
package-2: [ENV] PATH = /sample_buildout/mylocal/bin:/usr/bin
package-2: [ENV] TEMP = /sample_buildout/parts/package-2/tmp
package-2: [ENV] TMP = /sample_buildout/parts/package-2/tmp
package-2: [ENV] TMPDIR = /sample_buildout/parts/package-2/tmp
package-2: Extracting package to /sample_buildout/parts/package-2__compile__
configure --prefix=/sample_buildout/mylocal
building package
......@@ -929,7 +957,9 @@ value in the part section. For example,
package: [ENV] CXXFLAGS = -I/mytemp/include
package: [ENV] LDFLAGS = -L/mytemp/lib
package: [ENV] PATH = /mytemp/bin:/usr/bin
package: [ENV] TEMP = /sample_buildout/parts/package/tmp
package: [ENV] TMP = /sample_buildout/parts/package/tmp
package: [ENV] TMPDIR = /sample_buildout/parts/package/tmp
package: Extracting package to /sample_buildout/parts/package__compile__
Installing package-2.
package-2: [ENV] CFLAGS = -I/mytemp/include
......@@ -937,7 +967,9 @@ value in the part section. For example,
package-2: [ENV] CXXFLAGS = -I/mytemp/include
package-2: [ENV] LDFLAGS = -L/mytemp/lib
package-2: [ENV] PATH = /mytemp/bin:/usr/bin
package-2: [ENV] TEMP = /sample_buildout/parts/package-2/tmp
package-2: [ENV] TMP = /sample_buildout/parts/package-2/tmp
package-2: [ENV] TMPDIR = /sample_buildout/parts/package-2/tmp
package-2: Extracting package to /sample_buildout/parts/package-2__compile__
package-2: Executing post-install
package magic prefix is /mytemp
......@@ -962,7 +994,9 @@ can display "prefix" value in the stdout.
Uninstalling package-2.
Uninstalling package.
Installing package.
package: [ENV] TEMP = /sample_buildout/parts/package/tmp
package: [ENV] TMP = /sample_buildout/parts/package/tmp
package: [ENV] TMPDIR = /sample_buildout/parts/package/tmp
package: Extracting package to /sample_buildout/parts/package__compile__
configure
building package
......@@ -989,7 +1023,9 @@ replaced with the recipe final prefix.
>>> print system(buildout)
Uninstalling package.
Installing package.
package: [ENV] TEMP = /sample_buildout/parts/package/tmp
package: [ENV] TMP = /sample_buildout/parts/package/tmp
package: [ENV] TMPDIR = /sample_buildout/parts/package/tmp
package: Extracting package to /sample_buildout/parts/package__compile__
configure
building package
......@@ -1025,13 +1061,17 @@ of "package":
>>> print system(buildout)
Uninstalling package.
Installing package-2.
package-2: [ENV] TEMP = /sample_buildout/parts/package-2/tmp
package-2: [ENV] TMP = /sample_buildout/parts/package-2/tmp
package-2: [ENV] TMPDIR = /sample_buildout/parts/package-2/tmp
package-2: Extracting package to /sample_buildout/parts/package-2__compile__
configure --prefix=/sample_buildout/parts/package-2
building package
installing package
Installing package.
package: [ENV] TEMP = /sample_buildout/parts/package/tmp
package: [ENV] TMP = /sample_buildout/parts/package/tmp
package: [ENV] TMPDIR = /sample_buildout/parts/package/tmp
package: Extracting package to /sample_buildout/parts/package__compile__
configure --prefix=/sample_buildout/parts/package
building package
......@@ -1062,13 +1102,17 @@ Look, "package" is reinstalled either:
Uninstalling package.
Uninstalling package-2.
Installing package-2.
package-2: [ENV] TEMP = /sample_buildout/parts/package-2/tmp
package-2: [ENV] TMP = /sample_buildout/parts/package-2/tmp
package-2: [ENV] TMPDIR = /sample_buildout/parts/package-2/tmp
package-2: Extracting package to /sample_buildout/parts/package-2__compile__
configure
building package
installing package
Installing package.
package: [ENV] TEMP = /sample_buildout/parts/package/tmp
package: [ENV] TMP = /sample_buildout/parts/package/tmp
package: [ENV] TMPDIR = /sample_buildout/parts/package/tmp
package: Extracting package to /sample_buildout/parts/package__compile__
configure --prefix=/sample_buildout/parts/package
building package
......@@ -1097,7 +1141,9 @@ Use option ``share`` to install a share pacakge.
Installing package.
package: Checking whether package is installed at share path: /usr/local
package: could not find promise "/usr/local/bin/mypackage.exe"
package: [ENV] TEMP = /sample_buildout/parts/package/tmp
package: [ENV] TMP = /sample_buildout/parts/package/tmp
package: [ENV] TMPDIR = /sample_buildout/parts/package/tmp
package: Extracting package to /sample_buildout/parts/package__compile__
configure --prefix=/usr/local
building package
......
......@@ -117,7 +117,10 @@ class Recipe(object):
# environment.
for key in self.environ:
self.environ[key] = self.environ[key] % os.environ
self.environ['TMP'] = os.path.join(options['default-location'], 'tmp')
# Always define TMPDIR, TEMP and TMP
for key in ('TMPDIR', 'TEMP', 'TMP'):
self.environ[key] = os.path.join(options['default-location'], 'tmp')
def augmented_environment(self):
"""Returns a dictionary containing the current environment variables
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment