Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/brettlangdon/buildparser
Python package for parsing a build spec(s) from a config file
https://github.com/brettlangdon/buildparser
Last synced: about 1 month ago
JSON representation
Python package for parsing a build spec(s) from a config file
- Host: GitHub
- URL: https://github.com/brettlangdon/buildparser
- Owner: brettlangdon
- License: mit
- Created: 2014-10-11T11:23:57.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2021-03-25T21:27:36.000Z (almost 4 years ago)
- Last Synced: 2024-10-12T22:44:43.734Z (3 months ago)
- Language: Python
- Size: 8.79 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
BuildParser
===========A [specification](SPECIFICATION.md) and parser for project build configuration.
## Setup
### pip
```bash
pip install buildparser
````### git
```bash
git clone git://github.com/brettlangdon/buildparser.git
cd ./buildparser
python setup.py install
```## Basic Usage
```python
import buildparserbuilds = buildparser.parse("./path/to/project")
for build in builds:
print build.env
print build.before_build
print build.build
print build.after_build
print build.after_success
print build.after_failure
```## API
### Environment(object)
#### Properties
* `type` - string
* `options` - mixed#### Methods
* `__init__(self, type, options)`
* `__repr__(self)`
* `as_dict(self)`
* `as_json(self)`
* `as_yaml(self)`### Script(object)
#### Properties
* `commands` - list#### Methods
* `__init__(self, commands)`
* `__repr__(self)`
* `as_dict(self)`
* `as_json(self)`
* `as_yaml(self)`### Build(object)
#### Properties
* `env` - Environment
* `before_build` - Script
* `build` - Script
* `after_build` - Script
* `after_success` - Script
* `after_failure` - Script#### Methods
* `__init__(self, env, before_build, build, after_build, after_success, after_failure)`
* `__repr__(self)`
* `as_dict(self)`
* `as_json(self)`
* `as_yaml(self)`## UnknownExtensionException(Exception)
## parse(directory, name="build")
*returns*: listLook for an appropriate `name` file or directory in the directory `directory`
and parse all possible build configurations found.`parse` defaults to looking for the following files:
* `.build.yml`
* `.build.yaml`
* `.build.json`
* `.build.ini`
* `.build.cfg`or for the directory `.build` which contains one or many configuration files
(name doesn't have to be "build").## parse_directory(dir_name)
*returns*: listLook for all appropriate files inside of `dir_name` and parse configurations found.
## parse_file(file_name)
*returns*: listParse any available build configurations from `file_name`
## parse_yaml(file_name)
*returns*: listParse any available build configurations from `file_name` as though it was yaml.
## parse_json(file_name)
*returns*: listParse any available build configurations from `file_name` as though it was json.
## parse_ini(file_name)
*returns*: listParse any available build configurations from `file_name` as though it was an ini file.