Rev 4532: (igc) zc.buildout Windows build support (Sidnei da Silva) in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Tue Jul 14 09:04:30 BST 2009
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 4532 [merge]
revision-id: pqm at pqm.ubuntu.com-20090714080429-2qoaeztpc0v3eng8
parent: pqm at pqm.ubuntu.com-20090713154012-rk3lz14efflb406z
parent: ian.clatworthy at canonical.com-20090714070415-rt170aixrzx2skq7
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Tue 2009-07-14 09:04:29 +0100
message:
(igc) zc.buildout Windows build support (Sidnei da Silva)
added:
tools/win32/bootstrap.py bootstrap.py-20090529141913-exibop5n69u1vx52-1
tools/win32/buildout-templates/ buildouttemplates-20090605013541-8oqmqjw1he033eoj-1
tools/win32/buildout-templates/bin/ bin-20090605013541-8oqmqjw1he033eoj-2
tools/win32/buildout-templates/bin/build-installer.bat.in buildinstaller.bat.i-20090605013541-8oqmqjw1he033eoj-3
tools/win32/buildout.cfg buildout.cfg-20090529141919-d4paovt3buwxgjpd-1
modified:
Makefile Makefile-20050805140406-d96e3498bb61c5bb
tools/win32/ostools.py ostools.py-20060731163025-npjffm46rgnkl50d-1
=== modified file 'Makefile'
--- a/Makefile 2009-07-13 06:04:28 +0000
+++ b/Makefile 2009-07-14 07:04:15 +0000
@@ -21,6 +21,10 @@
### Core Stuff ###
PYTHON=python
+PYTHON24=python24
+PYTHON25=python25
+BZR_TARGET=release
+PLUGIN_TARGET=plugin-release
PYTHON_BUILDFLAGS=
.PHONY: all clean extensions pyflakes api-docs check-nodocs check
@@ -218,6 +222,33 @@
### Windows Support ###
+# make all the installers completely from scratch, using zc.buildout
+# to fetch the dependencies
+installer-all:
+ @echo *** Make all the installers from scratch
+ cd tools/win32 && $(PYTHON) bootstrap.py
+ cd tools/win32 && bin/buildout
+ cd tools/win32 && bin/build-installer.bat $(BZR_TARGET) $(PLUGIN_TARGET)
+
+
+clean-installer-all:
+ $(PYTHON) tools/win32/ostools.py remove tools/win32/.installed.cfg
+ $(PYTHON) tools/win32/ostools.py remove tools/win32/bin/
+ $(PYTHON) tools/win32/ostools.py remove tools/win32/bzr/
+ $(PYTHON) tools/win32/ostools.py remove tools/win32/bzr-rebase/
+ $(PYTHON) tools/win32/ostools.py remove tools/win32/bzr-svn/
+ $(PYTHON) tools/win32/ostools.py remove tools/win32/bzrtools/
+ $(PYTHON) tools/win32/ostools.py remove tools/win32/db4/
+ $(PYTHON) tools/win32/ostools.py remove tools/win32/develop-eggs/
+ $(PYTHON) tools/win32/ostools.py remove tools/win32/libintl/
+ $(PYTHON) tools/win32/ostools.py remove tools/win32/parts/
+ $(PYTHON) tools/win32/ostools.py remove tools/win32/qbzr/
+ $(PYTHON) tools/win32/ostools.py remove tools/win32/subvertpy/
+ $(PYTHON) tools/win32/ostools.py remove tools/win32/svn/
+ $(PYTHON) tools/win32/ostools.py remove tools/win32/tbzr/
+ $(PYTHON) tools/win32/ostools.py remove tools/win32/tortoise-overlays/
+ $(PYTHON) tools/win32/ostools.py remove tools/win32/zlib/
+
# make bzr.exe for win32 with py2exe
exe:
@echo *** Make bzr.exe
@@ -229,17 +260,17 @@
# win32 installer for bzr.exe
installer: exe copy-docs
- @echo *** Make windows installer
+ @echo *** Make Windows installer
$(PYTHON) tools/win32/run_script.py cog.py -d -o tools/win32/bzr.iss tools/win32/bzr.iss.cog
iscc /Q tools/win32/bzr.iss
# win32 Python's distutils-based installer
# require to have Python interpreter installed on win32
py-inst-24: docs
- python24 setup.py bdist_wininst --install-script="bzr-win32-bdist-postinstall.py" -d .
+ $(PYTHON24) setup.py bdist_wininst --install-script="bzr-win32-bdist-postinstall.py" -d .
py-inst-25: docs
- python25 setup.py bdist_wininst --install-script="bzr-win32-bdist-postinstall.py" -d .
+ $(PYTHON25) setup.py bdist_wininst --install-script="bzr-win32-bdist-postinstall.py" -d .
py-inst-26: docs
python26 setup.py bdist_wininst --install-script="bzr-win32-bdist-postinstall.py" -d .
=== added file 'tools/win32/bootstrap.py'
--- a/tools/win32/bootstrap.py 1970-01-01 00:00:00 +0000
+++ b/tools/win32/bootstrap.py 2009-05-29 14:19:29 +0000
@@ -0,0 +1,77 @@
+##############################################################################
+#
+# Copyright (c) 2006 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""Bootstrap a buildout-based project
+
+Simply run this script in a directory containing a buildout.cfg.
+The script accepts buildout command-line options, so you can
+use the -c option to specify an alternate configuration file.
+
+$Id: bootstrap.py 90478 2008-08-27 22:44:46Z georgyberdyshev $
+"""
+
+import os, shutil, sys, tempfile, urllib2
+
+tmpeggs = tempfile.mkdtemp()
+
+is_jython = sys.platform.startswith('java')
+
+try:
+ import pkg_resources
+except ImportError:
+ ez = {}
+ exec urllib2.urlopen('http://peak.telecommunity.com/dist/ez_setup.py'
+ ).read() in ez
+ ez['use_setuptools'](to_dir=tmpeggs, download_delay=0)
+
+ import pkg_resources
+
+if sys.platform == 'win32':
+ def quote(c):
+ if ' ' in c:
+ return '"%s"' % c # work around spawn lamosity on windows
+ else:
+ return c
+else:
+ def quote (c):
+ return c
+
+cmd = 'from setuptools.command.easy_install import main; main()'
+ws = pkg_resources.working_set
+
+if is_jython:
+ import subprocess
+
+ assert subprocess.Popen([sys.executable] + ['-c', quote(cmd), '-mqNxd',
+ quote(tmpeggs), 'zc.buildout'],
+ env=dict(os.environ,
+ PYTHONPATH=
+ ws.find(pkg_resources.Requirement.parse('setuptools')).location
+ ),
+ ).wait() == 0
+
+else:
+ assert os.spawnle(
+ os.P_WAIT, sys.executable, quote (sys.executable),
+ '-c', quote (cmd), '-mqNxd', quote (tmpeggs), 'zc.buildout',
+ dict(os.environ,
+ PYTHONPATH=
+ ws.find(pkg_resources.Requirement.parse('setuptools')).location
+ ),
+ ) == 0
+
+ws.add_entry(tmpeggs)
+ws.require('zc.buildout')
+import zc.buildout.buildout
+zc.buildout.buildout.main(sys.argv[1:] + ['bootstrap'])
+shutil.rmtree(tmpeggs)
=== added directory 'tools/win32/buildout-templates'
=== added directory 'tools/win32/buildout-templates/bin'
=== added file 'tools/win32/buildout-templates/bin/build-installer.bat.in'
--- a/tools/win32/buildout-templates/bin/build-installer.bat.in 1970-01-01 00:00:00 +0000
+++ b/tools/win32/buildout-templates/bin/build-installer.bat.in 2009-07-04 03:03:46 +0000
@@ -0,0 +1,100 @@
+ at echo off
+setlocal
+
+set ROOT=${buildout:directory}
+
+set RELEASE=%ROOT%\release\bzr.${settings:bzr-release}
+set DEV=%ROOT%\dev\bzr.dev
+set TARGET=
+set BZR_TARGET=
+set PLUGIN_TARGET=
+
+set SVN_DEV=${buildout:directory}/${svn-dev:destination}
+set SVN_BDB=${buildout:directory}/${svn-db4:destination}
+set SVN_LIBINTL=${buildout:directory}/${svn-libintl:destination}
+set TBZR=${buildout:directory}/tbzr/trunk
+set INSTALLERS=%ROOT%\installers
+set PYTHON=${buildout:executable}
+
+set ORIGINAL_PYTHONPATH=%PYTHONPATH%
+set ORIGINAL_DIRECTORY=%CD%
+
+set BUILD_ERROR=0
+
+set TORTOISE_OVERLAYS_MSI_WIN32_CMD=%PYTHON% %ROOT%/ostools.py basename ${settings:tortoise-overlays-win32-url}
+FOR /f "tokens=1 delims= " %%G IN ('%TORTOISE_OVERLAYS_MSI_WIN32_CMD%') DO set BASENAME=%%G
+set TORTOISE_OVERLAYS_MSI_WIN32=${buildout:directory}/tortoise-overlays/%BASENAME%
+
+set TORTOISE_OVERLAYS_MSI_X64_CMD=%PYTHON% %ROOT%/ostools.py basename ${settings:tortoise-overlays-x64-url}
+FOR /f "tokens=1 delims= " %%G IN ('%TORTOISE_OVERLAYS_MSI_X64_CMD%') DO set BASENAME=%%G
+set TORTOISE_OVERLAYS_MSI_X64=${buildout:directory}/tortoise-overlays/%BASENAME%
+
+FOR /f "tokens=1 delims= " %%G IN ('cygpath %PYTHON%') DO set CYG_PYTHON=%%G
+
+:ARGS
+if "%1"=="release" (set TARGET=%RELEASE%) & (set BZR_TARGET=release) & shift & goto ARGS
+if "%1"=="dev" (set TARGET=%DEV%) & (set BZR_TARGET=trunk) & shift & goto ARGS
+if "%1"=="plugin-release" (set PLUGIN_TARGET=release) & shift & goto ARGS
+if "%1"=="plugin-dev" (set PLUGIN_TARGET=trunk) & shift & goto ARGS
+
+if not defined TARGET (set TARGET=%RELEASE%) & (set BZR_TARGET=release)
+if not defined PLUGIN_TARGET (set PLUGIN_TARGET=release)
+
+%PYTHON% %ROOT%/ostools.py remove %TARGET%
+ at if %ERRORLEVEL% NEQ 0 (set BUILD_ERROR=%ERRORLEVEL%) & goto End
+
+%PYTHON% %ROOT%/ostools.py makedir %TARGET%
+ at if %ERRORLEVEL% NEQ 0 (set BUILD_ERROR=%ERRORLEVEL%) & goto End
+
+%PYTHON% %ROOT%/ostools.py makedir %INSTALLERS%
+ at if %ERRORLEVEL% NEQ 0 (set BUILD_ERROR=%ERRORLEVEL%) & goto End
+
+bzr co %ROOT%/bzr/%BZR_TARGET% %TARGET%
+ at if %ERRORLEVEL% NEQ 0 (set BUILD_ERROR=%ERRORLEVEL%) & goto End
+
+cd %ROOT%/subvertpy/%PLUGIN_TARGET%
+%PYTHON% setup.py install -O1 --install-lib=%TARGET%
+ at if %ERRORLEVEL% NEQ 0 (set BUILD_ERROR=%ERRORLEVEL%) & goto End
+
+cd %ROOT%/bzrtools/%PLUGIN_TARGET%
+%PYTHON% setup.py install -O1 --install-lib=%TARGET%
+ at if %ERRORLEVEL% NEQ 0 (set BUILD_ERROR=%ERRORLEVEL%) & goto End
+
+cd %ROOT%/qbzr/%PLUGIN_TARGET%
+%PYTHON% setup.py install -O1 --install-lib=%TARGET%
+ at if %ERRORLEVEL% NEQ 0 (set BUILD_ERROR=%ERRORLEVEL%) & goto End
+
+cd %ROOT%/bzr-svn/%PLUGIN_TARGET%
+%PYTHON% setup.py install -O1 --install-lib=%TARGET%
+ at if %ERRORLEVEL% NEQ 0 (set BUILD_ERROR=%ERRORLEVEL%) & goto End
+
+cd %ROOT%/bzr-rebase/%PLUGIN_TARGET%
+%PYTHON% setup.py install -O1 --install-lib=%TARGET%
+ at if %ERRORLEVEL% NEQ 0 (set BUILD_ERROR=%ERRORLEVEL%) & goto End
+
+set PYTHONPATH=%PYTHONPATH%;%TARGET%
+cd %ROOT%/tbzr/trunk
+%PYTHON% setup.py build
+ at if %ERRORLEVEL% NEQ 0 (set BUILD_ERROR=%ERRORLEVEL%) & goto End
+
+cd %TARGET%
+make installer PYTHON=%CYG_PYTHON%
+ at if %ERRORLEVEL% NEQ 0 (set BUILD_ERROR=%ERRORLEVEL%) & goto End
+
+rem Enable this when this branch is merged.
+rem make python-installer PYTHON24=${settings:python24} PYTHON25=${settings:python25}
+rem @if %ERRORLEVEL% NEQ 0 (set BUILD_ERROR=%ERRORLEVEL%) & goto End
+
+${settings:python24} setup.py bdist_wininst --install-script="bzr-win32-bdist-postinstall.py" -d .
+ at if %ERRORLEVEL% NEQ 0 (set BUILD_ERROR=%ERRORLEVEL%) & goto End
+
+${settings:python25} setup.py bdist_wininst --install-script="bzr-win32-bdist-postinstall.py" -d .
+ at if %ERRORLEVEL% NEQ 0 (set BUILD_ERROR=%ERRORLEVEL%) & goto End
+
+%PYTHON% %ROOT%/ostools.py copytodir %TARGET%/bzr*.exe %INSTALLERS%
+ at if %ERRORLEVEL% NEQ 0 (set BUILD_ERROR=%ERRORLEVEL%) & goto End
+
+:End
+set PYTHONPATH=%ORIGINAL_PYTHONPATH%
+cd %ORIGINAL_DIRECTORY%
+exit /b %BUILD_ERROR%
=== added file 'tools/win32/buildout.cfg'
--- a/tools/win32/buildout.cfg 1970-01-01 00:00:00 +0000
+++ b/tools/win32/buildout.cfg 2009-07-04 02:16:06 +0000
@@ -0,0 +1,191 @@
+[buildout]
+newest = false
+versions = versions
+parts =
+ svn-lib
+ svn-dev
+ svn-db4
+ svn-libintl
+ zlib
+ tortoise-overlays-win32
+ tortoise-overlays-x64
+
+ bzr
+ qbzr
+ tbzr
+ bzrtools
+ bzr-svn
+ bzr-rebase
+ subvertpy
+ templates
+
+develop =
+
+[versions]
+zc.buildout = 1.2.1
+setuptools = 0.6c9
+z3c.recipe.filetemplate = 2.0.3
+gf.recipe.bzr = 1.0rc5
+
+[settings]
+python24=c:\Python24\python.exe
+python25=c:\Python25\python.exe
+download-ignore-existing = false
+svn-dev-url =
+ http://subversion.tigris.org/files/documents/15/45228/svn-win32-1.5.6_dev.zip
+svn-lib-url =
+ http://subversion.tigris.org/files/documents/15/45222/svn-win32-1.5.6.zip
+svn-db4-url =
+ http://subversion.tigris.org/files/documents/15/32472/db-4.4.20-win32.zip
+svn-libintl-url =
+ http://subversion.tigris.org/files/documents/15/20739/svn-win32-libintl.zip
+tortoise-overlays-win32-url = http://guest:password@tortoisesvn.tigris.org/svn/tortoisesvn/TortoiseOverlays/version-1.0.4/bin/TortoiseOverlays-1.0.4.11886-win32.msi
+tortoise-overlays-x64-url = http://guest:password@tortoisesvn.tigris.org/svn/tortoisesvn/TortoiseOverlays/version-1.0.4/bin/TortoiseOverlays-1.0.4.11886-x64.msi
+zlib-url =
+ http://www.zlatkovic.com/pub/libxml/zlib-1.2.3.win32.zip
+
+bzr-release = 1.15
+bzr-release-url = http://bazaar-vcs.org/bzr/bzr.${settings:bzr-release}
+bzr-trunk-url = http://bazaar-vcs.org/bzr/bzr.dev
+
+bzrtools-release = 1.12.0
+bzrtools-release-tag = tag:release-${settings:bzrtools-release}
+bzrtools-trunk-url = lp:bzrtools
+
+qbzr-release = 0.9.8
+qbzr-release-tag = tag:release-${settings:qbzr-release}
+qbzr-trunk-url = lp:qbzr
+
+tbzr-release = 0.1.0
+tbzr-release-tag = tag:release-${settings:tbzr-release}
+tbzr-trunk-url = lp:tortoisebzr
+
+bzr-svn-release = 0.5.2
+bzr-svn-release-tag = tag:bzr-svn-${settings:bzr-svn-release}
+bzr-svn-trunk-url = lp:bzr-svn
+
+bzr-rebase-release = 0.4.4
+bzr-rebase-release-tag = tag:bzr-rebase-${settings:bzr-rebase-release}
+bzr-rebase-trunk-url = lp:bzr-rebase
+
+subvertpy-release = 0.6.4
+subvertpy-release-tag = tag:subvertpy-${settings:subvertpy-release}
+subvertpy-trunk-url = lp:subvertpy
+
+[templates]
+recipe = z3c.recipe.filetemplate
+source-directory = buildout-templates
+
+[svn-lib]
+recipe = hexagonit.recipe.download
+url = ${settings:svn-lib-url}
+ignore-existing = ${settings:download-ignore-existing}
+strip-top-level-dir = true
+destination = svn
+
+# This package needs to be extracted on top of svn-lib above, so we
+# explicitly set it to ignore existing here.
+[svn-dev]
+recipe = hexagonit.recipe.download
+url = ${settings:svn-dev-url}
+ignore-existing = true
+strip-top-level-dir = true
+destination = svn
+
+[svn-db4]
+recipe = hexagonit.recipe.download
+url = ${settings:svn-db4-url}
+ignore-existing = ${settings:download-ignore-existing}
+strip-top-level-dir = true
+destination = db4
+
+[svn-libintl]
+recipe = hexagonit.recipe.download
+url = ${settings:svn-libintl-url}
+ignore-existing = ${settings:download-ignore-existing}
+strip-top-level-dir = true
+destination = libintl
+
+[zlib]
+recipe = hexagonit.recipe.download
+url = ${settings:zlib-url}
+ignore-existing = ${settings:download-ignore-existing}
+strip-top-level-dir = true
+destination = zlib
+
+[tortoise-overlays-win32]
+recipe = hexagonit.recipe.download
+url = ${settings:tortoise-overlays-win32-url}
+ignore-existing = ${settings:download-ignore-existing}
+destination = tortoise-overlays
+download-only = true
+
+[tortoise-overlays-x64]
+recipe = hexagonit.recipe.download
+url = ${settings:tortoise-overlays-x64-url}
+ignore-existing = ${settings:download-ignore-existing}
+destination = tortoise-overlays
+download-only = true
+
+[bzr]
+recipe = gf.recipe.bzr
+shared-repo = false
+format = 1.9
+urls =
+ ${settings:bzr-release-url} release
+ ${settings:bzr-trunk-url} trunk
+develop = false
+
+[bzrtools]
+recipe = gf.recipe.bzr
+shared-repo = true
+format = 1.9-rich-root
+urls =
+ ${settings:bzrtools-trunk-url} trunk
+ ${buildout:directory}/bzrtools/trunk@${settings:bzrtools-release-tag} release
+develop = false
+
+[qbzr]
+recipe = gf.recipe.bzr
+shared-repo = true
+format = 1.9
+urls =
+ ${settings:qbzr-trunk-url} trunk
+ ${buildout:directory}/qbzr/trunk@${settings:qbzr-release-tag} release
+develop = false
+
+[tbzr]
+recipe = gf.recipe.bzr
+shared-repo = true
+format = 1.9
+urls =
+ ${settings:tbzr-trunk-url} trunk
+ ${buildout:directory}/tbzr/trunk@${settings:tbzr-release-tag} release
+develop = false
+
+[bzr-svn]
+recipe = gf.recipe.bzr
+shared-repo = true
+format = 1.9-rich-root
+urls =
+ ${settings:bzr-svn-trunk-url} trunk
+ ${buildout:directory}/bzr-svn/trunk@${settings:bzr-svn-release-tag} release
+develop = false
+
+[bzr-rebase]
+recipe = gf.recipe.bzr
+shared-repo = true
+format = 1.9-rich-root
+urls =
+ ${settings:bzr-rebase-trunk-url} trunk
+ ${buildout:directory}/bzr-rebase/trunk@${settings:bzr-rebase-release-tag} release
+develop = false
+
+[subvertpy]
+recipe = gf.recipe.bzr
+shared-repo = true
+format = 1.9-rich-root
+urls =
+ ${settings:subvertpy-trunk-url} trunk
+ ${buildout:directory}/subvertpy/trunk@${settings:subvertpy-release-tag} release
+develop = false
=== modified file 'tools/win32/ostools.py'
--- a/tools/win32/ostools.py 2007-08-14 02:48:36 +0000
+++ b/tools/win32/ostools.py 2009-07-04 02:30:35 +0000
@@ -21,6 +21,13 @@
import shutil
import sys
+def makedir(dirname):
+ if not os.path.exists(dirname):
+ os.makedirs(dirname)
+ if not os.path.isdir(dirname):
+ print "Error: Destination is not a directory", dirname
+ return 2
+ return 0
def main(argv=None):
if argv is None:
@@ -41,11 +48,9 @@
return 1
todir = argv.pop()
- if not os.path.exists(todir):
- os.makedirs(todir)
- if not os.path.isdir(todir):
- print "Error: Destination is not a directory"
- return 2
+ retcode = makedir(todir)
+ if retcode:
+ return retcode
files = []
for possible_glob in argv:
@@ -64,11 +69,9 @@
return 1
todir = argv.pop()
- if not os.path.exists(todir):
- os.makedirs(todir)
- if not os.path.isdir(todir):
- print "Error: Destination is not a directory"
- return 2
+ retcode = makedir(todir)
+ if retcode:
+ return retcode
files = []
for possible_glob in argv:
@@ -78,8 +81,9 @@
relative_path = src
dest = os.path.join(todir, relative_path)
dest_dir = os.path.dirname(dest)
- if not os.path.isdir(dest_dir):
- os.makedirs(dest_dir)
+ retcode = makedir(dest_dir)
+ if retcode:
+ return retcode
shutil.copy(src, dest)
print "Copied:", src, "=>", dest
@@ -106,6 +110,25 @@
return 0
+ if cmd == "basename":
+ if len(argv) == 0:
+ print "Usage: ostools.py basename [PATH | URL]"
+ return 1
+
+ for path in argv:
+ print os.path.basename(path)
+ return 0
+
+ if cmd == 'makedir':
+ if len(argv) == 0:
+ print "Usage: ostools.py makedir DIR"
+ return 1
+
+ retcode = makedir(argv.pop())
+ if retcode:
+ return retcode
+ return 0
+
print "Usage error"
print __doc__
return 1
More information about the bazaar-commits
mailing list