1#!/usr/bin/python 2 3# Copyright 2012 Steven Watanabe 4# Distributed under the Boost Software License, Version 1.0. 5# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) 6 7# Test that paths containing spaces are handled correctly by actions. 8 9import BoostBuild 10import os 11 12t = BoostBuild.Tester(use_test_config=False) 13 14t.write("has space/jamroot.jam", """\ 15import testing ; 16unit-test test : test.cpp ; 17actions write-file 18{ 19 @(STDOUT:E=okay) >"$(<)" 20} 21make test.txt : : @write-file ; 22""") 23t.write("has space/test.cpp", "int main() {}\n") 24 25tmpdir = t.workpath("has space") 26try: 27 oldtmp = os.environ["TMP"] 28except: 29 oldtmp = None 30try: 31 oldtmpdir = os.environ["TMPDIR"] 32except: 33 oldtmpdir = None 34os.environ["TMP"] = tmpdir; # Windows 35os.environ["TMPDIR"] = tmpdir; # *nix 36 37try: 38 t.run_build_system(["has space"]) 39 t.expect_addition("has space/bin/test.txt") 40 t.expect_addition("has space/bin/$toolset/debug*/test.passed") 41finally: 42 if oldtmp is not None: 43 os.environ["TMP"] = oldtmp 44 else: 45 del os.environ["TMP"] 46 if oldtmpdir is not None: 47 os.environ["TMPDIR"] = oldtmpdir 48 else: 49 del os.environ["TMPDIR"] 50 51t.cleanup() 52