Title: compileall does not work
Type: Severity: normal
Components: Library Versions: Jython 2.7
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: zyasoft Nosy List: Arfrever, alex.gronholm, dschulten, fwierzbicki, zyasoft
Priority: urgent Keywords:

Created on 2012-05-25.06:32:49 by alex.gronholm, last changed 2014-05-22.00:13:57 by zyasoft.

msg7146 (view) Author: Alex Grönholm (alex.gronholm) Date: 2012-05-25.06:32:49
This is required by the compileall module, which I need to make binary jars so I can test my ERP client on 2.7.
msg7147 (view) Author: Alex Grönholm (alex.gronholm) Date: 2012-05-25.12:24:50
Renamed the issue.

I also committed the missing imp.get_magic() function, but I think I was too hasty. For one, the value should be unique to Jython. Second, there may be a good reason why the function is missing from Jython 2.5. It's highly likely that my commit needs to be reverted. However, I have no clue how to fix the compileall module then.
msg7148 (view) Author: Alex Grönholm (alex.gronholm) Date: 2012-05-25.12:29:20
On further investigation I discovered that in 2.7, the compileall module reads the first 8 bytes of an existing target file and checks the magic number and the modification time. Python 2.5 does not do this. I don't know enough about class files to know if or how this applies to Jython.
msg7203 (view) Author: Dietrich Schulten (dschulten) Date: 2012-06-12.05:24:54
compileall works when run like this within the jython27a2 REPL:
import compileall
compileall.compile_dir("src", force=1)

but it fails when run as a subprocess:['java', '-jar', jython_jar, '-m', 'compileall', src])
msg7211 (view) Author: Dietrich Schulten (dschulten) Date: 2012-06-13.05:53:39
The reason is of course the force=1, it prevents compileall from trying to read in the magic number.
Therefore, -f will work, too:['java', '-jar', jython_jar, '-m', 'compileall', '-f', tmpdir])
msg8516 (view) Author: Jim Baker (zyasoft) Date: 2014-05-22.00:13:55
Works fine now, in the ways I would assume compileall is actually used - by setuptools, pip, etc, etc - basically all the stuff we have been working on for a while. Or jython27 -m compileall

I assume this bug has just been sitting here unnoticed until now, certainly by me. Please respond if this is not the case.
Date User Action Args
2014-05-22 00:13:57zyasoftsetstatus: open -> closed
resolution: fixed
messages: + msg8516
2013-05-21 21:15:26zyasoftsetassignee: fwierzbicki -> zyasoft
nosy: + zyasoft
2013-02-20 00:31:37fwierzbickisetpriority: normal -> urgent
2013-02-20 00:28:57fwierzbickisetversions: + Jython 2.7, - 2.7a2
2012-06-13 05:53:40dschultensetmessages: + msg7211
2012-06-12 16:29:16Arfreversetnosy: + Arfrever
2012-06-12 05:24:55dschultensetmessages: + msg7203
2012-06-12 05:21:13dschultensetversions: + 2.7a2, - 2.7a1
2012-06-12 04:38:35dschultensetnosy: + dschulten
2012-05-25 12:29:20alex.gronholmsetmessages: + msg7148
2012-05-25 12:24:50alex.gronholmsetmessages: + msg7147
title: get_magic() missing from the "imp" module -> compileall does not work
2012-05-25 06:32:49alex.gronholmcreate