1. Éric Araujo
  2. distutils2


Clone wiki

distutils2 / 4suite

Looking at 4Suite

4Suite is a somewhat old collection of tools for XML processing in Python. Aside from this core package, it also provides a testing framework, a module for writing command-line programs, and a bunch of extensions to Distutils. It even dares to extend pydoc.

All Ye Who Enter Here

The latest available version from 4suite.org is 1.0.2, last updated some years ago. I’ve looked into the code and come back to tell the tale. (Note: This page is written tongue-in-cheek with no intention to offense.)

There’s no denying 4Suite is an amazing implementation of DOM, XPath, XPointer, XSLT and other XThings and RFCs; still, the age of the code shows. Some wheels 4Suites needed to invent are provided by stdlib or popular third-party modules now, and the coding style is not agreeable to eyes trained to PEP 8 readability. Compatibility backports are included right in the middle of the modules, not in convenient separate files, making the files huge. Monkey-patching also makes the code somewhat hard to follow.

Steal This Code

After this warning about readability and bitrot, let us review the contents of Ft.Lib.DistExt. The license is compatible with our own, we just have to give proper credits (a __credits__ attribute in the source and mentions in the doc are okay, according to the original author of DistExt).

Not really useful for Distutils2 are bdist commands for Setuptools eggs, Windows InnoSetup, and RPM; an install_egg_info command; a Version class that predates PEP 386; a PackageManager module whose purpose I don’t understand; a Distribution class implementing PEPs 241, 314 and 345.

Interesting new build and install commands provide support for many types of files:

  • gettext translation catalogs (also reinvented in DistUtilsExtra, Mercurial’s setup script, and elsewhere);
  • BisonGen parsers;
  • configuration files (see also DistUtilsExtra and the pre-PEP design document about file locations in Distutils2);
  • documentation (generating plain text and HTML from XML and installing in different locations);
  • untyped files to be installed to arbitrary locations;
  • scripts, with platform-dependent handling (probably out of scope for this GSoC but maybe useful for #870479);
  • the sdist command uses a parameter instead of a file as manifest, going in the opposite direction of current Distutils2 efforts.

DistExt also implements install and uninstall commands. Interestingly, the uninstall command only uses stock Distutils APIs, not custom 4Suite modules. It operates simply by getting the list of files from the install command and removes them; using an explicit list in a dedicated file will be much more robust.

The config command is reviewed on its own page, since implementing a configure command inspired by it is one of my tasks.