Sign in to follow this  

Visual Studio + Makefiles Problem

Recommended Posts

This might be a problem I'm having with Visual Studio (2005, Standard) or this might be a problem caused by a lack of familiarity with Python; I'm not really sure yet. Here's the situation: I have a .vcproj that is set to a "Makefile" configuration type, which means the build, rebuild and clean actions are specified as command line actions. I want to execute a Python script as the command line actions because I need to do some rather rich processing of the command line arguments and other processing that wouldn't be very fun inside a batch file. Ultimately, the Python script will invoke an external tool (SCONS) to perform the actual build. The problem I get is that I cannot correctly trap the output of the SCONS invocation. I've reduced the issue to a small test case for demonstration:
# This file is
import os

print "Hello, world."
If I run from a regular command prompt, I get the expected output (The hello string, and a directory listing). If I set "" to be the build action for my Makefile project and try to build, I only see the "Hello, world." line in the output window. Something prevents system() from executing (it returns 1 when run from VS, 0 when run from a real shell; "del foo.txt" won't actually delete the file, etc.). My current workaround is to use popen to invoke the command and read back the output, but this is not suitable for actual use since I don't see any output until the popen'd command finishes (when used to actually invoke SCONS and build the project, this means it appears as nothing is happened for five minutes and then the build output is dumped all at once). Does anybody know why I'm not seeing results from os.system() or a good way to work around this problem?

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this