mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2025-12-16 01:30:07 +01:00
Download the sip binary (if it's not already present) to be used, to ensure that all builds are using the same version.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@69369 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
57
bin/build-sip-msw
Normal file
57
bin/build-sip-msw
Normal file
@@ -0,0 +1,57 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -o errexit
|
||||
#set -o xtrace
|
||||
|
||||
PYVER=2.7
|
||||
case $PYVER in
|
||||
25 | 2.5) VER=25;;
|
||||
26 | 2.6) VER=26;;
|
||||
27 | 2.7) VER=27;;
|
||||
30 | 3.0) VER=30;;
|
||||
esac
|
||||
PYTHON=$TOOLS/Python$VER/python.exe
|
||||
|
||||
if [ ! -x $PYTHON ]; then
|
||||
echo Something is wrong with the Python at $PYTHON
|
||||
exit 1
|
||||
fi
|
||||
|
||||
MYBINDIR=$(dirname $(readlink -f $0))
|
||||
|
||||
cd /c/projects/sip/sip
|
||||
SIPVER=`$PYTHON configure.py --version | grep -v "This is SIP"`
|
||||
|
||||
$PYTHON configure.py \
|
||||
--sip-module wx.siplib \
|
||||
$*
|
||||
|
||||
cd sipgen
|
||||
nmake clean all
|
||||
mv sip.exe $MYBINDIR/sip-$SIPVER-win32.exe
|
||||
cd $MYBINDIR
|
||||
|
||||
echo ""
|
||||
echo "The MD5:"
|
||||
$PYTHON mymd5.py sip-$SIPVER-win32.exe
|
||||
echo ""
|
||||
echo "Now bzip2 the new sip binary and then scp it to "
|
||||
echo " robind@riobu.com:/home/robind/domains/wxpython.org/htdocs/tools"
|
||||
|
||||
|
||||
## Reset the *_RELEASE flags to use debug options so the sip executable
|
||||
## will be built in debug mode too. Using --debug doesn't do that.
|
||||
## These are the defaults:
|
||||
##
|
||||
## myCFLAGS="-O2 -MD"
|
||||
## myLFLAGS="/INCREMENTAL:NO"
|
||||
#myCFLAGS="-Zi -MDd"
|
||||
#myLFLAGS="/DEBUG"
|
||||
#
|
||||
#$PYTHON configure.py \
|
||||
# --debug \
|
||||
# CFLAGS_RELEASE="$myCFLAGS" \
|
||||
# CXXFLAGS_RELEASE="$myCFLAGS" \
|
||||
# LFLAGS_RELEASE="$myLFLAGS" \
|
||||
# $*
|
||||
|
||||
73
bin/build-sip-posix
Executable file
73
bin/build-sip-posix
Executable file
@@ -0,0 +1,73 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -o errexit
|
||||
#set -o xtrace
|
||||
|
||||
PYVER=2.7
|
||||
PYTHON=`which python$PYVER`
|
||||
|
||||
if [ ! -x $PYTHON ]; then
|
||||
echo Something is wrong with the Python at $PYTHON
|
||||
exit 1
|
||||
fi
|
||||
|
||||
MYBINDIR=$(dirname $(readlink -f $0))
|
||||
|
||||
cd /projects/sip/sip
|
||||
SIPVER=`$PYTHON configure.py --version | grep -v "This is SIP"`
|
||||
PLATFORM=`$PYTHON -c "import sys; print sys.platform"`
|
||||
|
||||
if [ "$PLATFORM" = "darwin" ]; then
|
||||
# try to ensure compatiblity back to 10.4
|
||||
$PYTHON configure.py \
|
||||
--universal \
|
||||
--deployment-target=10.4 \
|
||||
--sdk=MacOSX10.4u.sdk \
|
||||
--sip-module wx.siplib \
|
||||
$*
|
||||
|
||||
make -C sipgen CC=gcc-4.0 CXX=g++-4.0 clean all
|
||||
else
|
||||
$PYTHON configure.py \
|
||||
--sip-module wx.siplib \
|
||||
$*
|
||||
|
||||
make -C sipgen clean all
|
||||
fi
|
||||
|
||||
mv sipgen/sip $MYBINDIR/sip-$SIPVER-$PLATFORM
|
||||
cd $MYBINDIR
|
||||
|
||||
echo ""
|
||||
echo "The MD5:"
|
||||
$PYTHON mymd5.py sip-$SIPVER-$PLATFORM
|
||||
echo ""
|
||||
echo "Now bzip2 the new sip binary and then scp it to "
|
||||
echo " robind@riobu.com:/home/robind/domains/wxpython.org/htdocs/tools"
|
||||
|
||||
|
||||
|
||||
# myCFLAGS="-ggdb"
|
||||
# myLFLAGS="-g"
|
||||
|
||||
# --debug \
|
||||
# CFLAGS_RELEASE="$myCFLAGS" \
|
||||
# CXXFLAGS_RELEASE="$myCFLAGS" \
|
||||
# LFLAGS_RELEASE="$myLFLAGS" \
|
||||
|
||||
# --bindir=$HOME/Library/Python/$PYVER/bin \
|
||||
# --incdir=$HOME/Library/Python/$PYVER/include/python$PYVER \
|
||||
# --sipdir=$HOME/Library/Python/$PYVER/share/sip \
|
||||
# --destdir=$HOME/Library/Python/$PYVER/site-packages \
|
||||
|
||||
# # The default build rules for lex and yacc are giving me problems, so
|
||||
# # add some explicit rules to the Makefile that do work.
|
||||
# cat >> sipgen/Makefile <<EOF
|
||||
# parser.c parser.h : parser.y
|
||||
# yacc -d parser.y
|
||||
# mv -f y.tab.c parser.c
|
||||
# mv -f y.tab.h parser.h
|
||||
#
|
||||
# lexer.c : lexer.l
|
||||
# lex -t lexer.l > lexer.c
|
||||
# EOF
|
||||
15
bin/mymd5.py
Normal file
15
bin/mymd5.py
Normal file
@@ -0,0 +1,15 @@
|
||||
import sys
|
||||
import glob
|
||||
import hashlib
|
||||
|
||||
def main():
|
||||
for arg in sys.argv[1:]:
|
||||
for name in glob.glob(arg):
|
||||
m = hashlib.md5()
|
||||
m.update(open(name, 'rb').read())
|
||||
print '%-45s %s' % (name, m.hexdigest())
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
72
build.py
72
build.py
@@ -13,11 +13,14 @@ import shutil
|
||||
import subprocess
|
||||
import optparse
|
||||
import tempfile
|
||||
import urllib2
|
||||
import hashlib
|
||||
|
||||
from distutils.dep_util import newer, newer_group
|
||||
from buildtools.config import Config, msg, opj, posixjoin, loadETG, etg2sip
|
||||
import buildtools.version as version
|
||||
|
||||
# defaults
|
||||
PYVER = '2.7'
|
||||
PYSHORTVER = '27'
|
||||
PYTHON = 'UNKNOWN' # it will be set later
|
||||
@@ -32,6 +35,14 @@ unstable_series = (version.VER_MINOR % 2) == 1 # is the minor version odd or ev
|
||||
isWindows = sys.platform.startswith('win')
|
||||
isDarwin = sys.platform == "darwin"
|
||||
|
||||
sipCurrentVersion = '4.12.5-snapshot-de6a700f5faa'
|
||||
sipCurrentVersionMD5 = {
|
||||
'darwin' : 'fa3b5c21e537be347a39da9f423a8ce7',
|
||||
'win32' : 'c8f5188de8d0e19474912718e91515f0',
|
||||
'linux2' : '950b92de13f0f9e63f48ec1c2d3bf6fb',
|
||||
}
|
||||
toolsURL = 'http://wxpython.org/tools'
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def usage():
|
||||
@@ -322,7 +333,65 @@ def macFixDependencyInstallName(destdir, prefix, extension, buildDir):
|
||||
print cmd
|
||||
os.system(cmd)
|
||||
os.chdir(pwd)
|
||||
|
||||
|
||||
|
||||
def getSipCmd():
|
||||
# Returns the sip command to use, checking for an explicit version and
|
||||
# attempts to download it if it is not found in the bin dir. Validity of
|
||||
# the binary is checked with an MD5 hash.
|
||||
global _sipCmd
|
||||
if os.environ.get('SIP'):
|
||||
# Setting a a value in the environment overrides other options
|
||||
return os.environ.get('SIP')
|
||||
elif _sipCmd is not None:
|
||||
# use the cached value is there is one
|
||||
return _sipCmd
|
||||
else:
|
||||
platform = sys.platform
|
||||
ext = ''
|
||||
if platform == 'win32':
|
||||
ext = '.exe'
|
||||
cmd = opj('bin', 'sip-%s-%s%s' % (sipCurrentVersion, platform, ext))
|
||||
msg('Checking for %s...' % cmd)
|
||||
if os.path.exists(cmd):
|
||||
m = hashlib.md5()
|
||||
m.update(open(cmd, 'rb').read())
|
||||
if m.hexdigest() != sipCurrentVersionMD5[platform]:
|
||||
print 'ERROR: MD5 mismatch, got "%s"' % m.hexdigest()
|
||||
print ' expected "%s"' % sipCurrentVersionMD5[platform]
|
||||
print ' Set SIP in the environment to use a local build of sip instead'
|
||||
sys.exit(1)
|
||||
_sipCmd = cmd
|
||||
return cmd
|
||||
|
||||
msg('Not found. Attempting to download...')
|
||||
url = '%s/sip-%s-%s%s.bz2' % (toolsURL, sipCurrentVersion, platform, ext)
|
||||
try:
|
||||
connection = urllib2.urlopen(url)
|
||||
msg('Connection successful...')
|
||||
data = connection.read()
|
||||
msg('Data downloaded...')
|
||||
except:
|
||||
print "ERROR: Unable to download", url
|
||||
print " Set SIP in the environment to use a local build of sip instead"
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
sys.exit(1)
|
||||
|
||||
import bz2
|
||||
data = bz2.decompress(data)
|
||||
with open(cmd, 'wb') as f:
|
||||
f.write(data)
|
||||
os.chmod(cmd, 0755)
|
||||
return getSipCmd()
|
||||
|
||||
|
||||
# The download and MD5 check only needs to happen once per run, cache the sip
|
||||
# cmd value here the first time through.
|
||||
_sipCmd = None
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Command functions
|
||||
@@ -384,8 +453,9 @@ def sip(options, args):
|
||||
pycode = base.replace('_', '')
|
||||
pycode = posixjoin(cfg.PKGDIR, pycode) + '.py'
|
||||
pycode = '-X pycode'+base+':'+pycode
|
||||
sip = getSipCmd()
|
||||
cmd = '%s %s -c %s -b %s %s %s' % \
|
||||
(cfg.SIP, cfg.SIPOPTS, tmpdir, sbf, pycode, src_name)
|
||||
(sip, cfg.SIPOPTS, tmpdir, sbf, pycode, src_name)
|
||||
runcmd(cmd)
|
||||
|
||||
# Check each file in tmpdir to see if it is different than the same file
|
||||
|
||||
@@ -26,26 +26,11 @@ from distutils.spawn import spawn
|
||||
|
||||
runSilently = False
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# Set some defaults based on the environment or platform
|
||||
|
||||
if os.environ.get('SIP'):
|
||||
SIPdefault = os.environ.get('SIP')
|
||||
elif os.name == 'nt':
|
||||
SIPdefault = 'c:/projects/sip/sip/sipgen/sip.exe'
|
||||
else:
|
||||
path_sip = commands.getoutput("which sip")
|
||||
if os.path.exists(path_sip):
|
||||
SIPdefault = path_sip
|
||||
else:
|
||||
SIPdefault = '/projects/sip/sip/sipgen/sip'
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
class Configuration(object):
|
||||
|
||||
SIP = SIPdefault # Where is the sip binary?
|
||||
##SIP = SIPdefault # Where is the sip binary?
|
||||
SIPINC = 'sip/siplib' # Use our local copy of sip.h
|
||||
SIPGEN = 'sip/gen' # Where the generated .sip files go
|
||||
SIPFILES = 'sip' # where to find other sip files for %Include or %Import
|
||||
|
||||
Reference in New Issue
Block a user