When building using a makefile, is there a way to retrieve all the output build generated by the make file. Because when i build with a cmd window, all the output of the build shows in the cmd window. But when using the same command in python, it seems that I can't retrieve all the build info. It does build properly but the information I am trying to retrieve is not there. I am using the os.popen function but it is not working well.
My code is:
os.chdir("c:\\ProjectDir")
CmdLine = "makel"
RetBuild = os.popen(CmdLine)
sys.stdout.flush()
# lets find out if the build was a success with no error.
for Line in RetBuild:
# lets write in a log file the return of the build.
fpLog.write(Line)
7 2478
When building using a makefile, is there a way to retrieve all the output build generated by the make file. Because when i build with a cmd window, all the output of the build shows in the cmd window. But when using the same command in python, it seems that I can't retrieve all the build info. It does build properly but the information I am trying to retrieve is not there. I am using the os.popen function but it is not working well.
My code is: -
os.chdir("c:\\ProjectDir")
-
CmdLine = "makel"
-
RetBuild = os.popen(CmdLine)
-
sys.stdout.flush()
-
-
# lets find out if the build was a success with no error.
-
for Line in RetBuild:
-
# lets write in a log file the return of the build.
-
fpLog.write(Line)
1st: code tags work here, spaces don't.
2nd: - import sys
-
logFile = open('fpLog', 'w')
-
sys.stdout = logFile
-
-
# do your build
-
-
logFile.close()
might do the trick.
1st: code tags work here, spaces don't.
2nd: - import sys
-
logFile = open('fpLog', 'w')
-
sys.stdout = logFile
-
-
# do your build
-
-
logFile.close()
might do the trick.
Sorry, I forgot to mention that fpLog is from a class i built. So bassically, fpLog.write(Line) write a line in a file. This has no problem, and also I do build using different tools such with visual C++ using the msdev and I do retrieve all the build information. But with the make, I can't retrieve all the build information that I do see when building using directly the command line in a Cmd Window.
If you are trying to trap the output of a command to a list of lines try - RetBuild = os.popen(CmdLine).read().split('\n')
If you are trying to trap the output of a command to a list of lines try - RetBuild = os.popen(CmdLine).read().split('\n')
One other point is I do retrieve some little information from the build such as this line (C) Copyright OPUS Software 1987-91. All rights reserved.
This line is probably the compiler header. So I can retrieve this line with no problem in my log file. But the information I am looking is a line at the end of the build to see if the build was successfull such as the following line: Output.out is up to date
This line can only be seen in the Cmd window. But I just can't retrieve it in my file. And I know that I am going through all the lines of the output build since I do build other project using other tools such as Visual Studio, and I can retrieve all the output line with no problem. But with the make file, the os.popen function output only a few lines.
When using the os.system command, I see all of the proper output in my cmd window. It is as if the os.system and os.popen are not returning the same thing
When using the os.system command, I see all of the proper output in my cmd window. It is as if the os.system and os.popen are not returning the same thing
Without regard to stdout, and the log file, if you just run - RetBuild = os.popen(CmdLine).read().split('\n')
from inside your ide, or python for that matter, does the list stored in RetBuild contain all the information? I'm just trying to establish that there isn't a second issue because I have used this code quite a bit and it generally returns exactly what I'd expect.
Without regard to stdout, and the log file, if you just run - RetBuild = os.popen(CmdLine).read().split('\n')
from inside your ide, or python for that matter, does the list stored in RetBuild contain all the information? I'm just trying to establish that there isn't a second issue because I have used this code quite a bit and it generally returns exactly what I'd expect.
Exactly, that is my problem, the popen function, does not return everthing I am expecting. I did try the following but it did only return a couple of lines. - RetBuild = os.popen(CmdLine).read().split('\n')
I am not seing the result of the built.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Gg |
last post by:
Hi,
I have a project that depends on other projets. So I have a Makefile
that calls Makefile of sub-projects to build the libs if needed.
Once libs are built, the main Makefile link everything...
|
by: newbiecpp |
last post by:
I am very sorry to post this one because I know it is out of topic but I
cannot find the proper news group. I understand that most senior C++
programmers know makefile very well. My question is...
|
by: Sharp Tool |
last post by:
Hi
I have downloaded a program that is written in C++ that I would like to
compile into a Win XP executable.
The program contains a Makefile written for Unix/linux/cygwin.
I would like to...
|
by: Jacobo Rodriguez Villar |
last post by:
Hello,
Is there any way (or program) to convert and maintain easily a C++
project (vs7.1) to a Makefile file, in order to build it in Linux?
Many thanks
--
Jacobo Rodríguez Villar
...
|
by: Jess |
last post by:
Hello,
I am now trying to use makefile to compile C++ programs. My makefile
looks like:
f1.o : f1.cpp h1.h h2.h
g++ -c f1.cpp
f2.o : f2.cpp h2.h h3.h
g++ -c f2.cpp
|
by: avico83 |
last post by:
Hello everyone!
I'm having a problem building an image from an opensource code. I'm trying to build the image with the Makefile that came with the source code .
There is a Script called by the...
|
by: xz |
last post by:
I am a rookie of C++ and got so confused with the Makefile these days.
Could anyone be so kind and give a little sample Makefile for the
following particular example?
Let's say I have the...
|
by: =?Utf-8?B?UVNJRGV2ZWxvcGVy?= |
last post by:
I have a C# logging assembly with a static constructor and methods that is
called from another C# Assembly that is used as a COM interface for a VB6
Application. Ideally I need to build a file...
|
by: Anna Smidt |
last post by:
After having programmed since 8 years only VB6 I want to learn C++.NET now.
It's amazing that everything has to be prepared first. For example I
want to build the DirectShow baseclass, but the only...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
| |