InstallPython¶
Define function install_python() to (optionally generate and)
invoke a Python distutils setup.py script.
- install_python¶
Invoke Python
distutilsfunctionality to install Python files.install_python(SETUP_PY <setup.py> [NO_INSTALL]) install_python([GENERATE_SETUP_PY] [NO_INSTALL] [<gen-options>])
- install_python(SETUP_PY <setup.py> [NO_INSTALL])¶
Invoke
<setup.py>to build and install Python package files.
- install_python(GENERATE_SETUP_PY [NO_INSTALL] [<gen-options>])¶
Generate a
setup.pyfile with information provided by<gen-options>:DATA_FILES DIR <dir> <file> ...Specify
<file> ...` for inclusion in the package in non-package subdirectory ``<dir>.
MODULES <module> ...Specify single Python files for use as modules (with import). They will be installed in
lib/NAME <name>The name of the Python package to be installed (default
CETMODULES_CURRENT_PROJECT_NAME).PACKAGES <package> ...Specify packages to be installed under
lib/, withpkg1.pkg2installed inpkg1/pkg2.PACKAGE_DATA { ROOT | PKG <pkg> } <file> ...Install non-Python
<file> ...in the top level package (ROOT) or with package<pkg>.SCRIPTS <script> ...Install executable Python script
<script> ...inbin/If required, the same file may be both a script and a module.
See also
SETUP_ARGS <arg> ...Pass
<arg> ...to thedistutilssetup()command, if required.SETUP_PREAMBLE <preamble>Place
<preamble>at the beginning of the generatedsetup.pyfile prior to the invocation ofsetup().VERSION <version>Specify the package version (default
CETMODULES_CURRENT_PROJECT_VERSION).
Example¶
For a directory containing the following files:
README.txttest.pytest2.pytest3.pypkg1/README-pkg1.txtpkg1/__init__.pypkg1/bill.pypkg1/pkg2/README-pkg2.txtpkg1/pkg2/__init__.pypkg1/pkg2/fred.py
The command:
install_python(SCRIPTS test.py test2.py test3.py MODULES test2 PACKAGES pkg1 pkg1.pkg2 PACKAGE_DATA ROOT README.txt PKG pkg1 README-pkg1.txt DATA_FILES DIR doc README.txt pkg1/README-pkg1.txt pkg1/pkg2/README-pkg2.txt DIR etc README.txt pkg1/README-pkg1.txt pkg1/pkg2/README-pkg2.txt)
will produce the following directory structure under
CETMODULES_CURRENT_PROJECT_BINARY_DIR:bin/test.pybin/test2.pybin/test3.pydoc/README.txtdoc/README-pkg1.txtdoc/README-pkg2.txtetc/README.txtetc/README-pkg1.txtetc/README-pkg2.txtlib/art-1.09.02-py2.7.egg-infolib/pkg1/__init__.pylib/pkg1/__init__.pyclib/pkg1/bill.pylib/pkg1/bill.pyclib/pkg1/pkg2/__init__.pylib/pkg1/pkg2/__init__.pyclib/pkg1/pkg2/fred.pylib/pkg1/pkg2/fred.pyclib/pkg1/README-pkg1.txtlib/test2.pylib/test2.pyc
After install, the same files will be visible under the corresponding directory in the installed product.
Cetmodules