A simple Python library to build and run tasks.
Project description
SimpleBuilder
SimpleBuilder is simple python library which I made for myself to provide simple building operations (and not use .sh/.bat files).
Installation
pip install sbuilder
Examples
Running an OS specific command
from sbuilder 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 sbuilder 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
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sbuilder-1.2a0.tar.gz.
File metadata
- Download URL: sbuilder-1.2a0.tar.gz
- Upload date:
- Size: 3.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
56239ad8229987da4e3b6c70d429e100ec020e865c4eb9f8308c45b97cb39f98
|
|
| MD5 |
4974a9465ae666251c9134991c536e69
|
|
| BLAKE2b-256 |
e9a16fe3155046f1297717e17ed909a91393b2ab753ed1b90488f95023c7dbbe
|
File details
Details for the file sbuilder-1.2a0-py3-none-any.whl.
File metadata
- Download URL: sbuilder-1.2a0-py3-none-any.whl
- Upload date:
- Size: 3.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b887b2a6c784160596e2af9f8403996a5b7a49cb0bba442396a08878dd562122
|
|
| MD5 |
6d42d37b4730d165252cfbce667ea6b1
|
|
| BLAKE2b-256 |
72baeba3fa39e1a70195b39b6525ac0e467b8a242b9ae2b10ae77d2cf2f038bb
|