Skip to main content

A flexible build system assistant.

Project description

bulgogi-py

0.1.3 Build The Python interface for bulgogi.

Motive

  1. Rather than write a CLI from scratch, using a scripting language as the interface seemed cool and appropriate for this project.
  2. Build configurations are slow-changing and repititious, making scripts ideal for the job.

Installation

To get started, install bulgogi using pip:

pip install bulgogi 

Once installed at the user-level, use it in your latest build project.

Building from scratch

If your development platform is unlucky enough to be missing a compatible pre-built wheel distribution, the following instructions can be used to build the Python package from source.

Build dependencies

The following system dependencies are required:

  • git
  • gcc
  • make
  • libtool
  • python3
    • pip
    • build
  • python3-devel

Build instructions

Once system dependencies are installed, install the package from the upstream git repository:

pip install git+https://github.com/High-Intensity-Prototyping-Labs/bulgogi-py.git 

This should run and execute the build sequence required and install the system locally.

Build troubleshooting

If errors are encountered during build, an attempt at a manual build would be best for debugging purposes.

Clone the bulgogi-py repository and run the build.sh script on a UNIX-like system:

git clone https://github.com/High-Intensity-Prototyping-Labs/bulgogi-py.git 

cd bulgogi-py 

./build.sh 

With a careful eye and enough experience, the verbose build output should yield useful information to troubleshoot issues.

Usage

1. Create setup.py

First create the setup.py file in the root of your build project and declare your project:

# setup.py 
import bulgogi as bul 

bul.new_project('My Project')
bul.set_version('v1.0.0')

...

2. Declare targets

The next step is to declare targets based on your project layout:

...

target1 = bul.add_target('target1', bul.LIB)
execute = bul.add_target('execute', bul.EXE)

...

3. Declare relations

Targets need to be linked in some kind of way. This is usually referred to as 'dependency linking'.

In the Python interface for bulgogi, dependencies are linked by target ID:

...

bul.add_target_dep(execute, target1)

...

4. Commit the setup

Lastly, the build configuration must be commit to disk before it can be built:

...

bul.commit()

Putting it all together

# setup.py 
import bulgogi as bul 

bul.new_project('My Project')
bul.set_version('v1.0.0')

target1 = bul.add_target('target1', bul.LIB)
execute = bul.add_target('execute', bul.EXE)

bul.add_target_dep(execute, target1)

bul.commit()

This will generate a project.yaml file in the root of your directory and resemble something like:

execute:
  - target1

Usually configuration files are guarded from manual edits - but bulgogi in fact encourages the developer to modify the project.yaml file as they please.

Where are all the sources?

Although targets have been declared and dependencies linked, the best bulgogi can do to find the source files to copmile is to guess.

As a sane default, it will guess that each target has a directory matching its name (target1/ and execute/ in this case) and look for src and inc directories within.

This means - yes - that in theory the setup.py script can be ommitted altogether. This is not defeatist - it's to highlight that the script is most useful to standardize project configuration for all bulgogi targets, even if the project isn't your own.

Declaring sources

In the setup.py, target sources can be declared:

...

bul.add_sources(target1, 'target1/src/*.c')
bul.add_headers(target1, 'target1/inc/*.h')

...

bul.commit()

This can be done anytime after target1 has been added but before the configuration is committed to disk.

Patterns

It is evident that a specific files were not specified for the target sources. Patterns such as *.c are used instead and are known as 'globbing'.

Globbing

Globbing is a mixed subject among build system afficionados. Bulgogi offers it as a built-in feature and allows users to decide how they would like to approach.

...

# Adding individual files is allowed.
bul.add_sources(target1, 'target1/src/hello.c')
bul.add_sources(target1, 'target1/src/dog.c')
bul.add_sources(target1, 'target1/src/cat.c')

...

# Files can be 'globbed' by file-extension.
bul.add_sources(target1, 'target1/src/*.c')
bul.add_sources(target1, 'target1/src/*.cpp')

...

# Globbing can also be performed recursively.
bul.add_headers(target1, 'target1/inc/**.c')


bul.commit()

Variables

A benefit of using a feature-complete scripting language is the built-in availability of variables.

...

targets = ['target1', 'execute']
src_dir = 'src'
inc_dir = 'inc'

for target in targets:
    bul.add_sources(target, bul.names(target) + '/' + SRC_DIR + '/*.c')
    bul.add_headers(target, bul.names(target) + '/' + INC_DIR + '/*.h')

bul.commit()

License


bulgogi-py by Alex Amellal is licensed under CC BY 4.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

bulgogi-0.1.5-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (125.8 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64

bulgogi-0.1.5-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (117.0 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ ARM64

bulgogi-0.1.5-pp310-pypy310_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (119.0 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

bulgogi-0.1.5-pp310-pypy310_pp73-macosx_10_9_x86_64.whl (48.7 kB view hashes)

Uploaded PyPy macOS 10.9+ x86-64

bulgogi-0.1.5-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (125.8 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64

bulgogi-0.1.5-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (117.1 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ ARM64

bulgogi-0.1.5-pp39-pypy39_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (119.0 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

bulgogi-0.1.5-pp39-pypy39_pp73-macosx_10_9_x86_64.whl (48.7 kB view hashes)

Uploaded PyPy macOS 10.9+ x86-64

bulgogi-0.1.5-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (125.8 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64

bulgogi-0.1.5-pp38-pypy38_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (117.1 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ ARM64

bulgogi-0.1.5-pp38-pypy38_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (119.0 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

bulgogi-0.1.5-pp38-pypy38_pp73-macosx_10_9_x86_64.whl (48.7 kB view hashes)

Uploaded PyPy macOS 10.9+ x86-64

bulgogi-0.1.5-cp312-cp312-musllinux_1_1_x86_64.whl (136.3 kB view hashes)

Uploaded CPython 3.12 musllinux: musl 1.1+ x86-64

bulgogi-0.1.5-cp312-cp312-musllinux_1_1_i686.whl (130.1 kB view hashes)

Uploaded CPython 3.12 musllinux: musl 1.1+ i686

bulgogi-0.1.5-cp312-cp312-musllinux_1_1_aarch64.whl (128.3 kB view hashes)

Uploaded CPython 3.12 musllinux: musl 1.1+ ARM64

bulgogi-0.1.5-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (136.8 kB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

bulgogi-0.1.5-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (127.6 kB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ ARM64

bulgogi-0.1.5-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (129.1 kB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

bulgogi-0.1.5-cp312-cp312-macosx_11_0_arm64.whl (47.9 kB view hashes)

Uploaded CPython 3.12 macOS 11.0+ ARM64

bulgogi-0.1.5-cp312-cp312-macosx_10_9_x86_64.whl (49.1 kB view hashes)

Uploaded CPython 3.12 macOS 10.9+ x86-64

bulgogi-0.1.5-cp311-cp311-musllinux_1_1_x86_64.whl (136.5 kB view hashes)

Uploaded CPython 3.11 musllinux: musl 1.1+ x86-64

bulgogi-0.1.5-cp311-cp311-musllinux_1_1_i686.whl (130.3 kB view hashes)

Uploaded CPython 3.11 musllinux: musl 1.1+ i686

bulgogi-0.1.5-cp311-cp311-musllinux_1_1_aarch64.whl (128.6 kB view hashes)

Uploaded CPython 3.11 musllinux: musl 1.1+ ARM64

bulgogi-0.1.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (136.5 kB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

bulgogi-0.1.5-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (127.4 kB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ ARM64

bulgogi-0.1.5-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (128.9 kB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

bulgogi-0.1.5-cp311-cp311-macosx_11_0_arm64.whl (47.8 kB view hashes)

Uploaded CPython 3.11 macOS 11.0+ ARM64

bulgogi-0.1.5-cp311-cp311-macosx_10_9_x86_64.whl (49.0 kB view hashes)

Uploaded CPython 3.11 macOS 10.9+ x86-64

bulgogi-0.1.5-cp310-cp310-musllinux_1_1_x86_64.whl (135.3 kB view hashes)

Uploaded CPython 3.10 musllinux: musl 1.1+ x86-64

bulgogi-0.1.5-cp310-cp310-musllinux_1_1_i686.whl (129.1 kB view hashes)

Uploaded CPython 3.10 musllinux: musl 1.1+ i686

bulgogi-0.1.5-cp310-cp310-musllinux_1_1_aarch64.whl (127.4 kB view hashes)

Uploaded CPython 3.10 musllinux: musl 1.1+ ARM64

bulgogi-0.1.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (136.0 kB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

bulgogi-0.1.5-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (126.9 kB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ ARM64

bulgogi-0.1.5-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (128.4 kB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

bulgogi-0.1.5-cp310-cp310-macosx_11_0_arm64.whl (47.8 kB view hashes)

Uploaded CPython 3.10 macOS 11.0+ ARM64

bulgogi-0.1.5-cp310-cp310-macosx_10_9_x86_64.whl (49.0 kB view hashes)

Uploaded CPython 3.10 macOS 10.9+ x86-64

bulgogi-0.1.5-cp39-cp39-musllinux_1_1_x86_64.whl (135.0 kB view hashes)

Uploaded CPython 3.9 musllinux: musl 1.1+ x86-64

bulgogi-0.1.5-cp39-cp39-musllinux_1_1_i686.whl (128.8 kB view hashes)

Uploaded CPython 3.9 musllinux: musl 1.1+ i686

bulgogi-0.1.5-cp39-cp39-musllinux_1_1_aarch64.whl (127.1 kB view hashes)

Uploaded CPython 3.9 musllinux: musl 1.1+ ARM64

bulgogi-0.1.5-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (135.8 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

bulgogi-0.1.5-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (126.7 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ ARM64

bulgogi-0.1.5-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (128.2 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

bulgogi-0.1.5-cp39-cp39-macosx_11_0_arm64.whl (47.8 kB view hashes)

Uploaded CPython 3.9 macOS 11.0+ ARM64

bulgogi-0.1.5-cp39-cp39-macosx_10_9_x86_64.whl (49.0 kB view hashes)

Uploaded CPython 3.9 macOS 10.9+ x86-64

bulgogi-0.1.5-cp38-cp38-musllinux_1_1_x86_64.whl (135.7 kB view hashes)

Uploaded CPython 3.8 musllinux: musl 1.1+ x86-64

bulgogi-0.1.5-cp38-cp38-musllinux_1_1_i686.whl (129.5 kB view hashes)

Uploaded CPython 3.8 musllinux: musl 1.1+ i686

bulgogi-0.1.5-cp38-cp38-musllinux_1_1_aarch64.whl (127.7 kB view hashes)

Uploaded CPython 3.8 musllinux: musl 1.1+ ARM64

bulgogi-0.1.5-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (136.3 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

bulgogi-0.1.5-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (127.1 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ ARM64

bulgogi-0.1.5-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (128.6 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

bulgogi-0.1.5-cp38-cp38-macosx_11_0_arm64.whl (47.8 kB view hashes)

Uploaded CPython 3.8 macOS 11.0+ ARM64

bulgogi-0.1.5-cp38-cp38-macosx_10_9_x86_64.whl (49.0 kB view hashes)

Uploaded CPython 3.8 macOS 10.9+ x86-64

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