mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2026-01-06 20:10:08 +01:00
Check dependencies and skip running sip if nothing is out of date.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@71618 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
14
build.py
14
build.py
@@ -29,7 +29,7 @@ from distutils.dep_util import newer, newer_group
|
|||||||
from buildtools.config import Config, msg, opj, posixjoin, loadETG, etg2sip, findCmd, \
|
from buildtools.config import Config, msg, opj, posixjoin, loadETG, etg2sip, findCmd, \
|
||||||
phoenixDir, wxDir, copyIfNewer, copyFile, \
|
phoenixDir, wxDir, copyIfNewer, copyFile, \
|
||||||
macFixDependencyInstallName, macSetLoaderNames, \
|
macFixDependencyInstallName, macSetLoaderNames, \
|
||||||
getSvnRev, runcmd, textfile_open
|
getSvnRev, runcmd, textfile_open, getSipFiles
|
||||||
|
|
||||||
|
|
||||||
import buildtools.version as version
|
import buildtools.version as version
|
||||||
@@ -702,14 +702,20 @@ def sip(options, args):
|
|||||||
modules.insert(0, opj(cfg.SIPGEN, '_core.sip'))
|
modules.insert(0, opj(cfg.SIPGEN, '_core.sip'))
|
||||||
|
|
||||||
for src_name in modules:
|
for src_name in modules:
|
||||||
# TODO: Add some dependency checking here. If none of the included
|
|
||||||
# files has been updated then running sip can probably be avoided.
|
|
||||||
# OTOH, it's fast enough that it probably doesn't matter.
|
|
||||||
tmpdir = tempfile.mkdtemp()
|
tmpdir = tempfile.mkdtemp()
|
||||||
tmpdir = tmpdir.replace('\\', '/')
|
tmpdir = tmpdir.replace('\\', '/')
|
||||||
src_name = src_name.replace('\\', '/')
|
src_name = src_name.replace('\\', '/')
|
||||||
base = os.path.basename(os.path.splitext(src_name)[0])
|
base = os.path.basename(os.path.splitext(src_name)[0])
|
||||||
sbf = posixjoin(cfg.SIPOUT, base) + '.sbf'
|
sbf = posixjoin(cfg.SIPOUT, base) + '.sbf'
|
||||||
|
|
||||||
|
# Check if any of the included files are newer than the .sbf file
|
||||||
|
# produced by the previous run of sip. If not then we don't need to
|
||||||
|
# run sip again.
|
||||||
|
etg = loadETG(posixjoin('etg', base + '.py'))
|
||||||
|
sipFiles = getSipFiles(etg.INCLUDES)
|
||||||
|
if not newer_group(sipFiles, sbf):
|
||||||
|
continue
|
||||||
|
|
||||||
pycode = base[1:] # remove the leading _
|
pycode = base[1:] # remove the leading _
|
||||||
pycode = posixjoin(cfg.PKGDIR, pycode) + '.py'
|
pycode = posixjoin(cfg.PKGDIR, pycode) + '.py'
|
||||||
pycode = '-X pycode'+base+':'+pycode
|
pycode = '-X pycode'+base+':'+pycode
|
||||||
|
|||||||
@@ -788,3 +788,19 @@ def textfile_open(filename, mode='rt'):
|
|||||||
return codecs.open(filename, mode, encoding='utf-8')
|
return codecs.open(filename, mode, encoding='utf-8')
|
||||||
else:
|
else:
|
||||||
return open(filename, mode, encoding='utf-8')
|
return open(filename, mode, encoding='utf-8')
|
||||||
|
|
||||||
|
|
||||||
|
def getSipFiles(names):
|
||||||
|
"""
|
||||||
|
Returns a list of the coresponding .sip files for each of the names in names.
|
||||||
|
"""
|
||||||
|
files = list()
|
||||||
|
for template in ['sip/gen/%s.sip', 'src/%s.sip']:
|
||||||
|
for name in names:
|
||||||
|
name = template % name
|
||||||
|
if os.path.exists(name):
|
||||||
|
files.append(name)
|
||||||
|
return files
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user