Re: newbie python - cmake build problem I can't seem to fix...

2016-09-09 Thread Ryan Schmidt

> On Sep 9, 2016, at 3:06 PM, Ken Cunningham wrote:
> 
>> 
>> It's not *bad*, just not ideal. If the build system doesn't respect 
>> PYTHON_EXECUTABLE, then upstream should fix that.
> 
> True.
> 
> As it turns out, I learned how to re-write the python to be compatible with 
> 3.x, and fixed the port that way. So that's probably the best outcome, and 
> I'll submit that upstream for them to fix someday.

That's good. But it still suggests that the port is building with whatever 
"python" is, which as you've seen is different on different systems. Does the 
code work with the very old version of python included on macOS Tiger? Will it 
work with the version of python included with whatever version of macOS comes 
after Sierra? You might not know. It might be better to pick a known good 
version of python, add that as a dependency, and make the port use that. This 
is not just a good idea but even required if the port were to do something like 
install a python module (because that python module would be for that one 
version of python), or needs python not just to build but to run (because it 
would run that version of python).


> Although I'd still like to know how to adjust the $PATH, if you feel so 
> inclined one day -- promise to use my powers for good and not for evil ...

I found a simple example of how to do this in the gupnp-igd port, which has 
this block:


variant python27 description {Enable Python 2.7 bindings} {
configure.args-replace  --disable-python --enable-python
depends_lib-append  port:py27-gobject
configure.python${prefix}/bin/python2.7
set python_prefix   ${frameworks_dir}/Python.framework/Versions/2.7
set python_pkg_config_path  ${python_prefix}/lib/pkgconfig
configure.pkg_config_path   ${python_pkg_config_path}
build.env-appendPATH=${python_prefix}/bin:$env(PATH)
}



___
macports-dev mailing list
macports-dev@lists.macosforge.org
https://lists.macosforge.org/mailman/listinfo/macports-dev


Re: newbie python - cmake build problem I can't seem to fix...

2016-09-09 Thread Ken Cunningham
> 
> It's not *bad*, just not ideal. If the build system doesn't respect 
> PYTHON_EXECUTABLE, then upstream should fix that.

True.

As it turns out, I learned how to re-write the python to be compatible with 
3.x, and fixed the port that way. So that's probably the best outcome, and I'll 
submit that upstream for them to fix someday.

Although I'd still like to know how to adjust the $PATH, if you feel so 
inclined one day -- promise to use my powers for good and not for evil ...

Ken


___
macports-dev mailing list
macports-dev@lists.macosforge.org
https://lists.macosforge.org/mailman/listinfo/macports-dev


Re: newbie python - cmake build problem I can't seem to fix...

2016-09-09 Thread Lawrence Velázquez
> On Sep 9, 2016, at 2:44 PM, Ken Cunningham  
> wrote:
> 
> I would -- but I haven't quite finished writing the portfile that would need 
> the ticket filed against it!

Aren't you modifying this?

https://trac.macports.org/browser/trunk/dports/emulators/hatari/Portfile

> I'll see if I can fix it without monkeying with the $PATH -- I knew nobody 
> would like that idea...

It's not *bad*, just not ideal. If the build system doesn't respect 
PYTHON_EXECUTABLE, then upstream should fix that.

vq
___
macports-dev mailing list
macports-dev@lists.macosforge.org
https://lists.macosforge.org/mailman/listinfo/macports-dev


Re: newbie python - cmake build problem I can't seem to fix...

2016-09-09 Thread Ken Cunningham
> 
> You should also file a ticket against hatari.

I would -- but I haven't quite finished writing the portfile that would need 
the ticket filed against it!

I'll see if I can fix it without monkeying with the $PATH -- I knew nobody 
would like that idea... there's something amiss in the python configuration 
script in the port I think. Maybe I can get it that way.

K


___
macports-dev mailing list
macports-dev@lists.macosforge.org
https://lists.macosforge.org/mailman/listinfo/macports-dev


Re: newbie python - cmake build problem I can't seem to fix...

2016-09-09 Thread Lawrence Velázquez
> On Sep 9, 2016, at 1:56 PM, Ken Cunningham  
> wrote:
> 
> I might dig into the build script and see what's going on in there, but 
> before I do that is there a way to monkey with the $PATH for the build only, 
> and then set it back to the user's $PATH when we're done?
> 
> That's cheating, I know.. but I could put ${prefix}/bin/python2.7 at the head 
> of the $PATH temporarily...

PATH cannot contain filenames, only directory names.

I'm reluctant to tell you how to monkey with PATH or what you would add. It'd 
be better to figure out what the build system is doing.

You should also file a ticket against hatari.

vq
___
macports-dev mailing list
macports-dev@lists.macosforge.org
https://lists.macosforge.org/mailman/listinfo/macports-dev


Re: newbie python - cmake build problem I can't seem to fix...

2016-09-09 Thread Ken Cunningham
Thanks. Not working so well so far.

I might dig into the build script and see what's going on in there, but before 
I do that is there a way to monkey with the $PATH for the build only, and then 
set it back to the user's $PATH when we're done?

That's cheating, I know.. but I could put ${prefix}/bin/python2.7 at the head 
of the $PATH temporarily...

Ken
___
macports-dev mailing list
macports-dev@lists.macosforge.org
https://lists.macosforge.org/mailman/listinfo/macports-dev


Re: newbie python - cmake build problem I can't seem to fix...

2016-09-09 Thread Ryan Schmidt
On Sep 9, 2016, at 10:32, Ken Cunningham  
wrote:
> 
> Hi all, thanks in advance for the ongoing education, and I apologize for the 
> newbie questions.
> 
> 
> I'm working on updating a port (hatari) that only builds with python2.7 (or 
> more accurately, doesn't build with python35 selected , but does build with 
> python27 selected). it uses cmake, and FindPythonInterp to find python. 
> 
> 
> If I ensure "sudo port select python python27" and then build, all goes well. 
> if I have python35 selected, the build fails, on SL and on El Cap.
> 
> I've pulled my hair out trying to find a portfile command that will force it 
> to build with python27 even if the user has previously selected python35.
> 
> Here's what I've tried so far, none of which have worked to override the 
> user's set python. I know I'm missing something simple thanks.
> 
> Ken
> 
> 
> 
> 
> # port builds with python27 but not 3.5
> 
> #configure.python   ${prefix}/bin/python2.7
> 
> #build.env-append  PYTHON=${prefix}/bin/python2.7
> #build.env-append  PYTHONEXECUTABLE=${prefix}/bin/python2.7
> #build.env-append  PYTHON_EXECUTABLE=${prefix}/bin/python2.7
> #build.env-append  PYTHON_VERSION_MAJOR=2
> #build.env-append  PYTHON_VERSION_MINOR=7
> 
> 
> #configure.env-append  PYTHON=${prefix}/bin/python2.7
> #configure.env-append  PYTHON_EXECUTABLE=${prefix}/bin/python2.7
> #configure.env-append  PYTHON_VERSION_MAJOR=2
> #configure.env-append  PYTHON_VERSION_MINOR=7
> 
> 
> #configure.args-append  PYTHON_VERSION_MAJOR=2
> #configure.args-append  PYTHON_VERSION_MINOR=7
> 
> 
> but no matter, I get 
> 
> :info:configure -- Found PythonInterp: /opt/local/bin/python (found version 
> "3.5.2") 
> 
> and the build fails, unless I "sudo port select python python27" first.

You may not be missing anything. I've found cmake to be pretty awful. Maybe try:

configure.args-append -DPYTHON_EXECUTABLE=${prefix}/bin/python2.7



___
macports-dev mailing list
macports-dev@lists.macosforge.org
https://lists.macosforge.org/mailman/listinfo/macports-dev


Re: newbie python - cmake build problem I can't seem to fix...

2016-09-09 Thread Rainer Müller
On 2016-09-09 17:32, Ken Cunningham wrote:
> I'm working on updating a port (hatari) that only builds with
> python2.7 (or more accurately, doesn't build with python35 selected ,
> but does build with python27 selected). it uses cmake, and
> FindPythonInterp to find python.
> 

PYTHON_EXECUTABLE is a cmake variable. Unlike make, cmake does not fill
in variables from the environment. Instead, you have to set/override
variables with command line arguments.

Try this:

configure.args-append   -DPYTHON_EXECUTABLE=${prefix}/bin/python2.7

Rainer
___
macports-dev mailing list
macports-dev@lists.macosforge.org
https://lists.macosforge.org/mailman/listinfo/macports-dev


newbie python - cmake build problem I can't seem to fix...

2016-09-09 Thread Ken Cunningham
Hi all, thanks in advance for the ongoing education, and I apologize for the 
newbie questions.


I'm working on updating a port (hatari) that only builds with python2.7 (or 
more accurately, doesn't build with python35 selected , but does build with 
python27 selected). it uses cmake, and FindPythonInterp to find python. 


If I ensure "sudo port select python python27" and then build, all goes well. 
if I have python35 selected, the build fails, on SL and on El Cap.

I've pulled my hair out trying to find a portfile command that will force it to 
build with python27 even if the user has previously selected python35.

Here's what I've tried so far, none of which have worked to override the user's 
set python. I know I'm missing something simple thanks.

Ken




# port builds with python27 but not 3.5

#configure.python   ${prefix}/bin/python2.7

#build.env-append  PYTHON=${prefix}/bin/python2.7
#build.env-append  PYTHONEXECUTABLE=${prefix}/bin/python2.7
#build.env-append  PYTHON_EXECUTABLE=${prefix}/bin/python2.7
#build.env-append  PYTHON_VERSION_MAJOR=2
#build.env-append  PYTHON_VERSION_MINOR=7


#configure.env-append  PYTHON=${prefix}/bin/python2.7
#configure.env-append  PYTHON_EXECUTABLE=${prefix}/bin/python2.7
#configure.env-append  PYTHON_VERSION_MAJOR=2
#configure.env-append  PYTHON_VERSION_MINOR=7


#configure.args-append  PYTHON_VERSION_MAJOR=2
#configure.args-append  PYTHON_VERSION_MINOR=7


but no matter, I get 

:info:configure -- Found PythonInterp: /opt/local/bin/python (found version 
"3.5.2") 

and the build fails, unless I "sudo port select python python27" first.
___
macports-dev mailing list
macports-dev@lists.macosforge.org
https://lists.macosforge.org/mailman/listinfo/macports-dev