Python assistance
Sean Farley
sean.michael.farley at gmail.com
Thu Nov 15 16:55:50 PST 2012
On Thu, Nov 15, 2012 at 5:42 PM, Craig Treleaven <ctreleaven at cogeco.ca> wrote:
> Hi:
>
> Background - MythTV is primarily written in C and C++ but certain functions
> are implemented in Python. Not knowing Python--and more specifically Python
> on OS X and even more specifically, Python on OS X via MacPorts--I am at a
> loss as to the proper method to install Myth's Python bindings. See
> https://trac.macports.org/ticket/36783
>
> Currently, Myth's Python bindings are being installed to:
> /opt/local/lib/python2.6/site-packages/MythTV
>
> I understand they should be installed to:
> /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages
>
> A user noticed that the shebang line on the involved setup.py was:
> #!/usr/bin/env python
>
> However, even after changing this to:
> #!/opt/local/bin/python2.6
>
> the bindings are still installed to the wrong place. The relevant bit of
> the debug log seems to be:
>>
>> make[1]: Entering directory
>> `/opt/local/var/macports/build/_Users_craigtreleaven_MacPortsTemp_mythtv-core.25_rev7/mythtv-core.25/work/mythtv-117b611e/mythtv/bindings/python'
>> /opt/local/bin/python2.6 setup.py install --skip-build
>> --root="/opt/local/var/macports/build/_Users_craigtreleaven_MacPortsTemp_mythtv-core.25_rev7/mythtv-core.25/work/destroot"
>> --prefix="/opt/local"
>> running install
>> running install_lib
>> creating
>> /opt/local/var/macports/build/_Users_craigtreleaven_MacPortsTemp_mythtv-core.25_rev7/mythtv-core.25/work/destroot/opt/local/lib/python2.6
>> creating
>> /opt/local/var/macports/build/_Users_craigtreleaven_MacPortsTemp_mythtv-core.25_rev7/mythtv-core.25/work/destroot/opt/local/lib/python2.6/site-packages
>> creating
>> /opt/local/var/macports/build/_Users_craigtreleaven_MacPortsTemp_mythtv-core.25_rev7/mythtv-core.25/work/destroot/opt/local/lib/python2.6/site-packages/MythTV
>
>
> [Many lines omitted...]
>
> Is it the --prefix flag that I need to modify? Do I just append
> '/Library/Frameworks/Python.framework/Versions/2.6'? Or is there something
> else?
When I have questions like these, I find the codesearch tool helpful:
http://code.google.com/p/codesearch/
Using it, I can easily search all portfiles in less than a second:
$ csearch -f Portfile setup.py.*prefix | less
/opt/local/var/macports/sources/rsync.macports.org/release/tarballs/ports/audio/sphinx3/Portfile:
system "cd ${worksrcpath}/python && ${python.bin} setup.py
--no-user-cfg install --prefix=${python.prefix} --root=${destroot}"
/opt/local/var/macports/sources/rsync.macports.org/release/tarballs/ports/audio/sphinxtrain/Portfile:
system "cd ${worksrcpath}/python && ${python.bin} setup.py
--no-user-cfg install --prefix=${python.prefix} --root=${destroot}"
/opt/local/var/macports/sources/rsync.macports.org/release/tarballs/ports/graphics/vtk5/Portfile:
system "cd ${worksrcpath}/Wrapping/Python &&
${prefix}/bin/python${v} setup.py install
--prefix=${frameworks_dir}/Python.framework/Versions/${v}
--root=${destroot}"
/opt/local/var/macports/sources/rsync.macports.org/release/tarballs/ports/science/pymol/Portfile:
file copy ${worksrcpath}/setup/pymol_macports
${destroot}${prefix}/bin/pymol
/opt/local/var/macports/sources/rsync.macports.org/release/tarballs/ports/science/pymol-devel/Portfile:
file copy ${worksrcpath}/setup/pymol_macports
${destroot}${prefix}/bin/pymol
By the way, the portfiles were indexed with the command:
$ cindex /opt/local/var/macports/sources/rsync.macports.org/release/tarballs/ports
To answer your question, it would seem that you need to set
--prefix={$python.prefix} and --root=${destroot}
More information about the macports-dev
mailing list