Skip to main content

A simple Python library to build and run tasks.

Project description

SimpleBuilder

Simple builder is simple python library which I made for myself to provide simple building operations (and not use .sh/.bat files).

Examples

Running an OS specific command

from simple_builder import *

platform = GetPlatform()
cmd = ""

if platform == Platform.WIN32:
    cmd = "python"
else:
    cmd = "python3"

b = Builder()
t = Task(cmd)
t.AddFlag("-v")
t.AddArg("main.py")
b.AddTask(t)
b.CMDRun()

Working with Status

from simple_builder import *

t_compile = Task("gcc")
t_compile.AddArg("main", "-o")
t_compile.AddArg("src/main.c")

t_run = Task("./main")

b = Builder()
b.AddTask(t_compile)

if b.CMDRun() == Status.OK:
    b.ClearTasks()
    b.AddTask(t_run)
    b.CMDRun()

Documentation

Functions

func GetPlatform() - get system platform

System Value
Linux Platform.LINUX
Windows Platform.WIN32
Windows/Cygwin Platform.CYGWIN
Windows/MSYS2
Windows/MinGW
Platform.MSYS
Mac OS X Platform.MACOSX
OS/2 Platform.OS2
OS/2 EMX Platform.OS2EMX
RiscOS Platform.RISCOS
AtheOS Platform.ATHEOS
FreeBSD 6 Platform.FREEBSD6
FreeBSD 7 Platform.FREEBSD7
FreeBSD 8 Platform.FREEBSD8
FreeBSD N Platform.FREEBSDN

class Task(cmd, com)

  • param cmd - command to run (e.g. "python", "gcc", etc.)
  • param com - print comment instead of standard log

func AddFlag(flag) - add flag to task (e.g. .AddFlag("-v")). This is a fluent method that returns the instance itself for chaining.

func AddArg(arg, flag) - add arg to task (e.g. .AddArg("main.c"), .AddArg). This is a fluent method that returns the instance itself for chaining.

func GetFullTask() - return task as list (e.g. .GetFullTask() will return ['gcc', 'main.c', '-o', './app'])

class Builder()

func AddTask(task) - add task to builder. This is a fluent method that returns the instance itself for chaining.

func ClearTasks() - remove all tasks. This is a fluent method that returns the instance itself for chaining.

func CMDRun() - run tasks synchronously. This is a fluent method that returns the instance itself for chaining.

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

sbuilder-1.1a0.tar.gz (3.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sbuilder-1.1a0-py3-none-any.whl (3.4 kB view details)

Uploaded Python 3

File details

Details for the file sbuilder-1.1a0.tar.gz.

File metadata

  • Download URL: sbuilder-1.1a0.tar.gz
  • Upload date:
  • Size: 3.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for sbuilder-1.1a0.tar.gz
Algorithm Hash digest
SHA256 c9fb623050def72dac41400b0ffc6b0d5315a56ef7fc7bb792218f0949167c4c
MD5 42b29f3800cd9cb564bca48d082a24da
BLAKE2b-256 369f74c9360f2fc318d669a551b49a6d60ae4b7026e188b733233b051b25bae2

See more details on using hashes here.

File details

Details for the file sbuilder-1.1a0-py3-none-any.whl.

File metadata

  • Download URL: sbuilder-1.1a0-py3-none-any.whl
  • Upload date:
  • Size: 3.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for sbuilder-1.1a0-py3-none-any.whl
Algorithm Hash digest
SHA256 40ed196f7a6200d379b857dd04139a48171692b5b550f5926543b0478a22f60f
MD5 c29a06734496ad5a56443d92a9e89388
BLAKE2b-256 00a560852191ae4662f038219945e80a90674970378462105ac24e69d4c17918

See more details on using hashes here.

Supported by

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