pre-dependency phase?

Darren Weber dweber at macports.org
Tue May 12 17:29:45 PDT 2009


Perhaps entertain this idea for a few minutes and then forget about it.

The idea is to have a couple of variants for python25 and python26 in
vtk-devel.  If it works, the same logic might apply for any port that has
variants for a dependency on another version specific port, such that it
could effect multiple variants, e.g.: py25-<portname>, py26-<portname> could
be all accommodated as variants as in: port install <portname> +py25 or the
same port with python26 using: port install <portname> +py26  (I don't know
if it's possible to get both, as in: port install <portname> +py25 +py26).
Of course, let's assume that variant dependencies were possible for this to
be a potential reality (renaming all the py25-* ports would be a huge
change).


# A procedure to set or reset python variables
proc setPython { {major 2} {minor 6} } {
    global pyver python pyport pyframe
    set pyver        ${major}.${minor}
    set python       python${pyver}
    set pyport       python${major}${minor}
    set pyframe      Library/Frameworks/Python.framework/Versions/${pyver}
}
setPython

# The proc could be called from within a variant like this:
#pre-configure { setPython 2 6 }
#pre-configure { setPython }      # defaults to version 2.6

# For example,
variant py25 conflicts py26 requires shared description {python 2.5 wrapper}
{
    pre-configure { setPython 2 5 }
    depends_lib-append \
        port:${pyport}
    configure.args-delete \
        -DVTK_WRAP_PYTHON:BOOL=OFF
    configure.args-append \
        -DVTK_WRAP_PYTHON:BOOL=ON \
        -DVTK_NO_PYTHON_THREADS:BOOL=OFF \
        -DPYTHON_INCLUDE_PATH:FILEPATH=${prefix}/include/${python} \
        -DPYTHON_LIBRARY:FILEPATH=${prefix}/lib/lib${python}.dylib \
        -DPYTHON_DEBUG_LIBRARY:FILEPATH=${prefix}/lib/lib${python}.dylib \
        -DPYTHON_EXECUTABLE:FILEPATH=${prefix}/bin/${python} \
        -DVTK_PYTHON_SETUP_ARGS:STRING='--prefix=${prefix}
--root=${destroot}'
        # The VTK_PYTHON_SETUP_ARGS *MUST* be in single quotes
    post-destroot {
        # Reset the name of the vtkpython binary (create a symlink to the
        # version specific installation, in case other apps look for
vtkpython)
        move ${destroot}${prefix}/bin/vtkpython
${destroot}${prefix}/bin/vtk-${branch}-${pyport}
        ln -f -s ${destroot}${prefix}/bin/vtk-${branch}-${pyport}
${destroot}${prefix}/bin/vtkpython
        # etc
    }
}


The problem with this example is that the current port system would get
python26 in the depends-lib-append statement, which would be wrong for this
variant (right?).  Is it possible to call the setPython proc within a
variant such that all the python variables are set (or reset) before the
depends_lib-append is evaluated?  In this example, ${pyport} is python26
during the eval of depends_lib-append.  Only after pre-configure would it
become python25.  (Note this variant specifies that it conflicts with py26,
as only one can be used in the build.)

The same kind of proc might be used for things like mysql5, postgresqlXY,
etc.  In addition, within the proc, it should be possible to call things
like python_select or pg_config to init a bunch of variables for the current
version that a user has selected (if something is selected, otherwise
sensible defaults or no settings could be used in the init).

Regards,
Darren
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-dev/attachments/20090512/8b7250e8/attachment.html>


More information about the macports-dev mailing list