Make build tool substitute written in Python.
Project description
Faff is a Make build tool substitute written in Python. Input files similar to Makefile’s define rules which are used to build arbitrary targets that may have dependencies.
Installation
Install using pip.
$ pip install faff
Quickstart
Create a file in a new directory named faffin.py.
$ mkdir -p $DIR && cd $DIR
$ touch faffin.py
Content of faffin.py file. This assumes that the gcc command is available in the system path.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from faff import (Variable, FileTarget, Rule, Run)
# Absolute path to directory.
root = os.path.abspath(os.path.dirname(__file__))
# Root variable definition.
Variable("ROOT", root)
# File targets with path variable expansion.
SOURCE = FileTarget("{ROOT}", "main.c")
BINARY = FileTarget("{ROOT}", "main")
# Compile and run binary rule.
@Rule([BINARY, SOURCE])
def all(target, depends, args):
Run("gcc {_D} -o {_T}", root)
Run("main", root)
Create a file in the directory named main.c.
$ touch main.c
Content of main.c file.
#include <stdio.h>
int main(void) {
printf("Hello, world!\r\n");
return 0;
}
Run the input file.
$ faff
faff: gcc $DIR/main.c -o $DIR/main
faff: main
Hello, world!
faff: `all` updated (1/1 0.707s)
Documentation
TODO
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
faff-0.1.9.zip
(25.0 kB
view hashes)
Built Distribution
faff-0.1.9-py2.py3-none-any.whl
(22.5 kB
view hashes)