Dependencies building script

Along with the setup script, build_wheels.sh was created as a script that builds Ganeti Web Manager dependencies, both compiled and not, and packages them as .whl archives.

You can find the build script in Ganeti Web Manager‘s script directory at ./scripts/build_script.sh

Folder Structure

Wheels are put in subfolders in this pattern:

$wheels_dir/{distribution}/{version}/{architecture}/

The Setup script‘s -w flag expects the wheels to be in this folder structure. So using build_wheels.sh to create these is required, unless you create the directory structure yourself.

Workflow

What this script does:

  1. Detects operating system (only Ubuntu, Debian and CentOS are supported) and it’s architecture.

  2. Tries to install necessary dependencies [requires sudo priviledge]:
    • python
    • python-dev
    • python-virtualenv
    • libpq-dev, libmysqlclient-dev on Ubuntu and Debian
    • postgresql-devel, mysql-devel on CentOS
    • git
  3. Removes existing virtual environment installation.

  4. Creates new virtual environment in the same destination.

  5. Upgrades pip, setuptools and wheel (Python packages) in that virtual environment.

  6. Installs Ganeti Web Manager into that virtual environment, while creating proper wheel packages.

  7. Removes virtual environment.

Warning

Remember to keep wheels output directory and virtual environment apart.

Usage

The only existing dependency you need is bash. This script takes care of installing anything additional. However, if you have some troubles with dependencies, take a look at Can’t install or run dependencies.

To use the script, you simply run it. If you want to build wheels packages for a different version of Ganeti Web Manager, you simply need to git checkout the branch or tag that you want to build the wheels packages for.

Directory structure

Directories you’ll need:

  • venv for virtual environment installation,
  • gwm for Ganeti Web Manager source code,
  • wheels for wheel packages.

Hint

You can totally customize paths to these directories.

These directories will be created after you run build_wheels.sh.

Command line arguments

By specifying additional arguments you can change this script’s behavior and some paths it’s using.

Note

build_wheels.sh will work graciously without any additional arguments!

-e <virtual environment directory>
Default:./venv

Path where the script should create a temporary Python virtual environment.

-w <wheels output directory>
Default:./wheels

Path where output wheel packages are stored.

-N

Skip installing system dependencies.

Examples

Default options::
$ ./scripts/build_wheels.sh

Here’s another way to do the above, specifiying the locations:

$ ./scripts/build_wheels.sh -e ./venv -w ./wheels

Build wheels without dependencies (an unsupported OS), and upload the wheels:

$ ./scripts/build_wheels.sh -N
$ rsync ./wheels rsync@server:/srv/www/wheels

Troubleshooting

Can’t install or run dependencies

If you’re using operating system different from Ubuntu, Debian or CentOS, you might have troubles installing necessary dependencies.

What this script is looking for:

  • /usr/bin/sudo
  • /bin/rm
  • /usr/bin/virtualenv (usually python-virtualen package provides it)
  • /usr/bin/git (usually git package provides it)

Make sure you have these files present in your system and then run the script with -N command line argument.

Can’t run build_wheels.sh: permission denied

This script needs to be executable, you can make it by issuing this command:

$ chmod +x build_wheels.sh