Skip to main content

CToolKit to manipulate CPipeLines and Repos

Project description

CToolkit

is An Python Package to manipulate C/C++ buildings and PipeLines providing easy automation tools to increase your code pipelines with amalgamations, black box testing, and readme replacment

Instalation from Pip

for install the lib from pip call

pip install CToolKit

Installation from scratch

clone the repo into your machine with:

git clone https://github.com/OUIsolutions/CTolkitBuild.git

Then install with:

cd CTolkitBuild/
pip install .

Installation from github

type the following comand to install from github

pip install git+https://github.com/OUIsolutions/CTolkitBuild.git

Amalgamation System

for amalgamate an C lib its super easy, just call

import CToolKit as ct

STARTER  = f'test.h'
OUTPUT = 'amalgamated.h'
amalgamated_code = ct.generate_amalgamated_code(STARTER)
with open(OUTPUT,'w') as arq:
    arq.write(amalgamated_code)

or even more implicit:

import CToolKit as ct

STARTER  = f'CTextEngine/CTextEngineMain.h'
OUTPUT = 'amalgamated.h'
amalgamated_code = ct.generate_amalgamated_code(STARTER,OUTPUT)

Comand Line Operations

Compile an Project

it wil copile the given file

import CToolKit as ct

COMPILER = 'gcc'
FILE = 'test.c'
OUTPUT = 'test.out'
ct.compile_project(
 FILE,
 COMPILER,
 OUTPUT,
 raise_errors=True,
 raise_warnings=True
)

Testing copilation with valgrind

Execute an valgrind testing of the given binary ( you need to have valgrind installed in your os)

import CToolKit as ct

COMPILER = 'gcc'
FILE = 'test.c'
OUTPUT = 'test.out'
ct.compile_project(
 COMPILER,
 FILE,
 OUTPUT,
 raise_errors=True,
 raise_warnings=True
)

FLAGS = ['-libcur']
ct.test_binary_with_valgrind(OUTPUT, FLAGS)

Executing copilation and test with file with a single comand

import CToolKit as ct

COMPILER = 'gcc'
FILE = 'test.c'

ct.execute_test_for_file(FILE,COMPILER)

Executing Test with all .c or .cpp files in the given folder

import CToolKit as ct


test = ct.FolderTestPreset(folder='tests/main_test',side_effect_folder='tests/target')
# wil create non existent outputs
test.generate_ouptut()
# will start the test
test.start_test()

Execution

you can execute an binary with the ComandLine Execution class

import CToolKit as ct

COMPILER = 'gcc'

FILE = 'test.c'
OUTPUT = 'test.out'
ct.compile_project(
 FILE,
 COMPILER,
 OUTPUT,
 raise_errors=True,
 raise_warnings=True
)

execution = ct.ComandLineExecution(f'./{OUTPUT}')

print('output:', execution.output)
print('statuscode:', execution.status_code)

Readme Replacement

you can replace readme content with code system for these just tipe: < + !--codeof:test.c-->, you can see these example in the following lib: https://github.com/OUIsolutions/CTextEngine

Will free the memory
<!--codeof:exemples/free.c-->
import CToolKit as ct

ct.include_code_in_markdown('README.md')

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

CToolKit-2.45.tar.gz (8.8 kB view details)

Uploaded Source

File details

Details for the file CToolKit-2.45.tar.gz.

File metadata

  • Download URL: CToolKit-2.45.tar.gz
  • Upload date:
  • Size: 8.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.9.6 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/1.0.0 urllib3/1.26.16 tqdm/4.64.1 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.5 CPython/3.6.8

File hashes

Hashes for CToolKit-2.45.tar.gz
Algorithm Hash digest
SHA256 420ad2bf3b46606ae9e43ea40487f2cbdb32b40a3ecc96bfa923a17b0b924212
MD5 e97033cb66699ec0fcaf58fa104a7db8
BLAKE2b-256 15281df00c36d73f749dee567e91c07ed6cb55487adc9155b6716259fe5d5aa7

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