setuptools_configure
adds a configure step to setuptools-based projects,
that allows you to define variables that can be substituted in the distribution
metadata or any project file.
Every major build system like autotools
, cmake
or scons
,
includes facilities to configure builds.
- ..code:: python
from setuptools_configure import setup
- setup(name='my-project',
version='1.0', substitutions={
'': '',
}, )
setuptools_configure
already predefines the following variables for you.
You may overwrite these variables.
PACKAGE_NAME
- The value given to the
name
keyword argument of thesetup
function. PACKAGE_VERSION
,PACKAGE_AUTHOR
,PACKAGE_AUTHOR_EMAIL
,PACKAGE_URL
- Like
PACKAGE_NAME
.
Most of the time, you want to be able to access the build configuration during
the runtime of your code.
You could write a template, e.g constants.py.in
and declare it in
configure_files
.
However, this is tedious and error-prone, as you have to
You can declare constants_module
which contains all substitution
variables and their values and which will be generated automatically
by setuptools_configure
during the configure
step.
Most setuptools extensions can be used without importing them directly in the
setup.py
file.
Either they are just installed and their commands and keywords are available
through pkg_resources
entry point mechanism or they can be depended on
explicitly with the setup_requires
keyword argument of the setup
function.
setuptools_configure
however can not work this way, due to the
implementation of distutils
and setuptools
.
A custom setup
function is necessary, that is executed before
setuptools
does anything. This means that you have to have
setuptools_configure
installed before you can run setup.py
.
- Initial release