Bazaar

Bazaar

 




Wiki Tools

  • Find Page
  • Recent Changes
  • Page History
  • Attachments

Win32 Installers for Bazaar

This page is currently out-of-date as the preferred method for building the installers is part of the [[https://launchpad.net/bzr-windows-installers|bzr-windows-installers project]], and dependencies have been updated. We will be putting together new instructions shortly.

1   Instructions how to build bzr.exe and make various installers for distribution

Date:23 July 2008
Author:Alexander Belchenko, updated by Mark Hammond
Verson:for bzr 1.6b3+

1.1   Notes

  1. This document contains instructions for current version of bzr
  2. If you need instruction for previous releases, see history of this page.

1.2   Tortoise

The build process can optionally include TortoiseBZR binaries in the installer (and if so included, the user still has the option whether to install them or not.)

To include Tortoise, you must ensure QBzr is included in the build and set the following environment variables:

  • TBZR to the name of a local directory containing a branch of lp:~tortoisebzr-developers/tortoisebzr/tbzr2-proto

  • TOVMSI_WIN32 to the location of the Tortoise Overlays MSI installer for win32, pulled from the TSVN repository at:

    http://tortoisesvn.tigris.org/svn/tortoisesvn/TortoiseOverlays/
    (use: "guest" and blank password to authenticate)

For more information on TortoiseBZR see https://code.launchpad.net/tortoisebzr

1.3   Making installer

If you have all tools installed on your windows machine then with only one command you can build win32 installer for standalone bzr.exe:

make installer

Also you can do Python-based installer for win32: it's a installer for python sources of bzr that require to users to have Python 2.4/2.5+ installed on their machines:

make python-installer

Please note that actual dependencies for building Python-based installers is lesser than for standalone one.

1.4   What tools you need

Below you see list of required tools to make installer. Version number info is corresponding to versions of tools that was used to make installer for current bzr version.

Of course, first at all you need to have Python interpreter:

1.4.1   Bzr Dependencies

These are specific packages which add functionality for bzr:

NOTE: You also need CA certificates bundle file for SSL support. Download cacert.pem from the cURL site, rename it to curl-ca-bundle.crt, and place in the directory where you make installer, or in any directory listed in PATH environment variable.
NOTE: I strongly recommend 1.7.4 due to a number of bug-fixes and to avoids a dependency on MFC71.dll.
NOTE: Extract zlib123-dll.zip to temporary folder and copy zlib1.dll into C:\Windows\System32
1.4.2   Default Plugins

We ship with the following plugins:

  1. Launchpad - should already be installed as part of bzr.dev
  2. QBzr - see other notes - TBD
  3. svn - install the python SVN binaries from http://pysvn.tigris.org/files/documents/1233/43132/py25-pysvn-svn150-1.6.0-975.exe and the latest copy of the svn plugin
1.4.3   Bzr Win32 Dependencies

Packages strongly recommended for using bzr on win32:

1.4.4   Pyrex/C Extensions compiling

For compiling Pyrex/C extensions in bzr codebase you need:

1.4.5   Bzr Standalone Installer Dependencies

These are only needed to create the bzr installer.

1.4.6   Bzr Python-based Installer dependencies

Strict dependencies:

  1. Python interpreter
  2. GNU Make
  3. Docutils

Optional (but highly recommended) dependencies:

  1. C compiler (MSVC 2003 or Mingw)
  2. Pyrex (0.9.5.1a - 0.9.6.4)

1.5   Tools installation instructions

There is 3 main groups of tools:

  1. Python interpreter, python libraries, python-based utility
  2. GNU Make -- famous make utility
  3. Inno Setup -- powerful setup compiler

Next instructions suitable for Windows 2000/XP and later. Windows 98 has some big differences in some details. I don't use Windows 98 to make installer. But installer itself is able to run on Windows 98.

1.5.1   Installing Python, libraries and python-based tools
1.5.1.1   Installing Python

Run Python installer file. Install Python with default options.

Troubleshooting: If you cannot to run MSI installer file then your machine probably miss instmsiw.exe installer support. Go to the Microsoft's site and download fresh version of instmsiw.exe. Install it on your machine and repeat Python installation.

1.5.1.2   Setup the PATH environment variable

You need to add Python installation directory and Python Scripts directory to the PATH environment variable. The following instructions assume you installed Python to the default location: C:\Python25

  1. Open command shell window: Start -> Run -> Type 'cmd' and hit Return.
  2. Adjust the path by executing the command set PATH=c:\Python25;%PATH%

Check the path works as expected - rrun python interpreter by command:

python

You should see beginning of Python interactive session:

C:\>python
Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>

Hit Ctrl+Z and Return to exit from interpreter.

You need to check Inno is on your path. Execute iscc.exe - if you see usage options for the Inno compiler, you are good to go - otherwise, add Inno with a command similar to set PATH=c:\Program Files\Inno Setup 5;%PATH% - note the lack of quotes around the space in the path in the above command.

1.5.1.3   Installing python libraries and tools

Most of the required libraries and tools you get with handy installers. Install this tools in usual way.

Some of tools and libraries comes in the sources. Unpack sources to a working directory and install this packages manually:

  1. Change directory to where the sources are unpacked.
  2. Run:

    python setup.py install
  3. Examine installation messages to the absence of errors.
  4. Done.
1.5.2   Installing GNU Make

Probably you get make without any installer. So simply unpack utility and put it to the directory that listed in PATH environment variable. Or manually add directory where you unpack make to the PATH in similar way as described above for Python interpreter.

1.5.3   You are ready

After installing all tools you are ready to make installer for Bzr.

1.6   Details

1.6.1   Installer for standalone bzr.exe

Creation of installer for standalone bzr.exe is the result of 4 steps:

  1. Building exe file(s)
  2. Compile documentations to the HTML format
  3. Collect all files in one directory
  4. Make solid installer with Inno Setup.

All this steps will do by running in the root of bzr sources directory following command:

make installer

Resulting installer with name: bzr-setup-X.Y.Z.exe will appear in the same directory (here X.Y.Z is version of bzr application).

Next sections explain some details about each steps. Those steps you can run separately.

1.6.2   Installer for python sources

Creation of python-based installer is the result of 2 steps:

  1. Compile documentations to the HTML format
  2. Make solid installer with Python distutils.

All this steps will do by running in the root of bzr sources directory following command:

make python-installer

Resulting installer will be placed in dist/ subdirectory with name like: bzr-X.Y.Z.win32.exe (here X.Y.Z is version of bzr application).

1.7   Steps

1.7.1   make exe

Command

make exe

will produce bzr.exe -- stand-alone bzr executable. For creating exe-file from python sources py2exe utility is used.

Log of building exe file(s) is stored in py2exe.log file. You can inspect this file for error messages.

Resulting bzr.exe placed to the win32_bzr.exe subdirectory.

1.7.2   make docs

Command

make docs

will translate txt documentations files to HTML files. For creating HTML files docutils utility is used.

In addition to the static tutorials and other instructions for Bzr, during creation of html documentation also automatically created Bzr Man Page (help on Bzr commands in Man-like form but in HTML format).

Resulting html files placed to the doc subdirectory (where stored documentation in txt format). To make html pages better looking default.css style sheet is used.

1.7.3   make copy-docs

Perform copy operation and collect all documentation files into win32_bzr.exe\doc subdirectory.

1.7.4   make installer

Final step of creating installer consist sequence of two actions:

  1. Prepare setup script for Inno Setup.
  2. Actually creating installer with Inno Setup.

First action use Cog template processing utility to automatically adjusting version info in the bzr.iss (iss -- inno setup script -- script that controls process of compiling the installer).

Second action produce installer based on setup script file produced by Cog.

Resulting installer with name: bzr-setup-X.Y.Z.exe will appear in the Bzr root directory (here X.Y.Z is version of bzr application, i.e. version info from bzrlib package).

1.7.5   make python-installer

This runs distutils to create bdist_wininst target. This command runs twice: first time for Python 2.4 and second time for Python 2.5.

You also can build only one separate installer for required Python version. Use commands:

make py-inst-24

or

make py-inst-25

For Python 2.4 or 2.5 respectively.

1.7.6   Cleanup

If you need to cleanup files produced by all steps of installer maker, you can run command:

make clean-win32

All automatically generated files will be deleted.

1.8   More Details

1.8.1   Creating bzr.exe

Instructions to create executable contains in setup.py script (at the root of bzr source tree). This script also provide all meta-info that appear in resulting bzr.exe (see properties of files in Windows Explorer).

Full control over properties and meta-info of resulting executable gained via usage py2exe.build_exe.Target class instance.

1.8.2   Creating man page in html format

For creating text source of man page (bzr_man.txt) that will be compiled to html form used script generate_docs.py from the root of bzr source tree. Script should be launched with rstx argument to create man page in text format (actually in ReStructuredText format).

1.8.3   Creating installer for standalone bzr.exe

For creating installer used Inno Setup Compiler that controlled via special iss-script (bzr.iss). This script contain instructions of how will be look installer and what files in which locations it will copy, and what icons it will create for users.

Also this script may contain meta-info about version of application (bzr.exe) and version number of installer itself. And this meta-info will change very frequently (at least one time for each release).

Because we need to have this script under bzr source control in some stable form, we use generation of fresh bzr.iss with fresh meta-info from the template bzr.iss.cog. For this task Cog tool is used. Cog provide ability to embedd into almost any script/source special generators written in python that emits some info directly into this file. Via Cog we generate all required version info extracting version numbers from bzrlib and from previously created installer executable for the same version (auto-incrementing build number feature).

1.9   Additional utilities

1.9.1   bzr_postinstall.exe

Inside installer packaged the additional utility: bzr_postinstall.exe. This is helper utility for postinstall tuning.

Compiled into exe-form with help of py2exe from source script ./tools/win32/bzr_postinstall.py.

To obtain usage information run:

bzr_postinstall --help
1.9.2   Postinstall action for python-based installation

Script .tools/win32/bzr-win32-bdist-postinstll.py designed exclusively for postinstallation tuning of python-based installation.

See: http://docs.python.org/dist/postinstallation-script.html#SECTION005310000000000000000

1.10   Wait! What about usual python setup.py install?

Of course anybody is able to install bzr with standard distutils meme:

python setup.py install

If you want to use faster C-extensions for bzr you need to have at least C compiler (it's enough for installing from release tarball). For those brave souls who want to use bzr.dev using Pyrex is highly recommended.

1.10.1   What about easy install with setuptools?

Run:

easy_install bzr

Also you probably want to read previous section about C compiler and Pyrex. Good luck!