A small clone of GNU Make based on file checksums

Related tags

Build Toolspyke
Overview

Pyke

This weekend project is a small clone (most of the code is in a single file of just about 200LoC) of GNU Make with the twist that it rebuilds a target only if the hash of any of its sources changes. This is named Pyke as in Python + Make (I have no hope of being the first coming up with this name for a project).

Usage

Installation

Clone the project and then install it locally with pip.

$ git clone https://github.com/aziis98/pyke
$ cd pyke
$ pip install -e .

Files

Create a pykefile.py in your project folder and add recipes to build your targets (for now just read below and look at the examples for the syntax).

  • pykefile.py

    The provided globals in this file are

    • pikefile is of type Pikefile and holds all the rules and handles the building of the project.

    • rule is a function and an alias for pikefile.rule and is used as a decorator to define new rules.

    • run is just an alias for os.system used to directly call shell commands.

  • .pykecache.json

    This file stores the checksums of all built targets.

Examples

There are some examples in ./examples.

Simple

This example shows how the checksums approach is better in this case with respect to Make.

> {target}') @rule('c.txt', ['b.txt']) def _(target, source, sources): run(f'cat {source} {source} {source} > {target}') ">
@rule('b.txt', ['a.txt'])
def _(target, source, sources):
    run(f'head -n 3 {source} > {target}')
    run(f'printf "\n" >> {target}')

@rule('c.txt', ['b.txt'])
def _(target, source, sources):
    run(f'cat {source} {source} {source} > {target}')

The file b.txt depends only on a part of a.txt so changes to its end don't trigger the recompilation of targets that depend only on b.txt. In this case, Make couldn't have figured that changes to the end of a.txt don't affect b.txt.

C

A simple example that shows a generic rule with "%" for creating object files from the sources main.c and util.c and then linking them.

@rule('%.o', ['%.c'])
def _(target, source, sources):
    run(f'gcc -c {source} -o {target}')

@rule('main', ['main.o', 'util.o'])
def _(target, source, sources):
    run(f'gcc -o {target} {" ".join(sources)}')

Cycle

This example shows the cycle detection feature

@rule('a', ['c'])
def _(target, source, sources):
    print("A")

@rule('b', ['a'])
def _(target, source, sources):
    print("B")

@rule('c', ['b'])
def _(target, source, sources):
    print("C")

Trying to execute pyke for this project gives

$ pyke
[ERROR] Found dependency cycle caused by "c", aborting! Trace: ['c', 'b', 'a']

TODOs

  • Move the code of pyke.build_with_args() directly inside bin/pike and decouple the logging code in its own module to let the logging level be changed from the start script.
Owner
Antonio De Lucreziis
I'm a Maths student at the University of Pisa and I'm an hobbyist programmer/developer from almost ten years.
Antonio De Lucreziis
bitbake tool

Bitbake ======= BitBake is a generic task execution engine that allows shell and Python tasks to be run efficiently and in parallel while working wit

openembedded 336 Dec 27, 2022
Pythonic task management & command execution.

Welcome to Invoke! Invoke is a Python (2.7 and 3.4+) library for managing shell-oriented subprocesses and organizing executable Python code into CLI-i

3.8k Jan 06, 2023
This is a python helper package for Telebirr H5 Web payment integration helper.

Project Glow Greetings, I see you have stumbled upon project glow. Project glow is an open source bot worked on by many people to create a good and sa

24 Dec 13, 2022
This is a simple tool for bootstrapping Chimera systems from binaries. For source builds, you want cports.

chimera-bootstrap This is a simple tool for bootstrapping Chimera systems from binaries. For source builds, you want cports. Simple usage: $ # run as

Chimera Linux 7 Feb 11, 2022
Software build automation tool for Python.

PyBuilder — an easy-to-use build automation tool for Python PyBuilder is a software build tool written in 100% pure Python, mainly targeting Python ap

PyBuilder 1.5k Jan 04, 2023
🔨🐍Make-like build automation tool for Python projects with extensive DSL features.

Pyke (WIP, Beta Release) Make-like build automation tool for Python projects with extensive DSL features. Features: Users can specify tasks, subtasks,

Ire 17 Jul 05, 2022
A pynt of Python build.

A pynt of Python build. Raghunandan Rao Features Easy to learn. Build tasks are just python funtions. Manages dependencies between tasks. Automaticall

Raghunandan Rao 154 Jan 04, 2023
Python-based project scripting.

Paver - Easy Scripting for Software Projects Web: https://pythonhosted.org/Paver/ Download: https://pypi.python.org/pypi/Paver/ Source: https://github

Paver community 452 Dec 09, 2022
A Star Trek Online build tool in Python

SETS - STO Equipment and Trait Selector A Star Trek Online build tool in Python Description Pre-alpha version of build tool for STO Getting Started De

Star Trek Online Community Developers 7 Nov 12, 2022
Simplified packaging of Python modules

Flit is a simple way to put Python packages and modules on PyPI. It tries to require less thought about packaging and help you avoid common mistakes.

Thomas Kluyver 1.9k Jan 05, 2023
Python program for installing many tools automatically

Tool Installer is a script made with python which help user in installing tools automatically

Spider Anongreyhat 6 Mar 13, 2022
The Meson Build System

Meson® is a project to create the best possible next-generation build system. Status Dependencies Python (version 3.6 or newer) Ninja (version 1.8.2 o

The Meson Build System 4.4k Jan 02, 2023
Python package used on Hardfight projects to make building, testing and deploying easy.

Hardfight Devtools Build, test and deploy Hardfight projects easly 💡 What is it Devtools is a Python tool to make building, testing and deploying int

Hardfight 1 Dec 05, 2021
Python-based continuous integration testing framework; your pull requests are more than welcome!

Buildbot The Continuous Integration Framework Buildbot is based on original work from Brian Warner, and currently maintained by the Botherders. Visit

Buildbot 5k Jan 05, 2023
Ninja is a small build system with a focus on speed.

Ninja Ninja is a small build system with a focus on speed. https://ninja-build.org/ See the manual or doc/manual.asciidoc included in the distribution

8.9k Dec 30, 2022
Buildout is a deployment automation tool written in and extended with Python

Buildout Buildout is a project designed to solve 2 problems: Application-centric assembly and deployment Assembly runs the gamut from stitching togeth

buildout 552 Nov 26, 2022
Dev is a Makefile replacement for modern development environments

Dev Dev is a Makefile replacement for modern development environments. Dev let's

Mason Data 9 Dec 09, 2022
Utilities for interacting with PyPI

twine Twine is a utility for publishing Python packages on PyPI. It provides build system independent uploads of source and binary distribution artifa

Python Packaging Authority 1.4k Jan 05, 2023
A small clone of GNU Make based on file checksums

Pyke This weekend project is a small clone (most of the code is in a single file of just about 200LoC) of GNU Make with the twist that it rebuilds a t

Antonio De Lucreziis 3 Nov 24, 2021
PlatformIO is a professional collaborative platform for embedded development :alien: A place where Developers and Teams have true Freedom! No more vendor lock-in!

PlatformIO Quick Links: Web | PlatformIO IDE | Project Examples | Docs | Donate | Contact Us Social: LinkedIn | Twitter | Facebook | Community Forums

PlatformIO 6.5k Jan 08, 2023