Salut les pythons,
J'ai compiler python 2.5.2 car j'en ai besoin pour créer des packages *.sis qui sont des programmes pour portable mais le problème vient de la mouture de python que j'ai compiler comme suit :
Code :
1
2
3
4
5
6
7
8
9
10
cd /home/mon_nom/zlib
./configure --prefix=/home/mon_nom/build
make
sudo make install
#zlib installer
cd /home/mon_nom/python-2.5.2
./configure --prefix=/home/mon_nom/build --includedir=/home/mon_nom/build/include --libdir=/home/mon_nom/build/lib --with-zlib
make
sudo make install
#python-2.5.2 installer avec zlib
et quand je lance le processus de compilation de fichiers *.sis j'ai le traceback suivant:
Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
 
 python2.5 ~/PythonForS60/ensymble.py py2sis --appname=Test test.py
Traceback (most recent call last):
  File "/home/edward/PythonForS60/ensymble.py", line 1115, in <module>
    import cmdmain
  File "/home/edward/Python-2.5.2/Lib/ihooks.py", line 404, in import_module
    q, tail = self.find_head_package(parent, str(name))
  File "/home/edward/Python-2.5.2/Lib/ihooks.py", line 440, in find_head_package
    q = self.import_it(head, qname, parent)
  File "/home/edward/Python-2.5.2/Lib/ihooks.py", line 495, in import_it
    m = self.loader.load_module(fqname, stuff)
  File "<package>", line 28, in load_module
  File "cmdmain.py", line 34, in <module>
  File "/home/edward/Python-2.5.2/Lib/ihooks.py", line 404, in import_module
    q, tail = self.find_head_package(parent, str(name))
  File "/home/edward/Python-2.5.2/Lib/ihooks.py", line 440, in find_head_package
    q = self.import_it(head, qname, parent)
  File "/home/edward/Python-2.5.2/Lib/ihooks.py", line 495, in import_it
    m = self.loader.load_module(fqname, stuff)
  File "<package>", line 28, in load_module
  File "cmd_py2sis.py", line 39, in <module>
  File "/home/edward/Python-2.5.2/Lib/ihooks.py", line 404, in import_module
    q, tail = self.find_head_package(parent, str(name))
  File "/home/edward/Python-2.5.2/Lib/ihooks.py", line 440, in find_head_package
    q = self.import_it(head, qname, parent)
  File "/home/edward/Python-2.5.2/Lib/ihooks.py", line 495, in import_it
    m = self.loader.load_module(fqname, stuff)
  File "<package>", line 28, in load_module
  File "sisfile.py", line 28, in <module>
  File "/home/edward/Python-2.5.2/Lib/ihooks.py", line 404, in import_module
    q, tail = self.find_head_package(parent, str(name))
  File "/home/edward/Python-2.5.2/Lib/ihooks.py", line 440, in find_head_package
    q = self.import_it(head, qname, parent)
  File "/home/edward/Python-2.5.2/Lib/ihooks.py", line 495, in import_it
    m = self.loader.load_module(fqname, stuff)
  File "<package>", line 22, in load_module
  File "/home/edward/Python-2.5.2/Lib/ihooks.py", line 270, in load_module
    m = self.hooks.load_source(name, filename, file)
  File "/home/edward/Python-2.5.2/Lib/ihooks.py", line 168, in load_source
    return imp.load_source(name, filename, file)
  File "/home/edward/Python-2.5.2/Lib/sha.py", line 6, in <module>
    from hashlib import sha1 as sha
  File "/home/edward/Python-2.5.2/Lib/ihooks.py", line 404, in import_module
    q, tail = self.find_head_package(parent, str(name))
  File "/home/edward/Python-2.5.2/Lib/ihooks.py", line 440, in find_head_package
    q = self.import_it(head, qname, parent)
  File "/home/edward/Python-2.5.2/Lib/ihooks.py", line 495, in import_it
    m = self.loader.load_module(fqname, stuff)
  File "<package>", line 22, in load_module
  File "/home/edward/Python-2.5.2/Lib/ihooks.py", line 270, in load_module
    m = self.hooks.load_source(name, filename, file)
  File "/home/edward/Python-2.5.2/Lib/ihooks.py", line 168, in load_source
    return imp.load_source(name, filename, file)
  File "/home/edward/Python-2.5.2/Lib/hashlib.py", line 135, in <module>
    sha224 = __get_builtin_constructor('sha224')
  File "/home/edward/Python-2.5.2/Lib/hashlib.py", line 63, in __get_builtin_constructor
    import _sha256
  File "/home/edward/Python-2.5.2/Lib/ihooks.py", line 404, in import_module
    q, tail = self.find_head_package(parent, str(name))
  File "/home/edward/Python-2.5.2/Lib/ihooks.py", line 447, in find_head_package
    raise ImportError, "No module named " + qname
ImportError: No module named _sha256
J'en ai conclue que python 2.5.2 ne supporte pas sha256 importer par _sha256 qui est en fait un genre d'alias qui est créer dans hashlib.py (extrait:...):
Code :
1
2
3
4
5
6
7
elif name in ('SHA512', 'sha512', 'SHA384', 'sha384'):
        import _sha512
        bs = name[3:]
        if bs == '512':
            return _sha512.sha512
        elif bs == '384':
            return _sha512.sha384
Or il n'existe pas de module nommer _sha, mais il existe un module sha.py qui est censer créer l'alias (extrait:...):
Code :
1
2
3
4
5
6
from hashlib import sha1 as sha
new = sha
 
blocksize = 1        # legacy value (wrong in any useful sense)
digest_size = 20
digestsize = 20
Et si je tente d'importer le module sha, j'ai le traceback suivant:
Code :
1
2
3
4
5
6
7
8
9
10
import sha
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/edward/Python-2.5.2/Lib/sha.py", line 6, in <module>
    from hashlib import sha1 as sha
  File "/home/edward/Python-2.5.2/Lib/hashlib.py", line 135, in <module>
    sha224 = __get_builtin_constructor('sha224')
  File "/home/edward/Python-2.5.2/Lib/hashlib.py", line 63, in __get_builtin_constructor
    import _sha256
ImportError: No module named _sha256
Et si je passe par le module hashlib:
Code :
1
2
3
4
5
6
7
8
9
>>> from hashlib import sha
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/edward/Python-2.5.2/Lib/hashlib.py", line 135, in <module>
    sha224 = __get_builtin_constructor('sha224')
  File "/home/edward/Python-2.5.2/Lib/hashlib.py", line 63, in __get_builtin_constructor
    import _sha256
ImportError: No module named _sha256
>>>
J'obtiens le même traceback.

Je pense que la ligne: import _sha256 provient dui fichier hashlib qui se replie sur le C:
Code :
1
2
3
4
5
6
7
8
9
10
11
12
except ImportError:
    # We don't have the _hashlib OpenSSL module?
    # use the built in legacy interfaces via a wrapper function
    new = __py_new
 
    # lookup the C function to use directly for the named constructors
    md5 = __get_builtin_constructor('md5')
    sha1 = __get_builtin_constructor('sha1')
    sha224 = __get_builtin_constructor('sha224')
    sha256 = __get_builtin_constructor('sha256')
    sha384 = __get_builtin_constructor('sha384')
    sha512 = __get_builtin_constructor('sha512')
Si vous désirez bien m'aider a me dépétrer de cette cascade de tracebacks venant des oubliettes de pythons, il y a une raison au choix de cette version: c'est que le shell du portable ne supporte que python 2.5.2 (la preuve:...):
Code :
1
2
3
4
Traceback (most recent call last):
  File "/home/edward/PythonForS60/ensymble.py", line 5, in <module>
    if imp.get_magic()!='\xb3\xf2\r\n':raise RuntimeError,s
RuntimeError: requires python 2.5.2 or bytecode compatible
Je vous serai reconnaisant et j'ai déjà tenter de changer les fichiers en causes et il n'existe pas de pack SHA256 a télécharger et a ajouter a la compilation.

PS: Est-ce-que le module hashlib était opérationnel avec python2.5.2 ou ca vient de ma compilation ?

Dans une lueur d'espoirs désesperer je vous pris, si vous le souhaiter bien, de me donner un coup de main afin d'éclairer mon ignorance.