msg68500 - (view) |
Author: Viktor Ferenczi (complex) |
Date: 2008-06-21 15:31 |
Python 3.0b1, official MSI installer. Checkout source code of this project: http://code.google.com/p/anntools/ Enter into the root of your working copy and try to build a Win32 installer: C:\Python30\python.exe setup.py bdist_wininst NOTE: You might want to replace the path above with you Python installation path. Please ensure, that Python 3.0 is used, since all other versions from 2.4 to 2.6b1 works well. You will get the following traceback during the build process: Traceback (most recent call last): File "setup.py", line 37, in "anntools", File "C:\python30\lib\distutils\core.py", line 149, in setup dist.run_commands() File "C:\python30\lib\distutils\dist.py", line 941, in run_commands self.run_command(cmd) File "C:\python30\lib\distutils\dist.py", line 961, in run_command cmd_obj.run() File "C:\python30\lib\distutils\command\bdist_wininst.py", line 177, in run self.create_exe(arcname, fullname, self.bitmap) File "C:\python30\lib\distutils\command\bdist_wininst.py", line 263, in create_exe cfgdata = cfgdata + "\0" TypeError: can't concat bytes to str |
|
|
msg68501 - (view) |
Author: Viktor Ferenczi (complex) |
Date: 2008-06-21 15:38 |
Fixed by appending the b (bytes) prefix to three string literals concatenated to cfgdata in C:\python30\lib\distutils\command\bdist_wininst.py: Line #262: # Append the pre-install script cfgdata = cfgdata + b"\0" if self.pre_install_script: script_data = open(self.pre_install_script, "r").read() cfgdata = cfgdata + script_data + b"\n\0" else: # empty pre-install script cfgdata = cfgdata + b"\0" file.write(cfgdata) Sorry for the source code fragment. I'll try to submit a patch instead next time. |
|
|
msg70768 - (view) |
Author: Viktor Ferenczi (complex) |
Date: 2008-08-06 00:56 |
Note: It is already fixed and should go into the next beta. Thanks. |
|
|
msg70936 - (view) |
Author: Antoine Pitrou (pitrou) *  |
Date: 2008-08-09 16:45 |
Hi Viktor, It's complicated for me to test under Windows right now, but your snippet looks buggy: script_data = open(self.pre_install_script, "r").read() cfgdata = cfgdata + script_data + b"\n\0" script_data is an unicode string because the file is opened in text mode, but you try to concatenate it with bytes objects which will fail. Please try to fix this and provide a proper patch :-) PS : I agree it is important to fix this. |
|
|
msg70952 - (view) |
Author: Viktor Ferenczi (complex) |
Date: 2008-08-10 00:12 |
Thanks. Good point. :-) I did not find that bug, since pre_install_script is not defined for my project. Sorry, it is my fault. I did not test my patch deep enough. I need to know one more thing before providing a better patch: What is the expected encoding of the pre_install_script file? |
|
|
msg70964 - (view) |
Author: Senthil Kumaran (orsenthil) *  |
Date: 2008-08-10 07:17 |
>> What is the expected encoding of the pre_install_script file? I think, the pre_install_script will be provided by the user. It would be safe to assume "UTF-8" for the encoding of pre_install_script |
|
|
msg70994 - (view) |
Author: Viktor Ferenczi (complex) |
Date: 2008-08-10 19:23 |
Is forcing the encoding as UTF-8 backwards compatible? It should be at least noted somewhere if this change could render existing setup scripts incompatible with Python 3.0. |
|
|
msg71005 - (view) |
Author: Antoine Pitrou (pitrou) *  |
Date: 2008-08-11 09:17 |
Do you really need to know the encoding of the pre_install_script? Isn't it sufficient to open it in binary mode instead? |
|
|
msg71009 - (view) |
Author: Antoine Pitrou (pitrou) *  |
Date: 2008-08-11 10:29 |
Ok, it's a little more complicated than that, because the pre-install-script must have its newlines converted, otherwise the installer refuses to run it. Here is a working patch. Viktor, do you want to give it a try? |
|
|
msg71019 - (view) |
Author: Antoine Pitrou (pitrou) *  |
Date: 2008-08-11 15:32 |
Similar issue but with bdist_msi in #3542. |
|
|
msg71912 - (view) |
Author: Antoine Pitrou (pitrou) *  |
Date: 2008-08-25 09:31 |
Viktor? |
|
|
msg72217 - (view) |
Author: Viktor Ferenczi (complex) |
Date: 2008-09-01 03:36 |
Thanks. I've tested the patch, it worked for me. However, I had to apply it manually. No big deal, since not a big patch, anyway. :-) |
|
|
msg72218 - (view) |
Author: Viktor Ferenczi (complex) |
Date: 2008-09-01 03:38 |
Note: I tested the patch with the latest beta 2 release. The Windows installer is beta2, but beta3 is announced. I don't understand why, Guido should know... |
|
|
msg72224 - (view) |
Author: Antoine Pitrou (pitrou) *  |
Date: 2008-09-01 10:21 |
Hi Viktor I believe no installer was released for beta3 because Martin von Löwis was on holidays and couldn't handle it. Now we are in release candidate phase, the patch needs another reviewer though. |
|
|
msg72526 - (view) |
Author: Antoine Pitrou (pitrou) *  |
Date: 2008-09-04 21:32 |
Fixed in r66223. |
|
|