PortGroup python allows for efficient porting of python-based open source software.
Portfiles using the python PortGroup allow for port authors to set the following keywords in addition to the general Portfile keywords.
Defines the python versions supported by this port.
If the port name starts with “py-”, then a subport will be defined for each version in the list.
For example, if a port named “py-foo” declares +python.versions 26 27+
, subports “py26-foo” and “py27-foo” will be created, and will depend on python26 and python27 respectively.
If the port name does not start with “py-”, it is interpreted as an application written in python rather than a python module.
In this case, no subports are defined, and python.versions
defaults to the value of +python.default_version+
, which must be set.
For example, if a port named “mercurial” sets +python.default_version 27+
, then python.versions
will automatically be set to “27”, and a dependency on python27 will be added.
Example:
python.versions 25 26 27
For modules (i.e., name starts with “py-”), this sets the subport that will be installed if the user asks to install “py-foo” rather than, e.g., “py26-foo” or “py27-foo”.
If not explicitly set, a reasonable default is chosen from the list in +python.versions+
.
For applications (i.e., name does not start with “py-”), this chooses which version of python to use, and must be set. It can be changed in variants if desired.
Example:
python.default_version 32
When “yes” (the default), tells the PortGroup to automatically link any executable binaries installed in the bin/ directory within the framework into ${prefix}/bin
.
Example:
python.link_binaries no
Suffix to add to the names of the links created in ${prefix}/bin
when ${python.link_binaries}
is enabled.
Can be cleared if no suffix is desired.
+${python.branch}+
When yes (the default), the PortGroup will automatically try to pass the correct arch-specific flags during build time (via the standard CFLAGS, LDFLAGS, etc environment variables). Set this to “no” and set up those variables in build.env
manually if the default does not work.
Example:
python.add_archflags no
When the python PortGroup is declared within a Portfile, the following variables are provided.
+python.versions+
.python.version
is “26”, python.branch
will be “2.6”.${frameworks_dir}/Python.framework/Versions/${python.branch}
, whereas for non-framework builds, it is the same as +${prefix}+
.${python.prefix}/Python
(framework builds) or ${prefix}/lib/libpython2.4.dylib
(python24).${python.prefix}/lib/python${python.branch}
.${python.prefix}/lib/python${python.branch}/site-packages
).Portfiles using PortGroup python do not need to define the following variables:
${python.version}
${python.bin}
setup.py --no-user-cfg${python.bin}
setup.py --no-user-cfg+${python.prefix}+
--root=+${destroot}+
${destroot}${prefix}/share/doc/${subport}/examples
.