Platform and dependencies:
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.
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
Download the appropriate package from Formics page on the Python Package Index. This is a GZipped TAR file.
Extract the package using your preferred GZip utility.
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
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 =======================
Formic uses Sphinx for documentation. The source files are in the ‘doc’ subdirectory. To build the documentation,
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()
$
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’
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.”
Bug fixes:
Improvements:
This is a documentation and SCM release. No API changes.
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.
Date: 14 Apr 2011 First public release