Skip to main content

Make build tool substitute written in Python.

Project description

https://img.shields.io/pypi/v/faff.svg?style=flat-square https://img.shields.io/pypi/status/faff.svg?style=flat-square https://img.shields.io/pypi/l/faff.svg?style=flat-square https://img.shields.io/travis/mojzu/faff/master.svg?style=flat-square https://img.shields.io/coveralls/mojzu/faff.svg?style=flat-square

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


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)

Uploaded Source

Built Distribution

faff-0.1.9-py2.py3-none-any.whl (22.5 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page