Editra, Launch, Python, NMAKE always performs clean compile

Discuss any topics about the editor here

Editra, Launch, Python, NMAKE always performs clean compile

Postby immortalnights » Thu Mar 03, 2011 4:33 pm

I explained the current setup I have for C++ development here. Today I noticed some strange behavior which unfortunately is wasting a lot of time.

I've switched to using the simplified version of my python script (I believe it's linked as an attachment of the thread above, but for clarity it consists of the following:

Code: Select all
import os, sys
import subprocess, time

oProcess = subprocess.Popen(
              ["nmake"],
              stdin=None,
              stdout=subprocess.PIPE,
              stderr=subprocess.STDOUT)

while oProcess.poll() == None:
  print oProcess.stdout.readline()
 
  time.sleep(0)

exit()


The issue is two fold:
  • It appears that it always does a full rebuild - as if nothing had been compiled before. This takes considerably more time then a quick build of changed code.
  • The output is not printed, despite the use of print. Until everything the process has ended. Despite printing on each iteration of the loop.

I'd hope that it's some issue with the script - at least I expect point 2 would likely be.

Any help or thoughts would be appreciated as the current project I am working on can take up to a minue to compile fully, and I am only making minor changes and therefore am forced to not use my standard system until I can figure this out :(
immortalnights
User
 
Posts: 39
Joined: Tue Dec 21, 2010 2:02 pm

Re: Editra, Launch, Python, NMAKE always performs clean compile

Postby cody » Thu Mar 03, 2011 4:51 pm

Hi,

To get the output immediately you should run your python script in unbuffered mode otherwise python will be buffering its output.

i.e
Code: Select all
python -u somescript.py


Not sure about the issue with the full rebuild, seems that if anything it would be an issue with nmake. You should try to see how your Popen command is different from if you run the command manually from the command line. The 'shell' and 'cwd' arguments to Popen may be of interest to checkout.
User avatar
cody
Site Admin
 
Posts: 1315
Joined: Mon Oct 09, 2006 2:49 am
Location: United States

Re: Editra, Launch, Python, NMAKE always performs clean compile

Postby immortalnights » Thu Mar 03, 2011 5:37 pm

Thanks for the help and quick reply.

cody wrote:
Code: Select all
python -u somescript.py



That seemed to work. However it seems that the Launch display always scrolls to the bottom when new content is added - so it is pretty useless until the full output is displayed, could this be optional?

cody wrote:Not sure about the issue with the full rebuild, seems that if anything it would be an issue with nmake. You should try to see how your Popen command is different from if you run the command manually from the command line. The 'shell' and 'cwd' arguments to Popen may be of interest to checkout.


I've tested this somewhat and I'm thinking there has to be some difference with it running in Editra's environment.

If I create a short-cut to my python script that sets the working directory or "Start in" value as it is defined to the path of the project I want to compile with nmake, the script and nmake works as expected. However the same script run using Launch does not.

I don't think it's Editra as such, but it does seem to be an environment like issue, but I am unsure how to track tis down.
immortalnights
User
 
Posts: 39
Joined: Tue Dec 21, 2010 2:02 pm

Re: Editra, Launch, Python, NMAKE always performs clean compile

Postby cody » Thu Mar 03, 2011 7:12 pm

immortalnights wrote:Thanks for the help and quick reply.

cody wrote:Not sure about the issue with the full rebuild, seems that if anything it would be an issue with nmake. You should try to see how your Popen command is different from if you run the command manually from the command line. The 'shell' and 'cwd' arguments to Popen may be of interest to checkout.


I've tested this somewhat and I'm thinking there has to be some difference with it running in Editra's environment.

If I create a short-cut to my python script that sets the working directory or "Start in" value as it is defined to the path of the project I want to compile with nmake, the script and nmake works as expected. However the same script run using Launch does not.

I don't think it's Editra as such, but it does seem to be an environment like issue, but I am unsure how to track tis down.


Perhaps change your python script to pass the current working directory to the 'cwd' argument to POpen?


Cody
User avatar
cody
Site Admin
 
Posts: 1315
Joined: Mon Oct 09, 2006 2:49 am
Location: United States

Re: Editra, Launch, Python, NMAKE always performs clean compile

Postby immortalnights » Fri Mar 04, 2011 9:59 am

I believe I figured it out.

NMAKE uses file time stamps to determine change. To ensure all my files are saved before compilation I've set Launch to save all files before compilation. However, Launch saves them even if nothing has changed.

While I've been working on a more complex area of my project I could have 6+ source/header files open. If they all "change" they not only will NMAKE recompile the *.cpp files, but also every *.cpp file that is effected by the change of the *.hpp file. That is why it always seems to make a full build.

I thought I saw in the notes for a new release that lunch no longer saved when the file was not changed, should this be true? In all this is a second bad side effect from the Launches brute-force saving of buffers. Seems obvious at this time that having that option off (and the one to save the current buffer), is the only way. And the risk of having to compile twice if a change was not saved will still save considerable time.

Thank you for your help again. :)
immortalnights
User
 
Posts: 39
Joined: Tue Dec 21, 2010 2:02 pm

Re: Editra, Launch, Python, NMAKE always performs clean compile

Postby cody » Fri Mar 04, 2011 11:50 pm

Ah, forgot about that feature. Checked in a change to only save the buffers that have modifications.

There were no updates to Launch since the 0.6.0 release.
User avatar
cody
Site Admin
 
Posts: 1315
Joined: Mon Oct 09, 2006 2:49 am
Location: United States

Re: Editra, Launch, Python, NMAKE always performs clean compile

Postby cody » Fri Mar 18, 2011 7:09 pm

The new release of Editra 0.6.26 corrects the issue with Save All.

A new version of Launch will follow that includes a number of other enhancements and fixes for other issues.
User avatar
cody
Site Admin
 
Posts: 1315
Joined: Mon Oct 09, 2006 2:49 am
Location: United States


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 2 guests

cron