1 |
Hi All, |
2 |
|
3 |
I need some more testing for python-2.3.2 before it is released into |
4 |
~x86. This is a call to Gentoo developers and people interested in |
5 |
helping to test. |
6 |
|
7 |
If you test, make sure you know what you are doing. Portage requires |
8 |
python. It is best to have a binary package of your current portage and |
9 |
python, just in case something majorly bad happens. |
10 |
|
11 |
I would greatly appreciate any feedback on bugs and niggles with the |
12 |
upgrade process. Report bugs on bugs.gentoo.org please. I'll list some |
13 |
of the changes, points of interest and errata. |
14 |
|
15 |
How to Upgrade: |
16 |
=============== |
17 |
1. Unmask _both_ =dev-lang/python-2.3* and >=sys-apps/portage-2.0.49-r16 |
18 |
in package.mask. |
19 |
2. run: emerge -u portage python |
20 |
(note that -r16 should work with both 2.2 and 2.3) |
21 |
3. run: /usr/portage/dev-lang/python/python-updater |
22 |
|
23 |
Major Changes: |
24 |
============== |
25 |
Unicode support has a choice of UCS2 or UCS4. |
26 |
--------------------------------------------- |
27 |
|
28 |
UCS4 uses significantly more memory than UCS2. For those who are not |
29 |
familiar with unicode, UCS2 means representing unicode characters with |
30 |
16 bit words and UCS4 means representing unicode characters in 32 bit |
31 |
words. Not that both Redhat (>9) and Debian (unstable) have python-2.3 |
32 |
compiled with UCS4 by default. |
33 |
|
34 |
Currently, you get UCS4 if you have "cjk" in your USE flags because the |
35 |
only language to use the extra pane in UCS4 are CJK langauges. I've been |
36 |
using UCS4 for a while now and it works without any problems. |
37 |
|
38 |
The reason why I'm not making this default is because UCS4 python uses |
39 |
more memory. An example is supybot (Python IRC bot) that uses 8M for |
40 |
UCS2 and 13M for UCS4. But note that this example is not scientific |
41 |
because the machines were different in kernel version, compiler and |
42 |
compiler optimisations. |
43 |
|
44 |
I'm willing to listen to any ideas about whether to support UCS4 by |
45 |
default or not. |
46 |
|
47 |
The only problem that may occur is if you change between UCS2 and UCS4, |
48 |
you will need to recompile any external python codec packages like |
49 |
japanesecodec, koreancodec, cjkcodecs, iconvcodec. |
50 |
|
51 |
For those who want to know more about UCS and Unicode, you maybe |
52 |
interested in some articles like: |
53 |
http://uche.ogbuji.net/tech/akara/nodes/2003-01-01/characters |
54 |
http://www.python.org/cgi-bin/faqw.py?req=show&file=faq04.107.htp |
55 |
http://www.debian.org/doc/manuals/intro-i18n/ch-codes.en.html#s-unicodes-ccs |
56 |
|
57 |
Handling *.pyc *.pyo |
58 |
--------------------- |
59 |
|
60 |
The only other major change in the handling of python is with |
61 |
byte-compiled modules. With previous versions of python, portage had a |
62 |
problem tracking *.pyc and *.pyo files. The reason is that these files |
63 |
were registered with portage at install time, but may be modified at |
64 |
runtime if either the timestamp on the python executable has changed or |
65 |
the version has been upgraded. |
66 |
|
67 |
This traditionally created two problems. Firstly, *.pyc and *.pyo were |
68 |
left behind because their timestamps and md5sum didn't match when they |
69 |
were installed[1]. The second problem is that sometimes python gets run |
70 |
inside sandbox and suddenly requests certain .pyc and .pyo to be |
71 |
re-compiled, creating sandbox violations. You will notice special |
72 |
workarounds in libsandbox to avoid this problem. |
73 |
|
74 |
The solution I am now employing is the not let portage track the .pyc |
75 |
and .pyo, and generating them at pkg_postinst(). For package removals, a |
76 |
pkg_postrm(), orphaned *.pyc *.pyo (orphaned means the .pyc that don't |
77 |
have a corresponding .py) will be removed. The other problem with python |
78 |
recompiling modules at runtime is now solved by setting an environment |
79 |
variable (PY_DONTCOMPILE) during merging that prevents python from |
80 |
attempting to recompile modules. |
81 |
|
82 |
This is now implemented in python.eclass and distutils.eclass. If you |
83 |
maintain anything that creates python modules, you should either read |
84 |
the eclass to find out what needs to change for python-2.3 or email me |
85 |
the packages that need to be looked at. Most packages that use distutils |
86 |
should work automatically with this new scheme. |
87 |
|
88 |
[1] .. http://bugs.gentoo.org/show_bug.cgi?id=8804 |
89 |
|
90 |
Python Updater |
91 |
-------------- |
92 |
A neccessary evil for the upgrade is to recompile all the modules that |
93 |
depend on Python. I use a very simple rule to determine that. The rule |
94 |
is if a package has a file in /usr/lib/python2.2, then it will need to |
95 |
be re-emerged. |
96 |
|
97 |
There is some special magic that does that in |
98 |
/usr/portage/dev-lang/python/files/python-updater which is able to get |
99 |
all the packages, sort the dependencies to avoid merging problems and |
100 |
output a log file to /tmp/python-updater.log. |
101 |
|
102 |
I'd appreciate as much feedback on this as possible. Especially on |
103 |
whether I should run it in pkg_postinst() to make sure people who don't |
104 |
read the trailing einfo's actually upgrade their python modules. It |
105 |
might be technically unsound for me to run it in pkg_postinst() (nested |
106 |
emerge's sound like a bad idea.) |
107 |
|
108 |
Other Python Improvements |
109 |
-------------------------- |
110 |
* New version, supposedly faster by 30%. |
111 |
* bsddb support for 4.x |
112 |
* Supports generators (very spiffy for implementing weightless threads) |
113 |
* A new idle (python gui console) |
114 |
|
115 |
Known Problems: |
116 |
=============== |
117 |
* I haven't tried this on a install from scratch. Maybe someone can help |
118 |
me to create a stage with only 2.3 and see how things work. |
119 |
|
120 |
* Even though python-2.3.2 requires portage-2.0.49-r16, I can't put a |
121 |
dep in otherwise it may create a circular dependency. Probably the best |
122 |
solution would be to have a pkg_setup check before it goes ahead. |
123 |
|
124 |
* On some machines, portageq doesn't work after python upgrade. Make |
125 |
sure you are using the latest python version. |
126 |
(http://bugs.gentoo.org/show_bug.cgi?id=32374) |
127 |
|
128 |
Plan for Python's Future |
129 |
======================== |
130 |
* I'm aiming to push Python-2.3.2 to ~x86 in the next week or so. There |
131 |
are most likely packages that don't work under 2.3 that need to be |
132 |
upgraded. If you find one, please report it. |
133 |
|
134 |
* Maybe we should think about using a non version specific directory for |
135 |
Python modules to ease upgrade. |
136 |
|
137 |
That's all folks! |
138 |
|
139 |
Thanks, |
140 |
-- |
141 |
Alastair 'liquidx' Tse |
142 |
>> Gentoo Developer |
143 |
>> http://www.liquidx.net/ | http://dev.gentoo.org/~liquidx/ |