Merge lp:~jameinel/bzr/2.1-remove-win32-build into lp:bzr

Proposed by John A Meinel
Status: Work in progress
Proposed branch: lp:~jameinel/bzr/2.1-remove-win32-build
Merge into: lp:bzr
Diff against target: 872 lines
7 files modified
Makefile (+0/-80)
tools/win32/bootstrap.py (+0/-77)
tools/win32/build_release.py (+0/-207)
tools/win32/buildout-templates/bin/build-installer.bat.in (+0/-108)
tools/win32/buildout.cfg (+0/-197)
tools/win32/ostools.py (+0/-138)
tools/win32/run_script.py (+0/-16)
To merge this branch: bzr merge lp:~jameinel/bzr/2.1-remove-win32-build
Reviewer Review Type Date Requested Status
Ian Clatworthy Approve
Vincent Ladeuil Approve
Review via email: mp+13848@code.launchpad.net
To post a comment you must log in.
Revision history for this message
John A Meinel (jameinel) wrote :

This removes some of the win32 build cruft from the bzr codebase. Unfortunately I cannot (yet) remove all of it, because a decent portion of the build process still uses the code from here. (Namely we run 'iscc bzr.iss' on the file from the bzr source, rather than using that file from bzr-windows-installers. This should get fixed.

In the short term, this at least is a small reduction in random stuff in the bzr codebase. It also helps force the bzr-windows-installers project not to expect to find certain files in the bzr code, rather than looking in the installers code.

Revision history for this message
Ian Clatworthy (ian-clatworthy) wrote :

My understanding is that win32/ostools.py can't be deleted. Please check with bialix for the reasons.

Otherwise, this all looks ok to me.

review: Needs Fixing
Revision history for this message
John A Meinel (jameinel) wrote :

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Ian Clatworthy wrote:
> Review: Needs Fixing
> My understanding is that win32/ostools.py can't be deleted. Please check with bialix for the reasons.
>
> Otherwise, this all looks ok to me.

I did grep around for it, as I originally wanted to remove *everything*
in that directory.

I see 'ostools.py' used in Makefile and build-installer.bat.in

Both of which should be using the bzr-windows-installers code.

Are you thinking that there is a 3rd-party code out there that is going
to be using our 'ostools.py' file?

(Like scmproj, qbzr, etc.)

John
=:->

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkrlnE8ACgkQJdeBCYSNAAP95QCfdbVMCpvisBtqigvNRCUtyZTN
A2kAoNWvmtfl8wagJI0dPPSCyVdRuupH
=LMk3
-----END PGP SIGNATURE-----

Revision history for this message
Vincent Ladeuil (vila) wrote :

hmm a patch with only red lines, lovely.

Isn't there some lines you can also delete in setup.py or is it premature ?

review: Approve
Revision history for this message
Ian Clatworthy (ian-clatworthy) wrote :

> I did grep around for it, as I originally wanted to remove *everything*
> in that directory.

I'm all for that.

> I see 'ostools.py' used in Makefile and build-installer.bat.in

I can't remember why bialix warned me against removing that file. I suspect it was related to usage in the Makefile. He hasn't been on IRC today when I've been there. I'll email him now about it.

Revision history for this message
John A Meinel (jameinel) wrote :

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Vincent Ladeuil wrote:
> Review: Approve
> hmm a patch with only red lines, lovely.
>
> Isn't there some lines you can also delete in setup.py or is it premature ?

We still use setup.py from the bzr version (not from
bzr-windows-installers) I would love to change that, but we are a ways
away still...

John
=:->

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkrm+AgACgkQJdeBCYSNAANVrwCghQ5hf0jRnUd7jTy8cFstt3Nd
RlQAoJc33MwgFNLEqOgvmM5A5ghKIMGE
=OTaj
-----END PGP SIGNATURE-----

Revision history for this message
Alexander Belchenko (bialix) wrote :

> This removes some of the win32 build cruft from the bzr codebase.
> Unfortunately I cannot (yet) remove all of it, because a decent portion of the
> build process still uses the code from here. (Namely we run 'iscc bzr.iss' on
> the file from the bzr source, rather than using that file from bzr-windows-
> installers. This should get fixed.

It's not quite true. When installer is building the actual bzr.iss.cog file copied from bzr-windows-installers codebase. Then bzr.iss.cog converted to bzr.iss with cog.py utility.

Revision history for this message
John A Meinel (jameinel) wrote :

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Alexander Belchenko wrote:
>> This removes some of the win32 build cruft from the bzr codebase.
>> Unfortunately I cannot (yet) remove all of it, because a decent portion of the
>> build process still uses the code from here. (Namely we run 'iscc bzr.iss' on
>> the file from the bzr source, rather than using that file from bzr-windows-
>> installers. This should get fixed.
>
> It's not quite true. When installer is building the actual bzr.iss.cog file copied from bzr-windows-installers codebase. Then bzr.iss.cog converted to bzr.iss with cog.py utility.
>

That is good to hear. Though I know I've run into problems in the past
with the installer looking in the wrong place for files. However, the
more we push on this the better we'll get. :)

I'd really like to overhaul most of the build process, though I don't
think I'll get to that soon.

John
=:->

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkrm/8oACgkQJdeBCYSNAAPvaQCdGTQ6JFdcqNdhycl24vDxvKps
qmcAn0HJc9BV+DRj3TqhdKEstWE83BsZ
=tzX+
-----END PGP SIGNATURE-----

Revision history for this message
Alexander Belchenko (bialix) wrote :

John, Ian.

I can't say for sure does ostools.py still used by windows-installer process, but I found next lines in build-installer.bat.in

echo Building the C extensions
cd %TARGET%
%PYTHON% tools/win32/ostools.py remove bzrlib/*.pyd
%PYTHON% setup.py build_ext -i -f %PYTHON_BUILDFLAGS%
@if %ERRORLEVEL% NEQ 0 (set BUILD_ERROR=%ERRORLEVEL%) & goto End

It seems that at least this line rely on the fact that ostools.py present in bzr.dev codebase.
So if you want to remove ostools.py from bzr.dev I suspect you have to fix installer bat file first.

The snippet above taken from revno 46 of bzr+ssh://bazaar.launchpad.net/~bzr/bzr-windows-installers/trunk/

Vincent, does babune supposed to catch that sort of build errors? Or it unable to build installer from bzr.dev?

Revision history for this message
Vincent Ladeuil (vila) wrote :

>>>>> "bialix" == Alexander Belchenko <email address hidden> writes:

<snip/>

    bialix> Vincent, does babune supposed to catch that sort of
    bialix> build errors? Or it unable to build installer from
    bialix> bzr.dev?

babune fails to build from bzr.dev from around the time
bzr-windows-installer was started :-/

That is, since bzr.dev is not maintained for the windows
installers anymore, the builds fail, but I understand that to be
expected.

Revision history for this message
Ian Clatworthy (ian-clatworthy) wrote :

Vincent Ladeuil wrote:

> babune fails to build from bzr.dev from around the time
> bzr-windows-installer was started :-/
>
> That is, since bzr.dev is not maintained for the windows
> installers anymore, the builds fail, but I understand that to be
> expected.

Vila,

Can babune be changed to build the windows installer from
bzr-windows-installers please?

Ian C.

Revision history for this message
Vincent Ladeuil (vila) wrote :

>>>>> "Ian" == Ian Clatworthy <email address hidden> writes:

    Ian> Vincent Ladeuil wrote:
    >> babune fails to build from bzr.dev from around the time
    >> bzr-windows-installer was started :-/
    >>
    >> That is, since bzr.dev is not maintained for the windows
    >> installers anymore, the builds fail, but I understand that to be
    >> expected.

    Ian> Vila,

    Ian> Can babune be changed to build the windows installer from
    Ian> bzr-windows-installers please?

Patches welcome !

Or at the minimum tell me what need to be installed on the
master, on the slave and what need to be run on the slave.

Revision history for this message
John A Meinel (jameinel) wrote :

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Vincent Ladeuil wrote:
>>>>>> "Ian" == Ian Clatworthy <email address hidden> writes:
>
> Ian> Vincent Ladeuil wrote:
> >> babune fails to build from bzr.dev from around the time
> >> bzr-windows-installer was started :-/
> >>
> >> That is, since bzr.dev is not maintained for the windows
> >> installers anymore, the builds fail, but I understand that to be
> >> expected.
>
> Ian> Vila,
>
> Ian> Can babune be changed to build the windows installer from
> Ian> bzr-windows-installers please?
>
> Patches welcome !
>
> Or at the minimum tell me what need to be installed on the
> master, on the slave and what need to be run on the slave.

Generally,

bzr branch lp:bzr-windows-installers
cd bzr-windows-installers

make PYTHON=/cygdrive/c/Python25/python

If we want to test the 2.0 series it would be

bzr branch lp:~bzr/bzr-windows-installers/2.0
...

I *think* I've managed to set those up so that automatic updating works.
(Basically by deleting all of the branches before updating, so make sure
you have a shared repo set up. :)

John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkroSWAACgkQJdeBCYSNAAPZyACgjnFJ/gfEANED02Dp5zR9dcQu
lWQAoLTljvCqWjDJ+8ubUGJLrTTA7D6Z
=OGpu
-----END PGP SIGNATURE-----

Revision history for this message
Ian Clatworthy (ian-clatworthy) wrote :

Let's land this. If there's some fallout in bzr-windows-installers say, we can deal with that shortly. Either way, it's the right thing to do to clean this up.

review: Approve
Revision history for this message
Robert Collins (lifeless) wrote :

John, when you get back... this is ready to land according to the reviews.

Revision history for this message
Vincent Ladeuil (vila) wrote :

Johh, unless you object, I'll land this tomorrow.

Revision history for this message
John A Meinel (jameinel) wrote :

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Vincent Ladeuil wrote:
> Johh, unless you object, I'll land this tomorrow.

I expect this to cause a fair amount of build code fallout. So I want it
to land, but I've sort of been putting it off until I have time to make
sure to get build working.

That said, if we just do it, I'll put build as a priority, so either way. :)

John
=:->

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAksdWmkACgkQJdeBCYSNAAPVrwCeLHPsZlOWQz6rLzo/F+eyTmAm
Vd4AoI2+fJLRp5cx8Yw886U6s41bwsSc
=cKZw
-----END PGP SIGNATURE-----

Revision history for this message
Vincent Ladeuil (vila) wrote :

Right, I don't want to force your schedule, so I'll put the proposal back into Work In Progress.
Of course you retain the moral right to land it when you see fit :-D

Unmerged revisions

4766. By John A Meinel

Remove some of the build dependencies from the bzr source tree.

Note that the build process still uses *some* files from the bzr source.
Which is bad (IMO), but the way it is until we get a real overhaul and cleanup.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'Makefile'
--- Makefile 2009-10-13 15:05:13 +0000
+++ Makefile 2009-10-23 15:15:43 +0000
@@ -21,11 +21,6 @@
21### Core Stuff ###21### Core Stuff ###
2222
23PYTHON=python23PYTHON=python
24PYTHON24=python24
25PYTHON25=python25
26PYTHON26=python26
27BZR_TARGET=release
28PLUGIN_TARGET=plugin-release
29PYTHON_BUILDFLAGS=24PYTHON_BUILDFLAGS=
3025
31.PHONY: all clean extensions pyflakes api-docs check-nodocs check26.PHONY: all clean extensions pyflakes api-docs check-nodocs check
@@ -317,81 +312,6 @@
317 @echo Generating $@312 @echo Generating $@
318 @dot -Tpng $< -o$@ || echo "Dot not installed; skipping generation of $@"313 @dot -Tpng $< -o$@ || echo "Dot not installed; skipping generation of $@"
319314
320
321### Windows Support ###
322
323# make all the installers completely from scratch, using zc.buildout
324# to fetch the dependencies
325# These are files that need to be copied into the build location to boostrap
326# the build process.
327# Note that the path is relative to tools/win32
328BUILDOUT_FILES := buildout.cfg \
329 buildout-templates/bin/build-installer.bat.in \
330 ostools.py bootstrap.py
331
332installer-all:
333 @echo Make all the installers from scratch
334 @# Build everything in a separate directory, to avoid cluttering the WT
335 $(PYTHON) tools/win32/ostools.py makedir build-win32
336 @# cd to tools/win32 so that the relative paths are copied correctly
337 cd tools/win32 && $(PYTHON) ostools.py copytree $(BUILDOUT_FILES) ../../build-win32
338 @# There seems to be a bug in gf.release.bzr, It doesn't correctly update
339 @# existing release directories, so delete them manually before building
340 @# It means things may be rebuilt that don't need to be, but at least
341 @# it will be correct when they do.
342 cd build-win32 && $(PYTHON) ostools.py remove release */release
343 cd build-win32 && $(PYTHON) bootstrap.py
344 cd build-win32 && bin/buildout
345 cd build-win32 && bin/build-installer.bat $(BZR_TARGET) $(PLUGIN_TARGET)
346
347
348clean-installer-all:
349 $(PYTHON) tools/win32/ostools.py remove build-win32
350
351# make bzr.exe for win32 with py2exe
352exe:
353 @echo *** Make bzr.exe
354 $(PYTHON) tools/win32/ostools.py remove bzrlib/*.pyd
355 $(PYTHON) setup.py build_ext -i -f $(PYTHON_BUILDFLAGS)
356 $(PYTHON) setup.py py2exe > py2exe.log
357 $(PYTHON) tools/win32/ostools.py copytodir tools/win32/start_bzr.bat win32_bzr.exe
358 $(PYTHON) tools/win32/ostools.py copytodir tools/win32/bazaar.url win32_bzr.exe
359
360# win32 installer for bzr.exe
361installer: exe copy-docs
362 @echo *** Make Windows installer
363 $(PYTHON) tools/win32/run_script.py cog.py -d -o tools/win32/bzr.iss tools/win32/bzr.iss.cog
364 iscc /Q tools/win32/bzr.iss
365
366# win32 Python's distutils-based installer
367# require to have Python interpreter installed on win32
368py-inst-24: docs
369 $(PYTHON24) setup.py bdist_wininst --install-script="bzr-win32-bdist-postinstall.py" -d .
370
371py-inst-25: docs
372 $(PYTHON25) setup.py bdist_wininst --install-script="bzr-win32-bdist-postinstall.py" -d .
373
374py-inst-26: docs
375 $(PYTHON26) setup.py bdist_wininst --install-script="bzr-win32-bdist-postinstall.py" -d .
376
377python-installer: py-inst-24 py-inst-25 py-inst-26
378
379
380copy-docs: docs
381 $(PYTHON) tools/win32/ostools.py copytodir README win32_bzr.exe/doc
382 $(PYTHON) tools/win32/ostools.py copytree $(WEB_DOCS) win32_bzr.exe
383
384# clean on win32 all installer-related files and directories
385clean-win32: clean-docs
386 $(PYTHON) tools/win32/ostools.py remove build
387 $(PYTHON) tools/win32/ostools.py remove win32_bzr.exe
388 $(PYTHON) tools/win32/ostools.py remove py2exe.log
389 $(PYTHON) tools/win32/ostools.py remove tools/win32/bzr.iss
390 $(PYTHON) tools/win32/ostools.py remove bzr-setup*.exe
391 $(PYTHON) tools/win32/ostools.py remove bzr-*win32.exe
392 $(PYTHON) tools/win32/ostools.py remove dist
393
394
395### Packaging Targets ###315### Packaging Targets ###
396316
397.PHONY: dist dist-upload-escudero check-dist-tarball317.PHONY: dist dist-upload-escudero check-dist-tarball
398318
=== removed file 'tools/win32/bootstrap.py'
--- tools/win32/bootstrap.py 2009-05-29 14:19:29 +0000
+++ tools/win32/bootstrap.py 1970-01-01 00:00:00 +0000
@@ -1,77 +0,0 @@
1##############################################################################
2#
3# Copyright (c) 2006 Zope Corporation and Contributors.
4# All Rights Reserved.
5#
6# This software is subject to the provisions of the Zope Public License,
7# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
8# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
9# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
10# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
11# FOR A PARTICULAR PURPOSE.
12#
13##############################################################################
14"""Bootstrap a buildout-based project
15
16Simply run this script in a directory containing a buildout.cfg.
17The script accepts buildout command-line options, so you can
18use the -c option to specify an alternate configuration file.
19
20$Id: bootstrap.py 90478 2008-08-27 22:44:46Z georgyberdyshev $
21"""
22
23import os, shutil, sys, tempfile, urllib2
24
25tmpeggs = tempfile.mkdtemp()
26
27is_jython = sys.platform.startswith('java')
28
29try:
30 import pkg_resources
31except ImportError:
32 ez = {}
33 exec urllib2.urlopen('http://peak.telecommunity.com/dist/ez_setup.py'
34 ).read() in ez
35 ez['use_setuptools'](to_dir=tmpeggs, download_delay=0)
36
37 import pkg_resources
38
39if sys.platform == 'win32':
40 def quote(c):
41 if ' ' in c:
42 return '"%s"' % c # work around spawn lamosity on windows
43 else:
44 return c
45else:
46 def quote (c):
47 return c
48
49cmd = 'from setuptools.command.easy_install import main; main()'
50ws = pkg_resources.working_set
51
52if is_jython:
53 import subprocess
54
55 assert subprocess.Popen([sys.executable] + ['-c', quote(cmd), '-mqNxd',
56 quote(tmpeggs), 'zc.buildout'],
57 env=dict(os.environ,
58 PYTHONPATH=
59 ws.find(pkg_resources.Requirement.parse('setuptools')).location
60 ),
61 ).wait() == 0
62
63else:
64 assert os.spawnle(
65 os.P_WAIT, sys.executable, quote (sys.executable),
66 '-c', quote (cmd), '-mqNxd', quote (tmpeggs), 'zc.buildout',
67 dict(os.environ,
68 PYTHONPATH=
69 ws.find(pkg_resources.Requirement.parse('setuptools')).location
70 ),
71 ) == 0
72
73ws.add_entry(tmpeggs)
74ws.require('zc.buildout')
75import zc.buildout.buildout
76zc.buildout.buildout.main(sys.argv[1:] + ['bootstrap'])
77shutil.rmtree(tmpeggs)
780
=== removed file 'tools/win32/build_release.py'
--- tools/win32/build_release.py 2009-07-31 19:09:31 +0000
+++ tools/win32/build_release.py 1970-01-01 00:00:00 +0000
@@ -1,207 +0,0 @@
1#!/cygdrive/C/Python25/python
2"""A script to help automate the build process."""
3
4# When preparing a new release, make sure to set all of these to the latest
5# values.
6VERSIONS = {
7 'bzr': '1.17',
8 'qbzr': '0.12',
9 'bzrtools': '1.17.0',
10 'bzr-svn': '0.6.3',
11 'bzr-rewrite': '0.5.2',
12 'subvertpy': '0.6.8',
13}
14
15# This will be passed to 'make' to ensure we build with the right python
16PYTHON='/cygdrive/c/Python25/python'
17
18# Create the final build in this directory
19TARGET_ROOT='release'
20
21DEBUG_SUBPROCESS = True
22
23
24import os
25import shutil
26import subprocess
27import sys
28
29
30BZR_EXE = None
31def bzr():
32 global BZR_EXE
33 if BZR_EXE is not None:
34 return BZR_EXE
35 try:
36 subprocess.call(['bzr', '--version'], stdout=subprocess.PIPE,
37 stderr=subprocess.PIPE)
38 BZR_EXE = 'bzr'
39 except OSError:
40 try:
41 subprocess.call(['bzr.bat', '--version'], stdout=subprocess.PIPE,
42 stderr=subprocess.PIPE)
43 BZR_EXE = 'bzr.bat'
44 except OSError:
45 raise RuntimeError('Could not find bzr or bzr.bat on your path.')
46 return BZR_EXE
47
48
49def call_or_fail(*args, **kwargs):
50 """Call a subprocess, and fail if the return code is not 0."""
51 if DEBUG_SUBPROCESS:
52 print ' calling: "%s"' % (' '.join(args[0]),)
53 p = subprocess.Popen(*args, **kwargs)
54 (out, err) = p.communicate()
55 if p.returncode != 0:
56 raise RuntimeError('Failed to run: %s, %s' % (args, kwargs))
57 return out
58
59
60TARGET = None
61def get_target():
62 global TARGET
63 if TARGET is not None:
64 return TARGET
65 out = call_or_fail([sys.executable, get_bzr_dir() + '/bzr',
66 'version', '--short'], stdout=subprocess.PIPE)
67 version = out.strip()
68 TARGET = os.path.abspath(TARGET_ROOT + '-' + version)
69 return TARGET
70
71
72def clean_target():
73 """Nuke the target directory so we know we are starting from scratch."""
74 target = get_target()
75 if os.path.isdir(target):
76 print "Deleting: %s" % (target,)
77 shutil.rmtree(target)
78
79def get_bzr_dir():
80 return 'bzr.' + VERSIONS['bzr']
81
82
83def update_bzr():
84 """Make sure we have the latest bzr in play."""
85 bzr_dir = get_bzr_dir()
86 if not os.path.isdir(bzr_dir):
87 bzr_version = VERSIONS['bzr']
88 # bzr_url = 'http://bazaar-vcs.org/bzr/bzr.' + bzr_version
89 bzr_url = 'lp:bzr/' + bzr_version
90 print "Getting bzr release %s from %s" % (bzr_version, bzr_url)
91 call_or_fail([bzr(), 'co', bzr_url, bzr_dir])
92 else:
93 print "Ensuring %s is up-to-date" % (bzr_dir,)
94 call_or_fail([bzr(), 'update', bzr_dir])
95
96
97def create_target():
98 target = get_target()
99 print "Creating target dir: %s" % (target,)
100 call_or_fail([bzr(), 'co', get_bzr_dir(), target])
101
102
103def get_plugin_trunk_dir(plugin_name):
104 return '%s/trunk' % (plugin_name,)
105
106
107def get_plugin_release_dir(plugin_name):
108 return '%s/%s' % (plugin_name, VERSIONS[plugin_name])
109
110
111def get_plugin_trunk_branch(plugin_name):
112 return 'lp:%s' % (plugin_name,)
113
114
115def update_plugin_trunk(plugin_name):
116 trunk_dir = get_plugin_trunk_dir(plugin_name)
117 if not os.path.isdir(trunk_dir):
118 plugin_trunk = get_plugin_trunk_branch(plugin_name)
119 print "Getting latest %s trunk" % (plugin_name,)
120 call_or_fail([bzr(), 'co', plugin_trunk,
121 trunk_dir])
122 else:
123 print "Ensuring %s is up-to-date" % (trunk_dir,)
124 call_or_fail([bzr(), 'update', trunk_dir])
125 return trunk_dir
126
127
128def _plugin_tag_name(plugin_name):
129 if plugin_name in ('bzr-svn', 'bzr-rewrite', 'subvertpy'):
130 return '%s-%s' % (plugin_name, VERSIONS[plugin_name])
131 # bzrtools and qbzr use 'release-X.Y.Z'
132 return 'release-' + VERSIONS[plugin_name]
133
134
135def update_plugin(plugin_name):
136 release_dir = get_plugin_release_dir(plugin_name)
137 if not os.path.isdir(plugin_name):
138 if plugin_name in ('bzr-svn', 'bzr-rewrite'):
139 # bzr-svn uses a different repo format
140 call_or_fail([bzr(), 'init-repo', '--rich-root-pack', plugin_name])
141 else:
142 os.mkdir(plugin_name)
143 if os.path.isdir(release_dir):
144 print "Removing existing dir: %s" % (release_dir,)
145 shutil.rmtree(release_dir)
146 # First update trunk
147 trunk_dir = update_plugin_trunk(plugin_name)
148 # Now create the tagged directory
149 tag_name = _plugin_tag_name(plugin_name)
150 print "Creating the branch %s" % (release_dir,)
151 call_or_fail([bzr(), 'co', '-rtag:%s' % (tag_name,),
152 trunk_dir, release_dir])
153 return release_dir
154
155
156def install_plugin(plugin_name):
157 release_dir = update_plugin(plugin_name)
158 # at least bzrtools doesn't like you to call 'setup.py' unless you are in
159 # that directory specifically, so we cd, rather than calling it from
160 # outside
161 print "Installing %s" % (release_dir,)
162 call_or_fail([sys.executable, 'setup.py', 'install', '-O1',
163 '--install-lib=%s' % (get_target(),)],
164 cwd=release_dir)
165
166
167def update_tbzr():
168 tbzr_loc = os.environ.get('TBZR', None)
169 if tbzr_loc is None:
170 raise ValueError('You must set TBZR to the location of tortoisebzr.')
171 print 'Updating %s' % (tbzr_loc,)
172 call_or_fail([bzr(), 'update', tbzr_loc])
173
174
175def build_installer():
176 target = get_target()
177 print
178 print
179 print '*' * 60
180 print 'Building standalone installer'
181 call_or_fail(['make', 'PYTHON=%s' % (PYTHON,), 'installer'],
182 cwd=target)
183
184
185def main(args):
186 import optparse
187
188 p = optparse.OptionParser(usage='%prog [OPTIONS]')
189 opts, args = p.parse_args(args)
190
191 update_bzr()
192 update_tbzr()
193 clean_target()
194 create_target()
195 install_plugin('subvertpy')
196 install_plugin('bzrtools')
197 install_plugin('qbzr')
198 install_plugin('bzr-svn')
199 install_plugin('bzr-rewrite')
200
201 build_installer()
202
203
204if __name__ == '__main__':
205 main(sys.argv[1:])
206
207# vim: ts=4 sw=4 sts=4 et ai
2080
=== removed directory 'tools/win32/buildout-templates'
=== removed directory 'tools/win32/buildout-templates/bin'
=== removed file 'tools/win32/buildout-templates/bin/build-installer.bat.in'
--- tools/win32/buildout-templates/bin/build-installer.bat.in 2009-08-12 22:03:06 +0000
+++ tools/win32/buildout-templates/bin/build-installer.bat.in 1970-01-01 00:00:00 +0000
@@ -1,108 +0,0 @@
1@echo off
2setlocal
3
4set ROOT=${buildout:directory}
5
6set RELEASE=%ROOT%\release\bzr.${settings:bzr-release}
7set DEV=%ROOT%\dev\bzr.dev
8set TARGET=
9set BZR_TARGET=
10set PLUGIN_TARGET=
11
12set SVN_DEV=${buildout:directory}/${svn-dev:destination}
13set SVN_BDB=${buildout:directory}/${svn-db4:destination}
14set SVN_LIBINTL=${buildout:directory}/${svn-libintl:destination}
15set TBZR=${buildout:directory}/tbzr/trunk
16set INSTALLERS=%ROOT%\installers
17set PYTHON=${buildout:executable}
18
19set ORIGINAL_PYTHONPATH=%PYTHONPATH%
20set ORIGINAL_DIRECTORY=%CD%
21
22set BUILD_ERROR=0
23
24set TORTOISE_OVERLAYS_MSI_WIN32_CMD=%PYTHON% %ROOT%/ostools.py basename ${settings:tortoise-overlays-win32-url}
25FOR /f "tokens=1 delims= " %%G IN ('%TORTOISE_OVERLAYS_MSI_WIN32_CMD%') DO set BASENAME=%%G
26set TORTOISE_OVERLAYS_MSI_WIN32=${buildout:directory}/tortoise-overlays/%BASENAME%
27
28set TORTOISE_OVERLAYS_MSI_X64_CMD=%PYTHON% %ROOT%/ostools.py basename ${settings:tortoise-overlays-x64-url}
29FOR /f "tokens=1 delims= " %%G IN ('%TORTOISE_OVERLAYS_MSI_X64_CMD%') DO set BASENAME=%%G
30set TORTOISE_OVERLAYS_MSI_X64=${buildout:directory}/tortoise-overlays/%BASENAME%
31
32FOR /f "tokens=1 delims= " %%G IN ('cygpath %PYTHON%') DO set CYG_PYTHON=%%G
33
34:ARGS
35if "%1"=="release" (set TARGET=%RELEASE%) & (set BZR_TARGET=release) & shift & goto ARGS
36if "%1"=="dev" (set TARGET=%DEV%) & (set BZR_TARGET=trunk) & shift & goto ARGS
37if "%1"=="plugin-release" (set PLUGIN_TARGET=release) & shift & goto ARGS
38if "%1"=="plugin-dev" (set PLUGIN_TARGET=trunk) & shift & goto ARGS
39
40if not defined TARGET (set TARGET=%RELEASE%) & (set BZR_TARGET=release)
41if not defined PLUGIN_TARGET (set PLUGIN_TARGET=release)
42
43%PYTHON% %ROOT%/ostools.py remove %TARGET%
44@if %ERRORLEVEL% NEQ 0 (set BUILD_ERROR=%ERRORLEVEL%) & goto End
45
46%PYTHON% %ROOT%/ostools.py makedir %TARGET%
47@if %ERRORLEVEL% NEQ 0 (set BUILD_ERROR=%ERRORLEVEL%) & goto End
48
49%PYTHON% %ROOT%/ostools.py makedir %INSTALLERS%
50@if %ERRORLEVEL% NEQ 0 (set BUILD_ERROR=%ERRORLEVEL%) & goto End
51
52rem Use %COMSPEC% /c in case bzr is actually a .bat file
53%COMSPEC% /c bzr co %ROOT%/bzr/%BZR_TARGET% %TARGET%
54@if %ERRORLEVEL% NEQ 0 (set BUILD_ERROR=%ERRORLEVEL%) & goto End
55
56rem Build the python installers first, because we don't want to
57rem include any of the 3rd-party plugins, because we don't bundle
58rem their dependencies.
59cd %TARGET%
60
61rem This is slightly redundant with 'make installer-all'
62rem except in that case we have to do cygwin path translations for all the
63rem different versions of python
64${settings:python24} setup.py bdist_wininst --install-script="bzr-win32-bdist-postinstall.py" -d .
65@if %ERRORLEVEL% NEQ 0 (set BUILD_ERROR=%ERRORLEVEL%) & goto End
66
67${settings:python25} setup.py bdist_wininst --install-script="bzr-win32-bdist-postinstall.py" -d .
68@if %ERRORLEVEL% NEQ 0 (set BUILD_ERROR=%ERRORLEVEL%) & goto End
69
70${settings:python26} setup.py bdist_wininst --install-script="bzr-win32-bdist-postinstall.py" -d .
71@if %ERRORLEVEL% NEQ 0 (set BUILD_ERROR=%ERRORLEVEL%) & goto End
72
73cd %ROOT%/subvertpy/%PLUGIN_TARGET%
74%PYTHON% setup.py install -O1 --install-lib=%TARGET%
75@if %ERRORLEVEL% NEQ 0 (set BUILD_ERROR=%ERRORLEVEL%) & goto End
76
77cd %ROOT%/bzrtools/%PLUGIN_TARGET%
78%PYTHON% setup.py install -O1 --install-lib=%TARGET%
79@if %ERRORLEVEL% NEQ 0 (set BUILD_ERROR=%ERRORLEVEL%) & goto End
80
81cd %ROOT%/qbzr/%PLUGIN_TARGET%
82%PYTHON% setup.py install -O1 --install-lib=%TARGET%
83@if %ERRORLEVEL% NEQ 0 (set BUILD_ERROR=%ERRORLEVEL%) & goto End
84
85cd %ROOT%/bzr-svn/%PLUGIN_TARGET%
86%PYTHON% setup.py install -O1 --install-lib=%TARGET%
87@if %ERRORLEVEL% NEQ 0 (set BUILD_ERROR=%ERRORLEVEL%) & goto End
88
89cd %ROOT%/bzr-rewrite/%PLUGIN_TARGET%
90%PYTHON% setup.py install -O1 --install-lib=%TARGET%
91@if %ERRORLEVEL% NEQ 0 (set BUILD_ERROR=%ERRORLEVEL%) & goto End
92
93set PYTHONPATH=%PYTHONPATH%;%TARGET%
94cd %ROOT%/tbzr/trunk
95%PYTHON% setup.py build
96@if %ERRORLEVEL% NEQ 0 (set BUILD_ERROR=%ERRORLEVEL%) & goto End
97
98cd %TARGET%
99make installer PYTHON=%CYG_PYTHON%
100@if %ERRORLEVEL% NEQ 0 (set BUILD_ERROR=%ERRORLEVEL%) & goto End
101
102%PYTHON% %ROOT%/ostools.py copytodir %TARGET%/bzr*.exe %INSTALLERS%
103@if %ERRORLEVEL% NEQ 0 (set BUILD_ERROR=%ERRORLEVEL%) & goto End
104
105:End
106set PYTHONPATH=%ORIGINAL_PYTHONPATH%
107cd %ORIGINAL_DIRECTORY%
108exit /b %BUILD_ERROR%
1090
=== removed file 'tools/win32/buildout.cfg'
--- tools/win32/buildout.cfg 2009-08-20 09:30:34 +0000
+++ tools/win32/buildout.cfg 1970-01-01 00:00:00 +0000
@@ -1,197 +0,0 @@
1[buildout]
2newest = false
3versions = versions
4parts =
5 svn-lib
6 svn-dev
7 svn-db4
8 svn-libintl
9 zlib
10 tortoise-overlays-win32
11 tortoise-overlays-x64
12
13 bzr
14 qbzr
15 tbzr
16 bzrtools
17 bzr-svn
18 bzr-rewrite
19 subvertpy
20 templates
21
22develop =
23
24[versions]
25zc.buildout = 1.2.1
26setuptools = 0.6c9
27z3c.recipe.filetemplate = 2.0.3
28gf.recipe.bzr = 1.0rc8
29
30[settings]
31python24=c:\Python24\python.exe
32python25=c:\Python25\python.exe
33python26=c:\Python26\python.exe
34download-ignore-existing = false
35svn-dev-url =
36 http://subversion.tigris.org/files/documents/15/45228/svn-win32-1.5.6_dev.zip
37svn-lib-url =
38 http://subversion.tigris.org/files/documents/15/45222/svn-win32-1.5.6.zip
39svn-db4-url =
40 http://subversion.tigris.org/files/documents/15/32472/db-4.4.20-win32.zip
41svn-libintl-url =
42 http://subversion.tigris.org/files/documents/15/20739/svn-win32-libintl.zip
43tortoise-overlays-win32-url = http://guest:password@tortoisesvn.tigris.org/svn/tortoisesvn/TortoiseOverlays/version-1.0.4/bin/TortoiseOverlays-1.0.4.11886-win32.msi
44tortoise-overlays-x64-url = http://guest:password@tortoisesvn.tigris.org/svn/tortoisesvn/TortoiseOverlays/version-1.0.4/bin/TortoiseOverlays-1.0.4.11886-x64.msi
45zlib-url =
46 http://www.zlib.net/zlib123-dll.zip
47
48bzr-release = 1.18
49# Older releases were @ http://bazaar-vcs.org, new releases are hosted directly
50# on Launchpad
51# bzr-release-url = http://bazaar-vcs.org/bzr/bzr.${settings:bzr-release}
52bzr-release-url = lp:bzr/${settings:bzr-release}
53bzr-trunk-url = http://bazaar-vcs.org/bzr/bzr.dev
54
55bzrtools-release = 1.18.0
56bzrtools-release-tag = tag:release-${settings:bzrtools-release}
57bzrtools-trunk-url = lp:bzrtools
58
59qbzr-release = 0.13.1
60qbzr-release-tag = tag:release-${settings:qbzr-release}
61qbzr-trunk-url = lp:qbzr
62
63tbzr-release = 0.1.0
64tbzr-release-tag = tag:release-${settings:tbzr-release}
65tbzr-trunk-url = lp:tortoisebzr
66
67bzr-svn-release = 0.6.4
68bzr-svn-release-tag = tag:bzr-svn-${settings:bzr-svn-release}
69bzr-svn-trunk-url = lp:bzr-svn
70
71# This isn't a typo, as of last release, the branch is lp:bzr-rewrite but the
72# tag is bzr-rebase-0.5.3
73bzr-rewrite-release = 0.5.3
74bzr-rewrite-release-tag = tag:bzr-rebase-${settings:bzr-rewrite-release}
75bzr-rewrite-trunk-url = lp:bzr-rewrite
76
77subvertpy-release = 0.6.8
78subvertpy-release-tag = tag:subvertpy-${settings:subvertpy-release}
79subvertpy-trunk-url = lp:subvertpy
80
81[templates]
82recipe = z3c.recipe.filetemplate
83source-directory = buildout-templates
84
85[svn-lib]
86recipe = hexagonit.recipe.download
87url = ${settings:svn-lib-url}
88ignore-existing = ${settings:download-ignore-existing}
89strip-top-level-dir = true
90destination = svn
91
92# This package needs to be extracted on top of svn-lib above, so we
93# explicitly set it to ignore existing here.
94[svn-dev]
95recipe = hexagonit.recipe.download
96url = ${settings:svn-dev-url}
97ignore-existing = true
98strip-top-level-dir = true
99destination = svn
100
101[svn-db4]
102recipe = hexagonit.recipe.download
103url = ${settings:svn-db4-url}
104ignore-existing = ${settings:download-ignore-existing}
105strip-top-level-dir = true
106destination = db4
107
108[svn-libintl]
109recipe = hexagonit.recipe.download
110url = ${settings:svn-libintl-url}
111ignore-existing = ${settings:download-ignore-existing}
112strip-top-level-dir = true
113destination = libintl
114
115[zlib]
116recipe = hexagonit.recipe.download
117url = ${settings:zlib-url}
118ignore-existing = ${settings:download-ignore-existing}
119strip-top-level-dir = false
120destination = zlib
121
122[tortoise-overlays-win32]
123recipe = hexagonit.recipe.download
124url = ${settings:tortoise-overlays-win32-url}
125ignore-existing = ${settings:download-ignore-existing}
126destination = tortoise-overlays
127download-only = true
128
129[tortoise-overlays-x64]
130recipe = hexagonit.recipe.download
131url = ${settings:tortoise-overlays-x64-url}
132ignore-existing = ${settings:download-ignore-existing}
133destination = tortoise-overlays
134download-only = true
135
136[bzr]
137recipe = gf.recipe.bzr:strict
138shared-repo = false
139format = 1.9
140urls =
141 ${settings:bzr-release-url} release
142 ${settings:bzr-trunk-url} trunk
143develop = false
144
145[bzrtools]
146recipe = gf.recipe.bzr:strict
147shared-repo = true
148format = 2a
149urls =
150 ${settings:bzrtools-trunk-url} trunk
151 ${buildout:directory}/bzrtools/trunk@${settings:bzrtools-release-tag} release
152develop = false
153
154[qbzr]
155recipe = gf.recipe.bzr:strict
156shared-repo = true
157format = 1.9
158urls =
159 ${settings:qbzr-trunk-url} trunk
160 ${buildout:directory}/qbzr/trunk@${settings:qbzr-release-tag} release
161develop = false
162
163[tbzr]
164recipe = gf.recipe.bzr:strict
165shared-repo = true
166format = 1.9
167urls =
168 ${settings:tbzr-trunk-url} trunk
169 ${buildout:directory}/tbzr/trunk@${settings:tbzr-release-tag} release
170develop = false
171
172[bzr-svn]
173recipe = gf.recipe.bzr:strict
174shared-repo = true
175format = 2a
176urls =
177 ${settings:bzr-svn-trunk-url} trunk
178 ${buildout:directory}/bzr-svn/trunk@${settings:bzr-svn-release-tag} release
179develop = false
180
181[bzr-rewrite]
182recipe = gf.recipe.bzr:strict
183shared-repo = true
184format = 1.9-rich-root
185urls =
186 ${settings:bzr-rewrite-trunk-url} trunk
187 ${buildout:directory}/bzr-rewrite/trunk@${settings:bzr-rewrite-release-tag} release
188develop = false
189
190[subvertpy]
191recipe = gf.recipe.bzr:strict
192shared-repo = true
193format = 1.9-rich-root
194urls =
195 ${settings:subvertpy-trunk-url} trunk
196 ${buildout:directory}/subvertpy/trunk@${settings:subvertpy-release-tag} release
197develop = false
1980
=== removed file 'tools/win32/ostools.py'
--- tools/win32/ostools.py 2009-07-04 02:30:35 +0000
+++ tools/win32/ostools.py 1970-01-01 00:00:00 +0000
@@ -1,138 +0,0 @@
1#!/usr/bin/python
2
3"""Cross-platform os tools: files/directories manipulations
4Usage:
5
6 ostools.py help
7 prints this help
8
9 ostools.py copytodir FILES... DIR
10 copy files to specified directory
11
12 ostools.py copytree FILES... DIR
13 copy files to specified directory keeping relative paths
14
15 ostools.py remove [FILES...] [DIRS...]
16 remove files or directories (recursive)
17"""
18
19import glob
20import os
21import shutil
22import sys
23
24def makedir(dirname):
25 if not os.path.exists(dirname):
26 os.makedirs(dirname)
27 if not os.path.isdir(dirname):
28 print "Error: Destination is not a directory", dirname
29 return 2
30 return 0
31
32def main(argv=None):
33 if argv is None:
34 argv = sys.argv[1:]
35
36 if not argv:
37 argv = ['help']
38
39 cmd = argv.pop(0)
40
41 if cmd == 'help':
42 print __doc__
43 return 0
44
45 if cmd == 'copytodir':
46 if len(argv) < 2:
47 print "Usage: ostools.py copytodir FILES... DIR"
48 return 1
49
50 todir = argv.pop()
51 retcode = makedir(todir)
52 if retcode:
53 return retcode
54
55 files = []
56 for possible_glob in argv:
57 files += glob.glob(possible_glob)
58
59 for src in files:
60 dest = os.path.join(todir, os.path.basename(src))
61 shutil.copy(src, dest)
62 print "Copied:", src, "=>", dest
63
64 return 0
65
66 if cmd == 'copytree':
67 if len(argv) < 2:
68 print "Usage: ostools.py copytree FILES... DIR"
69 return 1
70
71 todir = argv.pop()
72 retcode = makedir(todir)
73 if retcode:
74 return retcode
75
76 files = []
77 for possible_glob in argv:
78 files += glob.glob(possible_glob)
79
80 for src in files:
81 relative_path = src
82 dest = os.path.join(todir, relative_path)
83 dest_dir = os.path.dirname(dest)
84 retcode = makedir(dest_dir)
85 if retcode:
86 return retcode
87 shutil.copy(src, dest)
88 print "Copied:", src, "=>", dest
89
90 return 0
91
92 if cmd == 'remove':
93 if len(argv) == 0:
94 print "Usage: ostools.py remove [FILES...] [DIRS...]"
95 return 1
96
97 filesdirs = []
98 for possible_glob in argv:
99 filesdirs += glob.glob(possible_glob)
100
101 for i in filesdirs:
102 if os.path.isdir(i):
103 shutil.rmtree(i)
104 print "Removed:", i
105 elif os.path.isfile(i):
106 os.remove(i)
107 print "Removed:", i
108 else:
109 print "Not found:", i
110
111 return 0
112
113 if cmd == "basename":
114 if len(argv) == 0:
115 print "Usage: ostools.py basename [PATH | URL]"
116 return 1
117
118 for path in argv:
119 print os.path.basename(path)
120 return 0
121
122 if cmd == 'makedir':
123 if len(argv) == 0:
124 print "Usage: ostools.py makedir DIR"
125 return 1
126
127 retcode = makedir(argv.pop())
128 if retcode:
129 return retcode
130 return 0
131
132 print "Usage error"
133 print __doc__
134 return 1
135
136
137if __name__ == "__main__":
138 sys.exit(main())
1390
=== removed file 'tools/win32/run_script.py'
--- tools/win32/run_script.py 2008-07-17 00:41:25 +0000
+++ tools/win32/run_script.py 1970-01-01 00:00:00 +0000
@@ -1,16 +0,0 @@
1# A utility that executes a script from our %PYTHON%\Scripts directory.
2# Example usage:
3# 'python run_script.py cog.py arg1 arg2'
4# which will locate %PYTHON_HOME%/Scripts/cog.py and execute it with the args.
5# This is only necessary for Windows, and only when the build process is
6# executed via a cygwin/*nix based make utility, which doesn't honor the
7# PATHEXT environment variable.
8import sys
9import os
10
11if __name__ == '__main__':
12 # clobber me, new sys.argv[0] is the script to run.
13 del sys.argv[0]
14 assert not os.path.isabs(sys.argv[0]), "If you know the FQ path, just use it!"
15 sys.argv[0] = os.path.join(sys.prefix, "Scripts", sys.argv[0])
16 execfile(sys.argv[0])