Installing Formic

Prequisites

Platform and dependencies:

  • Formic requires Python 2.7
  • It has been tested on
    • Mac OS X (Lion and Mountain Lion)
    • Ubuntu 11.10 and 12.04LTS
    • Windows XP and Windows 7 (Home Premium).

Formic should work on any Python 2.7 system; if not, please contact the maintainer or file an issue.

Formic has no runtime dependencies outside the Python system libraries.

Installation options

There are three ways to obtain Formic shown below, in increasing difficulty and complexity. You need only pick one:

Option 1: Automated install

Simplest: use:

$ easy_install formic

or:

$ pip install formic

Option 2: Source install

  1. Download the appropriate package from Formics page on the Python Package Index. This is a GZipped TAR file.

  2. Extract the package using your preferred GZip utility.

  3. Navigate into the extracted directory and perform the installation:

    $ python setup.py install

Option 3: Check out the project

If you like, you could download the source and compile it yourself. The source is on a Mercurial DVCS at Atlassian BitBucket. BitBucket provides several different approaches for download on the site, the simplest being:

$ hg clone https://bitbucket.org/aviser/formic

Note

To build, Formic requires setuptools. We strongly recommend building in a virtual environment using virtualenv.

After checking out the source, navigate to the top level directory and build:

$ python setup.py install

Validating the installation

After installing, you should be able to execute Formic from the command line:

$ formic --version
formic xxxx http://www.aviser.asia/formic

(xxxx will be the version of Formic that you downloaded and installed)

If you downloaded the source, you can additionally run the unit tests. This requires py.test:

$ easy_install pytest
$ cd formic
$ py.test
========================== test session starts ==========================
platform darwin -- Python 2.7.1 -- pytest-2.2.3
collected 40 items

test_formic.py ........................................

======================= 40 passed in 2.55 seconds =======================

Compiling the documentation

Formic uses Sphinx for documentation. The source files are in the ‘doc’ subdirectory. To build the documentation,

  1. Ensure that formic has been installed and is visible on the path so you can start Python and import formic, eg:

    $ cd /anywhere/on/filesystem
    $ python
    Python 2.7.1 (r271:86832, Jul 31 2011, 19:30:53)
    [GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import formic
    >>> exit()
    $
  2. Navigate to Formic’s top level directory, then:

    $ sphinx-build doc htmlout

The documentation will be in the ./htmlout subdirectory.

Note

Only HTML generation has been tested.

Note

If you get errors that Sphinx cannot import Formic’s packages, you may not have installed the module correctly. Try reinstalling it, eg ‘python setup.py develop’ or ‘python setup.py install’

Changelog

0.9beta8

New feature:

  • Added the ability to pass in the function that walks the directory path, which allows for alternate implementations or supplying a mock function that provides values completely unrelated to the OS. This is available only from the API and not from the command line:

    files = ["CVS/error.py", "silly/silly1.txt", "1/2/3.py", "silly/silly3.txt", "1/2/4.py", "silly/silly3.txt"]
    for dir, file in FileSet(include="*.py", walk=walk_from_list(files)):
        print dir, file
    

Bug fixes:

  • Fixed #10: Paths like “//network/dir” caused an infinite loop

  • Fixed #11: Incorrect handling of globs ending “/**” and “/”. Ant Glob semantics for:

    **/test/**

    are that they should match “all files that have a test element in their path, including test as a filename.”

0.9beta7

Bug fixes:

  • Fixed #4 and #6: Handles mixed case correctly on Windows
  • Fixed #8: Formic fails if it starts directory traversal at any drive’s root directory on Windows
  • Fixed #5: Formic had an unnecessary dependency on pkg_resources

Improvements:

  • Fixed performance defect #7: Much faster searching for globs like “/a/b/**
  • Improved quickstart documentation: Explicitly mention that Formic searches from the current directory.

0.9beta6

  • Fixed issue #2: VERSION.txt was not being correctly packaged causing problems with source and pip installation
  • Fixed issue #3: Incorrect behaviour when absolute directory was “/”
  • Removed Google Analytics from documentation, and improved documentation template
  • Improved publishing process.

0.9beta5

This is a documentation and SCM release. No API changes.

  • Updated documentation, changelogs and installation instructions
  • Removed Google Analytics from Sphinx documentation
  • Implemented Dovetail build * Added coverage, pylint and sloccount metrics generation * Added command-line sanity tests

0.9beta4

0.9beta3

  • API: FileSet is now a natural iterator:

    fs = FileSet(include="*.py")
    filenames = [ filename for filename in fs ]
    
  • API: __str__() on Pattern and FileSet has been improved. Pattern now returns the just normalized string for the pattern (eg **/*.py). FileSet now returns the details of the set include all the include and exclude patterns.

  • Setup: Refactored setup.py and configuration to use only setuptools (removing distribute and setuptools_hg)

  • Documentation: Renamed all ReStructured Text files to .rst. Small improvements to installation instructions.

0.9beta2

  • Refactored documentation files and locations to be more DRY:
    • Sphinx documentation
    • setup.py/Pypi readme
    • README/INSTALL/CHANGELOG/USAGE in topmost directory
  • Removed the file-based distribute depending on explicit dependency in setup.py

0.9beta

Date: 14 Apr 2011 First public release