wiki:PythonFrameworkTransition

Version 3 (modified by reiffert@…, 16 years ago) (diff)

--

Python.framework transition

See the branches/python-frameworks branch.

Build python{24,25,30} ports as frameworks

(into ${prefix}/Library/Frameworks/Python.framework/Versions/{2.4,2.5,3.0}/)

  • Keep it as much similar to the default Python.framework for easier maintenance
  • Add the following symlinks:
    ${prefix}/lib/pythonXX -> ${prefix}/Library/Frameworks/Python.framework/Versions/XX/lib/pythonXX
    ${prefix}/lib/libpythonXX.dylib -> ${prefix}/Library/Frameworks/Python.framework/Versions/XX/lib/libpythonXX.dylib
    ${prefix}/include/pythonXX -> ${prefix}/Library/Frameworks/Python.framework/Versions/XX/include/pythonXX
    ${prefix}/share/doc/pythonXX -> ${prefix}/Library/Frameworks/Python.framework/Versions/XX/share/doc/pythonXX
    

Further transition work

python24

python24 is already a framework installation, but should be changed to match the scheme from above.

The py-* ports require the same transition as described for py25-* ports below.

python25

In order to safely upgrade especially python25 to a framework, we need:

  • A new python25 port group, which has to be released with one of the next MacPorts version. Efforts on this branch have to be coordinated with a release (targeting 1.6.1 or 1.6.2).
--- port1.0/group/python25-1.0.tcl.orig 2008-03-07 19:54:29.000000000 +0100
+++ port1.0/group/python25-1.0.tcl      2008-03-07 19:57:58.000000000 +0100
@@ -32,6 +32,8 @@
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #
 
+set prefix ${prefix}/Library/Frameworks/Python.framework/Versions/2.5
+
 set python.bin ${prefix}/bin/python2.5
 set python.lib ${prefix}/lib/libpython2.5.dylib
 set python.pkgd        ${prefix}/lib/python2.5/site-packages
  • All py25-* ports have to be removed *before* upgrading python25 itself, because we change lib/python2.5 from a directory into a symlink. Otherwise you will see errors with file_map.db.
  • Therefore we need some hook inside python25 to fire up on upgrading non-framework to framework. E.g. it would have to do, save a list of all installed py25-* ports before and uninstall them. After successful installation of python25, install these ports again. Because of the directory-to-symlink change, deactivate/activate does not work. This will be the main challenge.
  • There are two mutually exclusive ways to do the transitions. They get described here by pseudo-code. Feel free to replace by real commandos.

Way 1

pre-fetch {
 if ( $prefix does not end with 
      /Library/Frameworks/Python.framework/Versions/2.5)
 {
  echo "Run port selfupdate and retry"
  exit
 }

 if ( python25 is installed &&
      $prefix/Library/Frameworks/Python.framework/Versions/2.5 does not exist)
 {
  1. Save the names of all installed py25- ports
  2. Uninstall the list of all installed py25- ports
 }
}
post-activate {
 if ( previously saved list exists )
 {
  1. Install the ports from the previously saved list.
  2. Delete the list
 }
}


Way 2

pre-fetch {
 mv prefix/lib/python25/site-packages
  $prefix/Library/Frameworks/Python.framework/Versions/2.5/lib/python25
 adjust paths for installed py25-* ports in file 
  prefix/var/macports/receipts/file_map.db
}

python30

Nobody should be using python30 productively yet. python30 port group was also not released yet.

  • Make python30 install the same as other python versions.

python26

After all was sorted out, we can add a python26 port in the same manner for the upcoming next python release.