[MacPorts] #40734: python PortGroup: add variants instead of subports with python.versions in apps

MacPorts noreply at macports.org
Thu Oct 10 16:07:01 PDT 2013


#40734: python PortGroup: add variants instead of subports with python.versions in
apps
-------------------------+--------------------------------
 Reporter:  mojca@…      |      Owner:  macports-tickets@…
     Type:  enhancement  |     Status:  new
 Priority:  Normal       |  Milestone:
Component:  ports        |    Version:
 Keywords:               |       Port:
-------------------------+--------------------------------
 This is related to a request in #38535 to support multiple python versions
 in an app. I checked other ports what they do and here's an example from
 `gnuradio` where a lot of code could be greatly simplified with an
 appropriate option in the `PortGroup`, in particular the last few lines
 (which seem to be slightly wrong anyway):
 {{{
 foreach s ${pythons_suffixes} {
     set p python${s}
     set v [join [split ${s} ""] "."]
     set i [lsearch -exact ${pythons_ports} ${p}]
     set c [lreplace ${pythons_ports} ${i} ${i}]
     eval [subst {
         variant ${p} description "Build GNU Radio using Python ${v}" \
             conflicts ${c} {

             set chosen_python_suffix ${s}

             # specify the Python dependencies

             depends_lib-append \
                 port:${p} \
                 port:py${s}-numpy \
                 port:py${s}-cheetah

             depends_run-append \
                 port:py${s}-opengl \
                 port:py${s}-scipy

             # specify the Python version to use

             configure.args-append \
                 -DPYTHON_EXECUTABLE=${prefix}/bin/python${v} \
 -DPYTHON_INCLUDE_DIR=${prefix}/Library/Frameworks/Python.framework/Versions/${v}/Headers
 \
 -DPYTHON_LIBRARY=${prefix}/Library/Frameworks/Python.framework/Versions/${v}/Python
 \
 ...
 }}}

 My request would be to add functionality to the existing `python
 PortGroup` which would create a bunch of variants for apps instead of
 subports (like for python modules).

 My request would be to treat
 {{{
 python.versions "25 26 27"
 }}}
 in an app equivalent to
 {{{
 variant python25 conflicts python26 python27 description {Use Python 2.5}
 {
    ...
 }
 variant python26 conflicts python25 python27 description {Use Python 2.6}
 {
    ...
 }
 variant python27 conflicts python25 python26 description {Use Python 2.7}
 {
    ...
 }
 if {![variant_isset python25] && ![variant_isset python26] &&
 ![variant_isset python27]} {
     default_variants +python${python.default_version}
 }
 }}}
 while still allowing easy settings like
 {{{
 depends_lib-append  port:py${python.version}-wxpython-3.0
 }}}
 or is that impossible?

 In addition to this it would be nice if the PortGroup could work
 flawlessly with C as well, so that a setting similar to
 {{{
 python.use_python_compiler no
 }}}

 would only set variables like `${python.version}`, `${python.bin}`, ...
 and likewise create variants (if more than one python version is
 supported) rather than redefining all compile/make steps which render the
 PortGroup useless in contexts other than proper Python code.

-- 
Ticket URL: <https://trac.macports.org/ticket/40734>
MacPorts <http://www.macports.org/>
Ports system for OS X


More information about the macports-tickets mailing list