Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix some obscure build system issues which were causing some idl and …
…comInterfaces files to be rebuilt unnecessarily.

This is not a new problem, but it's particularly annoying for automated testing because running the tests often causes files to be rebuilt unnecessarily.
1. The ISimpleDOM and MathPlayer interfaces have multiple idl files. The targets for the idl file have an implicit dependency on midl.exe, but its position in the dependencies is different in the run before the idl files are copied versus subsequent runs. I think this is an SCons bug/quirk, probably because before the copy, the idl file must be scanned after the midl tool is considered. Explicitly specifying these extra idls as dependencies doesn't help. The only workaround I've found is to ignore midl.exe as a dependency when checking whether the targets should be rebuilt.
2. comInterfaces generates .pyc as well as .py files. We now tell SCons about the .pyc files as well so they get considered appropriately. Previously, the .py file could be removed, so SCons would rebuild the .py file. However, the .pyc still existed, so it was just loaded without generating a .py file. Subsequently, SCons would try to rebuild the .py file on every build.
  • Loading branch information
jcsteh committed Mar 29, 2017
commit 266c7513a6c630f5738bf39e78d31ce798d31dc1
7 changes: 6 additions & 1 deletion nvdaHelper/ISimpleDOM_sconscript
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
###
#This file is a part of the NVDA project.
#URL: http://www.nvda-project.org/
#Copyright 2006-2010 NVDA contributers.
#Copyright 2014-2017 NV Access Limited.
#This program is free software: you can redistribute it and/or modify
#it under the terms of the GNU General Public License version 2.0, as published by
#the Free Software Foundation.
Expand All @@ -24,5 +24,10 @@ tlbFile,headerFile,iidSourceFile,proxySourceFile,dlldataSourceFile=env.TypeLibra
source=idlFile,
MIDLFLAGS=['/c_ext','/I',Dir('.')],
)
# hack: Ignore midl.exe when deciding to rebuild, as its position in the dependencies

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to open an issue somewhere to keep track of this? It might be helpful for someone who wants to investigate, and see what has been tried. Having the issue number in the comments really helps people track down where the information is.

# is different in the run before the idl files are copied versus subsequent runs.
midl=env.WhereIs(env["MIDL"])
for target in (tlbFile,headerFile,iidSourceFile,proxySourceFile,dlldataSourceFile):
env.Ignore(target,midl)

Return(['tlbFile','headerFile','iidSourceFile','proxySourceFile','dlldataSourceFile'])
7 changes: 6 additions & 1 deletion nvdaHelper/mathPlayer_sconscript
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
###
#This file is a part of the NVDA project.
#URL: http://www.nvda-project.org/
#Copyright 2006-2010 NVDA contributers.
#Copyright 2014-2017 NV Access Limited.
#This program is free software: you can redistribute it and/or modify
#it under the terms of the GNU General Public License version 2.0, as published by
#the Free Software Foundation.
Expand All @@ -21,5 +21,10 @@ tlbFile,headerFile,iidSourceFile,proxySourceFile,dlldataSourceFile=env.TypeLibra
source=idlFile,
MIDLFLAGS=['/I',Dir('.')],
)
# hack: Ignore midl.exe when deciding to rebuild, as its position in the dependencies
# is different in the run before the idl files are copied versus subsequent runs.
midl=env.WhereIs(env["MIDL"])
for target in (tlbFile,headerFile,iidSourceFile,proxySourceFile,dlldataSourceFile):
env.Ignore(target,midl)

Return(['tlbFile','headerFile','iidSourceFile','proxySourceFile','dlldataSourceFile'])
10 changes: 6 additions & 4 deletions source/comInterfaces_sconscript
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
###
#This file is a part of the NVDA project.
#URL: http://www.nvda-project.org/
#Copyright 2006-2010 NVDA contributers.
#Copyright 2013-2017 NV Access Limited.
#This program is free software: you can redistribute it and/or modify
#it under the terms of the GNU General Public License version 2.0, as published by
#the Free Software Foundation.
Expand Down Expand Up @@ -49,12 +49,14 @@ COM_INTERFACES = {
}

for k,v in COM_INTERFACES.iteritems():
>
targets=[Dir('comInterfaces').File(k),
# This buillds a .pyc file as well.
Dir('comInterfaces').File(k + "c")]
source=clsid=majorVersion=None
if isinstance(v,basestring):
env.comtypesInterface(target,v)
env.comtypesInterface(targets,v)
else:
env.comtypesInterface(target,Dir('comInterfaces').File('__init__.py'),clsid=v[0],majorVersion=v[1],minorVersion=v[2])
env.comtypesInterface(targets,Dir('comInterfaces').File('__init__.py'),clsid=v[0],majorVersion=v[1],minorVersion=v[2])

#When cleaning comInterfaces get rid of everything except for things starting with __ (e.g. __init__.py)
env.Clean(Dir('comInterfaces'),Glob('comInterfaces/[!_]*')+Glob('comInterfaces/_[!_]*'))