Skip to main content

Python-based build system.

Project description

dan

Do Anything Now

dan is a build system inspired from GNU make, cmake, meson, ... but only in python.

It is mostly designed to be easy to use, it comes with its vscode extension available on the marketplace.

It also provide a packaging system called dan.io, that will fetch and build 3rd party libraries.

Install

dan is available on pip:

pip install dan-build

Features

Generators

Generators are python functions that generates an output:

from dan import generator

@generator(output='hello.txt', dependencies=['source.jinja'])
def hello(self):
    env = jinja2.Environment(loader=jinja2.FileSystemLoader(self.source_path))
    template = env.get_template('source.jinja')
    print(template.render({'data': 'hello'}), file=open(self.output, 'w'))

They can be async:

@generator(output='hello-cpy.txt', dependencies=[hello])
async def hello_cpy(self):
    assert hello.up_to_date
    async with aiofiles.open(hello.output, 'r') as src:
        async with aiofiles.open(self.output, 'w') as dst:
            await dst.write(await src.read())

C/CXX

Libraries/Executables

from dan.cxx import Library, Executable
class MyLib(Library):
    name = 'my-lib'
    sources = ['src/my-lib.cpp']
    public_includes = ['include']

class MyExe(Executable):
    name = 'my-exe'
    sources = ['src/main.cpp']
    dependencies = [MyLib]

Packages

dan.io is the main (default) package source repository (custom repositories are supported by editting ~/.dan/repositories.json), documentation comming soon.

class MyExe(Executable):
    name = 'my-exe'
    sources = ['src/main.cpp']
    dependencies = ['boost:headers@dan.io >= 1.82']

dan cli usage

dan is the main executable to build your project, it can build, test, list targets/test, ...

dan --help
Usage: dan [OPTIONS] COMMAND [ARGS]...

Options:
  --version           Show the version and exit.
  -q, --quiet         Dont print informations (errors only)
  -v, --verbose       Pring debug informations
  -j, --jobs INTEGER  Maximum jobs
  --help              Show this message and exit.

Commands:
  build            Build targets
  clean            Clean generated stuff
  code             VS-Code specific commands
  configure        Configure dan project
  install          Install targets
  ls               Inspect stuff
  run              Run executable(s)
  scan-toolchains  Scan system toolchains
  test             Run tests
  uninstall        Uninstall previous installation

Toolchain scan

dan scan-toolchains [-s <env-script>]

Configuration

dan configure [-B <build_path>] [-S <source_path>] [-t <toolchain>] [-s <setting>=<value>] [-o <option>=<value>]

Build

dan build [-B <build_path>] [-v] [--for-install] [TARGETS]...

Install

Install targets marked with install = True property to the install.destination setting.

dan install [-B <build_path>] [TARGETS]... [user|dev]

Settings:

  • install.destination: The install destination (default: /usr/local).
  • install.runtime_prefix: Executables installation prefix (default: bin).
  • install.libraries_prefix: Libraries installation prefix (default: lib).
  • install.includes_prefix: Includes installation prefix (default: include).
  • install.data_prefix: Data files installation prefix (default: share).
  • install.project_prefix: !!! NOT USED YET !!! Project prefix (default: None).

dan-io cli usage

dan-io is a secondary utility to interract with package management system.

$ dan-io --help 
Usage: dan-io [OPTIONS] COMMAND [ARGS]...

Options:
  --help  Show this message and exit.

Commands:
  ls      Inspect stuff
  search  Search for NAME in repositories
$ dan-io ls --help
Usage: dan-io ls [OPTIONS] COMMAND [ARGS]...

  Inspect stuff

Options:
  --help  Show this message and exit.

Commands:
  libraries     List available libraries
  repositories  List available repositories
  versions      Get LIBRARY's available versions

Auto completion

bash and zsh completions are currently supported:

  • bash:

    for script in ~/.local/etc/bash_completion.d/*.sh; do
        source ${script}
    done
    
  • ksh:

    for script in ~/.local/etc/ksh_completion.d/*.sh; do
        source ${script}
    done
    

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

dan-build-0.2.7.tar.gz (81.1 kB view details)

Uploaded Source

Built Distribution

dan_build-0.2.7-py3-none-any.whl (96.8 kB view details)

Uploaded Python 3

File details

Details for the file dan-build-0.2.7.tar.gz.

File metadata

  • Download URL: dan-build-0.2.7.tar.gz
  • Upload date:
  • Size: 81.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.4

File hashes

Hashes for dan-build-0.2.7.tar.gz
Algorithm Hash digest
SHA256 06073a76c5ce0fdd7ed7e495e42cc3053bcadaf5cafe4a2c621864bc9632ea22
MD5 2bf2639c2cf6aaf58bbaeea4fe4ec8cf
BLAKE2b-256 f7694f53ac2389f5cc986a417c213f2350ef2c0b42693bff8a928729aa4a111d

See more details on using hashes here.

File details

Details for the file dan_build-0.2.7-py3-none-any.whl.

File metadata

  • Download URL: dan_build-0.2.7-py3-none-any.whl
  • Upload date:
  • Size: 96.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.4

File hashes

Hashes for dan_build-0.2.7-py3-none-any.whl
Algorithm Hash digest
SHA256 c76bade65a70be9796a1adc0935be7cdd37b5dc6141ee0e48c4638f0f18abaa1
MD5 161512dd6fea366f1ec29ab256146cb1
BLAKE2b-256 1256f79bb571ab74be1a1303098b42c4fe4d015ffaf0e24330172d34c6f56c00

See more details on using hashes here.

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