Ticket #49397: Portfile.diff

File Portfile.diff, 5.9 KB (added by lockhart (Thomas Lockhart), 9 years ago)

Update portfile with new files and regex patterns to fix paths

  • Portfile

    old new  
    55
    66name                sumo
    77version             0.24.0
    8 revision            1
     8revision            2
    99categories          science devel
    1010platforms           darwin
    1111maintainers         nomaintainer
     
    2727checksums           rmd160  712b8fc05dcc230940abe4d897357bb49d418e00 \
    2828                    sha256  b9fe97bdd0981098b3136456954b6ece718e5efb6a782b0f98f519ccf28a8429
    2929
     30default_variants    +subseconds +messages
     31
    3032depends_lib-append \
    3133    port:fox \
    3234    port:gdal \
     
    4042    port:py27-matplotlib \
    4143    port:py27-protobuf
    4244
     45set bindir            ${prefix}/bin
     46set libdir            ${prefix}/lib
    4347set sharedir          ${prefix}/share/${name}
    4448set docdir            ${prefix}/share/doc/${name}
    4549set python_bin        ${frameworks_dir}/Python.framework/Versions/2.7/bin/python2.7
    4650set python_lib        ${frameworks_dir}/Python.framework/Versions/2.7/lib/python2.7/site-packages
    4751
     52post-extract {
     53    copy ${filespath}/README.macosx ${worksrcpath}/
     54}
     55
    4856post-patch {
    4957    reinplace "s#std::getenv(\"SUMO_HOME\")#\"${sharedir}\"#" src/utils/xml/SUMOSAXReader.cpp
    5058    reinplace "s#\./PHEMlight/#${sharedir}/data/PHEMlight/#" src/microsim/MSFrame.cpp
     
    5462    set python_bin ${frameworks_dir}/Python.framework/Versions/2.7/bin/python2.7
    5563    foreach f [list {*}$python_scripts {*}$python_libs {*}$python_tutorials] {
    5664        reinplace "s#/usr/bin/env python#${python_bin}#" $f
    57         reinplace -E "s|^(sys.path.append)|# \\1|" $f
     65        reinplace -E "s|^( *)(sys.path.append)|\\1# \\2|" $f
     66        reinplace -E "s|^( *)(.*__file__.*\\.\\.)|\\1# \\2|" $f
     67        reinplace -E "s|^( *)(os.path.join.*\\.\\.)|\\1# \\2|" $f
     68        reinplace -E "s|^( *)(SUMO_HOME =)|\\1  # \\2|" $f
     69        reinplace -E "s|^(if .*SUMO_HOME)|if True:  # \\1|" $f
     70        reinplace -E "s|^( +)(.*os.path.join.*SUMO_HOME)|\\1# \\2|" $f
    5871        reinplace -E "s#^( *)from (assign|costMemory|dijkstra|duaIterate|elements|inputs|network|outputs|routeChoices|statisticsElements|tables)#\\1from sumolib.assign.\\2#" $f
    5972        reinplace -E "s#^( *)from (miscutils|OrderedMultiSet|output|testUtil)#\\1from sumolib.\\2#" $f
    60         reinplace -E "s#^import (xsd|xml2csv|collectinghandler|connections|netshiftadaptor|route_departOffset|turndefinitions|rmsd|xml2protobuf)#from sumolib import \\1#" $f
     73        reinplace -E "s#^import (detector|route2trips|xsd|xml2csv|collectinghandler|connections|netshiftadaptor|route_departOffset|sort_routes|turndefinitions|rmsd|xml2protobuf)#from sumolib import \\1#" $f
    6174        reinplace -E "s#^import (os,.*), helpers#import \\1, sumolib.helpers as helpers#" $f
    6275    }
     76    reinplace -E "s#@BINDIR@#${bindir}#" README.macosx
     77    reinplace -E "s#@LIBDIR@#${libdir}#" README.macosx
     78    reinplace -E "s#@DOCDIR@#${docdir}#" README.macosx
     79    reinplace -E "s#@PYTHON_LIBDIR@#${python_lib}#" README.macosx
    6380}
    6481
    6582# List of all python scripts. Used later to ensure usage of python27
    6683# (instead of the currently active python)
     84# available in the next release:
     85# tools/tlsCoordinator.py
    6786set python_scripts [list \
     87    tools/districts2poly.py \
     88    tools/edgesInDistricts.py \
     89    tools/generateBidiDistricts.py \
     90    tools/pedestrianFlow.py \
     91    tools/randomTrips.py \
     92    tools/route2trips.py \
     93    tools/route2sel.py \
     94    tools/traceExporter.py \
    6895    tools/assign/Assignment.py \
    6996    tools/assign/cadytsIterate.py \
    7097    tools/assign/costFunctionChecker.py \
     
    156183    tools/visualization/plot_net_trafficLights.py \
    157184    tools/visualization/plot_summary.py \
    158185    tools/visualization/plot_tripinfo_distributions.py \
    159     tools/xml/addSchema.py \
    160186    tools/xml/binary2plain.py \
    161187    tools/xml/csv2xml.py \
    162188    tools/xml/protobuf2xml.py \
     
    165191    tools/xml/xml2csv.py \
    166192    tools/xml/xml2protobuf.py \
    167193]
     194# not needed for an installation:
     195#    tools/xml/addSchema.py
    168196
    169197set python_libs [list \
     198    tools/route2trips.py \
    170199    tools/assign/assign.py \
    171200    tools/assign/costMemory.py \
    172201    tools/assign/dijkstra.py \
     
    244273    file copy ${worksrcpath}/tools/turn-defs/connections.py ${destroot}${python_lib}/sumolib/
    245274    file copy ${worksrcpath}/tools/turn-defs/turndefinitions.py ${destroot}${python_lib}/sumolib/
    246275    xinstall -m 755 ${worksrcpath}/tools/detector/detector.py ${destroot}${python_lib}/sumolib/
     276    xinstall -m 755 ${worksrcpath}/tools/route/sort_routes.py ${destroot}${python_lib}/sumolib/
    247277    xinstall -m 755 ${worksrcpath}/tools/turn-defs/collectinghandler.py ${destroot}${python_lib}/sumolib/
    248278    xinstall -m 755 ${worksrcpath}/tools/lib/rmsd.py ${destroot}${python_lib}/sumolib/
    249279    xinstall -m 755 ${worksrcpath}/tools/lib/play.png ${destroot}${python_lib}/sumolib/
     
    257287    foreach f [list {*}$python_scripts] {
    258288        # convert file names to use dash rather than underscore and remove trailing .py or .pl
    259289        set x [string map [list _ -] [file rootname [file tail ${f}]]]
    260         xinstall -m 755 ${worksrcpath}/${f} ${destroot}${prefix}/bin/sumo-${x}
     290        xinstall -m 755 ${worksrcpath}/${f} ${destroot}${bindir}/sumo-${x}
    261291    }
    262292
    263293    xinstall -m 755 -d ${destroot}${sharedir}
     
    268298    # file copy ${worksrcpath}/tests ${destroot}${sharedir}/
    269299
    270300    xinstall -m 755 -d ${destroot}${docdir}
    271     xinstall ${worksrcpath}/README ${destroot}${docdir}/
     301    file copy ${worksrcpath}/README ${destroot}${docdir}/
     302    file copy ${worksrcpath}/README.macosx ${destroot}${docdir}/
    272303    file copy ${worksrcpath}/docs/examples ${destroot}${docdir}/
    273304    file copy ${worksrcpath}/docs/tutorial ${destroot}${docdir}/
    274305    file copy ${worksrcpath}/data ${destroot}${sharedir}/data/
    275306}
    276307
     308post-install {
     309    ui_msg ""
     310    ui_msg "*** Many program names are prefixed by sumo- for this port."
     311    ui_msg "*** See ${docdir}/README.macosx for additional notes."
     312    ui_msg ""
     313}
     314
    277315livecheck.regex     ${name}-src-(\[0-9.\]+)${extract.suffix}