Ticket #43544: Portfile.diff

File Portfile.diff, 8.7 KB (added by lockhart (Thomas Lockhart), 10 years ago)

Patches to add python libraries and utilities to the sumo installation updated to include ryandesign comments.

  • Portfile

    old new  
    11# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
    2 # $Id: Portfile 119599 2014-05-02 07:55:38Z ryandesign@macports.org $
     2# $Id: Portfile 119083 2014-04-16 20:47:35Z macsforever2000@macports.org $
    33
    44PortSystem          1.0
    55
    66name                sumo
    77conflicts           sumo-devel
    88version             0.20.0
     9revision            2
    910categories          science devel
    1011platforms           darwin
    1112maintainers         me.com:jens.fahnenbruck \
     
    2223homepage            http://sumo-sim.org/
    2324master_sites        sourceforge:project/sumo/sumo/version%20${version}/
    2425
     26
    2527distname            ${name}-src-${version}
    2628worksrcdir          ${name}-${version}
    2729
     
    3537    port:proj \
    3638    port:xercesc
    3739
     40# py27-matplotlib requires perl so let it choose which version
     41depends_lib-append \
     42    port:python27 \
     43    port:py27-matplotlib
     44
     45set sharedir          ${prefix}/share/${name}
     46set docdir            ${prefix}/share/doc/${name}
     47set python_bin        ${frameworks_dir}/Python.framework/Versions/2.7/bin/python2.7
     48set python_lib        ${frameworks_dir}/Python.framework/Versions/2.7/lib/python2.7/site-packages
     49set perl_bin          "/usr/bin/env perl"
     50
     51post-patch {
     52    reinplace "s#std::getenv(\"SUMO_HOME\")#\"${sharedir}\"#" src/utils/xml/SUMOSAXReader.cpp
     53    reinplace "s#\./PHEMlight/#${sharedir}/data/PHEMlight/#" src/microsim/MSFrame.cpp
     54    reinplace "s#\./PHEMlight/#${sharedir}/data/PHEMlight/#" src/router/ROFrame.cpp
     55    reinplace -locale C "s#./PHEMlight/#${sharedir}/data/PHEMlight/#" src/tools/emissionsDrivingCycle_main.cpp
     56    reinplace -locale C "s#./PHEMlight/#${sharedir}/data/PHEMlight/#" src/tools/emissionsMap_main.cpp
     57    set python_bin ${frameworks_dir}/Python.framework/Versions/2.7/bin/python2.7
     58    foreach f $python_scripts {
     59        reinplace "s#/usr/bin/env python#${python_bin}#" $f
     60        reinplace -E "s|^(sys.path.append)|# \\1|" $f
     61        reinplace -E "s#^from (dijkstra|inputs)#from assign.\\1#" $f
     62        reinplace -E "s#^import (xsd|collectinghandler|connections|turndefinitions|rmsd)#from sumolib import \\1#" $f
     63        reinplace -E "s#^import (os,.*), helpers#import \\1, sumolib.helpers as helpers#" $f
     64    }
     65    foreach f $perl_scripts {
     66        reinplace "s#/usr/bin/perl#${perl_bin}#" $f
     67    }
     68}
     69
     70# List of all python scripts. Used later to ensure usage of python27
     71# (instead of the currently active python)
     72set python_scripts [ list \
     73    tools/bin/traceExporter.py \
     74    tools/assign/Assignment.py \
     75    tools/assign/cadytsIterate.py \
     76    tools/assign/costFunctionChecker.py \
     77    tools/assign/duaIterate.py \
     78    tools/assign/duaIterate_analysis.py \
     79    tools/assign/matrixDailyToHourly.py \
     80    tools/assign/networkStatistics.py \
     81    tools/assign/one-shot.py \
     82    tools/assign/run.py \
     83    tools/detector/aggregateFlows.py \
     84    tools/detector/deleteUnusedDetectors.py \
     85    tools/detector/flowFromRoutes.py \
     86    tools/net/0103to0110.py \
     87    tools/net/0123to0130.py \
     88    tools/net/batch0103to0110.py \
     89    tools/net/createRoundaboutConnections.py \
     90    tools/net/netcheck.py \
     91    tools/net/netdiff.py \
     92    tools/net/netduplicate.py \
     93    tools/net/netextract.py \
     94    tools/net/netextract_subPart.py \
     95    tools/net/netmatch.py \
     96    tools/net/netshiftadaptor.py \
     97    tools/net/netstats.py \
     98    tools/net/network_statistics.py \
     99    tools/net/odConnectionsCheck.py \
     100    tools/net/OrderedMultiSet.py \
     101    tools/net/patchNetFiles.py \
     102    tools/net/prepareVISUM.py \
     103    tools/net/reprojectpolys.py \
     104    tools/net/visum_mapDistricts.py \
     105    tools/net/xmlconnections_mapEdges.py \
     106    tools/net/xmledges_applyOffset.py \
     107    tools/net/xmlnodes_applyOffset.py \
     108    tools/output/accelerations.py \
     109    tools/output/analyze_teleports.py \
     110    tools/output/generateITetrisIntersectionMetrics.py \
     111    tools/output/generateITetrisNetworkMetrics.py \
     112    tools/output/generateMeanDataDefinitions.py \
     113    tools/output/generateTLSE1Detectors.py \
     114    tools/output/generateTLSE2Detectors.py \
     115    tools/output/generateTLSE3Detectors.py \
     116    tools/output/netdumpdiff.py \
     117    tools/output/netdumpmean.py \
     118    tools/output/timingStats.py \
     119    tools/output/vehLanes.py \
     120    tools/output/vehrouteDiff.py \
     121    tools/route/cutRoutes.py \
     122    tools/route/extract_route_edges.py \
     123    tools/route/findUTurns.py \
     124    tools/route/kShortest.py \
     125    tools/route/route2alts.py \
     126    tools/route/route2poly.py \
     127    tools/route/route_1htoDay.py \
     128    tools/route/route_departOffset.py \
     129    tools/route/routecheck.py \
     130    tools/route/routecompare.py \
     131    tools/route/routes2OD.py \
     132    tools/route/routes_Join.py \
     133    tools/route/sort_routes.py \
     134    tools/route/tracegenerator.py \
     135    tools/route/tracemapper.py \
     136    tools/route/vehicle2flow.py \
     137    tools/shapes/circlePolygon.py \
     138    tools/shapes/CSV2polyconvertXML.py \
     139    tools/shapes/poi_alongRoads.py \
     140    tools/shapes/poi_atTLS.py \
     141    tools/shapes/pois2inductionLoops.py \
     142    tools/trigger/csv2vss.py \
     143    tools/trip/randomTrips.py \
     144    tools/trip/generateTripsXml.py \
     145    tools/trip/route2trips.py \
     146    tools/turn-defs/generateTurnDefs.py \
     147    tools/visualization/mpl_dump_onNet.py \
     148    tools/visualization/mpl_dump_timeline.py \
     149    tools/visualization/mpl_dump_twoAgainst.py \
     150    tools/visualization/mpl_tripinfos_twoAgainst.py \
     151    tools/visualization/plot_csv_bars.py \
     152    tools/visualization/plot_csv_pie.py \
     153    tools/visualization/plot_csv_timeline.py \
     154    tools/visualization/plot_net_dump.py \
     155    tools/visualization/plot_net_selection.py \
     156    tools/visualization/plot_net_speeds.py \
     157    tools/visualization/plot_net_trafficLights.py \
     158    tools/visualization/plot_summary.py \
     159    tools/visualization/plot_tripinfo_distributions.py \
     160    tools/xml/addSchema.py \
     161    tools/xml/binary2plain.py \
     162    tools/xml/csv2xml.py \
     163    tools/xml/protobuf2xml.py \
     164    tools/xml/rebuildSchemata.py \
     165    tools/xml/schemaCheck.py \
     166    tools/xml/xml2csv.py \
     167    tools/xml/xml2protobuf.py \
     168    tools/xml/xsd.py ]
     169
     170set perl_scripts [ list \
     171    tools/trip/removeGeometryInTrips.pl \
     172    tools/trip/removeTripsIfNotInInterval.pl \
     173    tools/trip/splitTripsByHours.pl ]
     174
    38175# required for the gui to be enabled
    39176configure.args-append \
    40177    --with-fox=${prefix}
     
    69206        --disable-traci
    70207}
    71208
    72 livecheck.regex     /${name}-all-(\[0-9.\]+)${extract.suffix}
     209post-destroot {
     210    xinstall -m 755 -d ${destroot}${python_lib}
     211    file copy ${worksrcpath}/tools/sumolib ${destroot}${python_lib}/
     212    if {![variant_isset no_traci]} {
     213        file copy ${worksrcpath}/tools/traci ${destroot}${python_lib}/
     214    }
     215    file copy ${worksrcpath}/tools/assign ${destroot}${python_lib}/sumolib/
     216    touch ${destroot}${python_lib}/sumolib/assign/__init__.py
     217    file copy ${worksrcpath}/tools/turn-defs/connections.py ${destroot}${python_lib}/sumolib/
     218    file copy ${worksrcpath}/tools/turn-defs/turndefinitions.py ${destroot}${python_lib}/sumolib/
     219    # xinstall -m 755 -d ${destroot}${python_lib}/detector
     220    xinstall -m 755 ${worksrcpath}/tools/detector/detector.py ${destroot}${python_lib}/sumolib/
     221    xinstall -m 755 ${worksrcpath}/tools/turn-defs/collectinghandler.py ${destroot}${python_lib}/sumolib/
     222    xinstall -m 755 ${worksrcpath}/tools/visualization/helpers.py ${destroot}${python_lib}/sumolib/
     223    xinstall -m 755 ${worksrcpath}/tools/lib/rmsd.py ${destroot}${python_lib}/sumolib/
     224    xinstall -m 755 ${worksrcpath}/tools/lib/play.png ${destroot}${python_lib}/sumolib/
     225    xinstall -m 755 ${worksrcpath}/tools/lib/stop.png ${destroot}${python_lib}/sumolib/
     226    xinstall -m 755 ${worksrcpath}/tools/lib/testUtil.py ${destroot}${python_lib}/sumolib/
     227
     228    foreach f [list {*}$python_scripts {*}$perl_scripts] {
     229        # convert file names to use dash rather than underscore and remove trailing .py or .pl
     230        set x [string map [list _ -] [file rootname [file tail ${f}]]]
     231        xinstall -m 755 ${worksrcpath}/${f} ${destroot}${prefix}/bin/sumo-${x}
     232    }
     233
     234    xinstall -m 755 -d ${destroot}${sharedir}
     235    foreach d [list emissions typemap xsd] {
     236        file copy ${worksrcpath}/data/${d} ${destroot}${sharedir}/${d}/
     237    }
     238    # tests/ is not included in the source tarball
     239    # file copy ${worksrcpath}/tests ${destroot}${sharedir}/
     240
     241    xinstall -m 755 -d ${destroot}${docdir}
     242    xinstall ${worksrcpath}/README ${destroot}${docdir}/
     243    file copy ${worksrcpath}/docs/examples ${destroot}${docdir}/
     244    file copy ${worksrcpath}/docs/tutorial ${destroot}${docdir}/
     245    file copy ${worksrcpath}/data ${destroot}${sharedir}/data/
     246}