Next / Previous / Contents / Shipman's homepage

6.2. Imports

docbookindex
# - - - - -   I m p o r t s

The all-important sys module for command line arguments.

docbookindex
import sys

We need os for operating system functions.

docbookindex
import os

The stat module is for extracting timestamps from inodes.

docbookindex
import stat

The time is for formatting timestamps.

docbookindex
import time

Functions and classes for XSL-FO file generation come from fohelpers.py; see fohelpers.py: XSL-FO helper functions for Python. Use of this package is so ubiquitous that we shorten the module name to just “h”.

docbookindex
import fohelpers as h

We also import some items from the etbuilder module to handle parsing of the input file, as well as building any XSL-FO elements that are not taken care of by fohelpers.py: et is the etree module from lxml that is a superset of the standard Python ElementTree module; E is the element builder; subElement() and addText() are useful utility functions. This module comes from Python XML processing with lxml.

docbookindex
from etbuilder import et, E, subElement, addText

We'll need the copy module to make copies of element subtrees.

docbookindex
import copy