# 2.1. Build System¶

If you want to use Python with other programming languages, a build system is usually needed. A build system is used to automate the processes of compiling, linking, packaging, and deploying software. This chapter will focus on a tool called SCons, which is implement with pure Python. Building scripts of SCons can be highly modularized and reused, and cross-platform as well.

Using a build system involves writing building scripts. Building scripts of SCons can have three parts:

• Front-end script (SConstruct),
• Rule script (Sconscript), and
• Tools (site_scons/site_tools/*).

Below is the SConstruct and the SConscript files of an example project. The SConstruct file is:

The SConscript file is:

SCons tools provide a means to reuse the building code. For example, we can use the SCons tools provided by the Cython team to build your cython code, by copying the files cython.py and pyext.py into the directory site_scons/site_tools inside your project.