https://github.com/ptomulik/scons-arguments
Easy way to add and process CLI variables, options and OS environment variables
https://github.com/ptomulik/scons-arguments
Last synced: 3 months ago
JSON representation
Easy way to add and process CLI variables, options and OS environment variables
- Host: GitHub
- URL: https://github.com/ptomulik/scons-arguments
- Owner: ptomulik
- Created: 2015-10-21T20:57:56.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-02-15T19:46:35.000Z (over 8 years ago)
- Last Synced: 2025-01-18T02:28:37.159Z (5 months ago)
- Language: Python
- Size: 1.43 MB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
scons-arguments
===============| travis-ci | appveyor | coveralls |
|-----------|-----------|-----------|
|[](https://travis-ci.org/ptomulik/scons-arguments)| [](https://ci.appveyor.com/project/ptomulik/scons-arguments/branch/master) | [](https://coveralls.io/github/ptomulik/scons-arguments?branch=master) |Welcome to ``scons-arguments``.
This scons extension enables one to easily define scons command-line variables
and options. It provides a concept of *Argument* which correlates three
entities:- command line option (e.g. ``scons --prefix=/usr/bin`` in command line),
- command line variable (e.g. ``scons PREFIX=/usr/bin`` in command line),
- scons construction variable (e.g. ``env['PREFIX']`` inside of a scons script).*Arguments* allow to easily define how data should flow from scons command
line and operating system's environment to a scons environment (to scons
construction variables).The extension also provides a number of modules with predefined command-line
arguments for core SCons tools (``cc``, ``c++``, ``link``, etc.).INSTALLATION
------------There are two methods of installation:
### Installation by simple copy
Copy recursively ``SConsArguments/`` to your ``site_scons/`` directory
```console
cp -r scons-arguments/SConsArguments your/projects/site_scons/
```### Installation as a submodule in git-based projects
Add the repository as a submodule to your project
```console
git submodule add git://github.com/ptomulik/scons-arguments.git 3rd/scons-arguments
```In your `site_scons/site_init.py` add the following lines:
```python
# site_scons/site_init.py
import sys
sys.path.append(Dir('#3rd/scons-arguments').abspath)
```QUICK EXAMPLE
-------------A simple C++ project, with a SConstruct file accepting most of the C/C++
compiler- and linker-related command-line arguments.SConstruct file:
```python
# SConstruct
from SConsArguments import ImportArgumentsenv = Environment()
var = Variables()dcl = ImportArguments(['c++', 'cc', 'link'])
arg = dcl.Commit(env, var)
arg.Postprocess(env, var)
if arg.HandleVariablesHelp(var, env):
Exit(0)env.Program('hello.cpp')
```and the C++ source code (file ``hello.cpp``):
```c++
#include#ifndef VERSION
#define VERSION "unknown"
#endifint main()
{
std::cout << "Hello world (" VERSION ")" << std::endl;
return 0;
}
```Run ``scons --help``. Run ``scons --help-variables`` to see the full list of
new command-line variables. Play with compiler/linker flags, for example run
``scons CCFLAGS='-g -O2'``. Try to define ``VERSION`` via command-line (example
tested only on Linux/bash):```console
scons CPPDEFINES="-DVERSION='\\\"v. 1.2\\\"'"
```DOCUMENTATION
-------------### User documentation
Online User Manual may be found at:
*
User documentation can be generated from the top level directory with the
following command (see also requirements below)```console
scons user-doc
```
The generated documentation is located in ``build/doc/user``.### API documentation
Online API documentation may be found at:
*
API documentation can be generated from the top level directory with the
following command (see also requirements below)```console
scons api-doc
```The generated documentation will be written to ``build/doc/api``.
#### Requirements for user-doc
To generate user's documentation, you'll need following packages on your
system:* docbook5-xml
* xsltproc
* imagemagickYou also must install locally the SCons docbook tool by Dirk Baechle:
* scons docbook tool
this is easily done by running the following bash script
```
python bin/downloads.py scons-docbook
```or simply (to download all dependencies)
```
python bin/downloads.py
```from the top level directory.
#### Requirements for api-doc
To generate API documentation, you may need following packages on your system:
* python-epydoc
* python-docutils
* python-pygmentsNote, that epydoc is no longer developed, last activities in the project are
dated to 2008. The pip epydoc package 3.0.1 is not usable with current versions
of python. Fortunately Debian package is patched to work with current python.
Please use the ``python-epydoc`` package installed with apt-get.```console
apt-get install python-epydoc python-docutils python-pygments
```TESTING
-------We provide unit tests and end-to-end tests.
### Running unit tests
To run unit tests type
```console
scons unit-test
```### Requirements for unit tests
* python-unittest2
* python-mockOn Debian install them with:
```console
apt-get install python-unittest2 python-mock
```### Running end-to-end tests
To run end-to-end tests, type
```console
scons test
```End-to-end tests are stored under ``test/`` directory. To run particular test
type (on Linux):```console
SCONS_EXTERNAL_TEST=1 python runtest.py test/SConsArguments/ArgumentDeclaration/sconstest-argumentdeclaration_1.py
```### Requirements for end-to-end tests
* SCons testing framework
Download the SCons testing framework with:
```console
python ./bin/downloads.py scons-test
```or
```console
python ./bin/downloads.py
```LICENSE
-------Copyright (c) 2015-2017 by Pawel Tomulik
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE