Opened 11 days ago

#59925 assigned defect

pypy @7.3.0: reinplace /MACOSX_DEPLOYMENT_TARGET/s/10\.\([0-9]*\)/10.7/ didn't change anything

Reported by: ryandesign (Ryan Schmidt) Owned by: danchr (Dan Villiom Podlaski Christiansen)
Priority: Normal Milestone:
Component: ports Version: 2.6.2
Keywords: lion Cc:
Port: pypy


On Lion only, this warning appears:

Warning: reinplace /MACOSX_DEPLOYMENT_TARGET/s/10\.\([0-9]*\)/10.7/ didn't change anything in /opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_lang_pypy/pypy/work/pypy2.7-v7.3.0-src/lib-python/2.7/distutils/

This is because the file starts out specifying a deployment target of 10.7, so changing it to 10.7 again does nothing.

This was caused by [460f1b130da2390b624240a135f572aca13de9e0/macports-ports]. Going back to the method used before that commit—doing the reinplace only if the current deployment target is not the deployment target already mentioned in the file—is one possible fix.

If you do it that way, then note that you don't need the escaped parentheses in the regular expression. They capture the number between them, but you're not using the captured value in the replacement expression.

You could also use \d as a shorthand for [0-9] in the regular expression. (Since the Portfile requires one additional level of escaping for Tcl, that would be \\d in the Portfile.)

Also, you probably want to match one or more digits, not zero or more digits. That's + instead of *, but that also requires invoking reinplace with the -E flag to turn on extended regular expressions. So ultimately it would be:

    if {${python.branch} == "2.7" && ${macosx_deployment_target} != "10.7"} {
        reinplace -E "/MACOSX_DEPLOYMENT_TARGET/s/10\\.\\d+/${macosx_deployment_target}/" \

Alternately, do it the way we usually do: first with a patchfile that changes the hardcoded 10.7 to a placeholder like @MACOSX_DEPLOYMENT_TARGET@ and then a reinplace that changes @MACOSX_DEPLOYMENT_TARGET@ to the current deployment target. This has the added benefit of ensuring that if the source file changes significantly in some future version, the patch will fail to apply which will generate an error which will give you the opportunity to investigate if you need to change something for the new version.

Or even just remove all mention of MACOSX_DEPLOYMENT_TARGET from the build system. MacPorts already sets the right value for MACOSX_DEPLOYMENT_TARGET in the environment.

Change History (0)

Note: See TracTickets for help on using tickets.