Issue1672

classification
Title: Compileall does not compile if .pyc file exists
Type: Severity: normal
Components: Versions: Jython 2.7
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: fwierzbicki, otmarhumbel, pdina, yanne, zyasoft
Priority: high Keywords:

Created on 2010-11-01.13:36:26 by yanne, last changed 2014-08-23.22:20:07 by pdina.

Files
File name Uploaded Description Edit Remove
test.zip yanne, 2010-11-01.13:36:25 test files to reproduce the bugs
Messages
msg6215 (view) Author: Janne Härkönen (yanne) Date: 2010-11-01.13:36:24
Unzip attached zip and run python test.py

Afterwards, run 
java -jar jython-standalone-2.5.1.jar -m compileall .

$py.class file is not created for greeter.py because corresponding .pyc file already exists.
msg6219 (view) Author: Oti Humbel (otmarhumbel) Date: 2010-11-02.20:00:32
does the -f (force) flag help?
msg6221 (view) Author: Janne Härkönen (yanne) Date: 2010-11-03.05:00:14
Yes, the -f flag does the job indeed, so there's a workaround.

Still, being new to compileall, it took me a while to figure this out.
msg6222 (view) Author: Oti Humbel (otmarhumbel) Date: 2010-11-03.06:11:40
Thanks, that gives a hint where to look in the code!
msg6223 (view) Author: Janne Härkönen (yanne) Date: 2010-11-03.07:15:39
Sorry, I was actually lazy when creating the report.

This code (from compileall.py) is the culprit:

 56             if tail == '.py': 
 57                 cfile = fullname + (__debug__ and 'c' or 'o') 
 58                 ftime = os.stat(fullname).st_mtime 
 59                 try: ctime = os.stat(cfile).st_mtime 
 60                 except os.error: ctime = 0 
 61                 if (ctime > ftime) and not force: continue 

It seems to me that this is copied from Python stdlib directly and it checks for existence of .pyc/.pyo files when determining whether to compile or not.
msg8536 (view) Author: Jim Baker (zyasoft) Date: 2014-05-22.01:15:42
This issue still exists in compileall.

Target beta 4
History
Date User Action Args
2014-08-23 22:20:07pdinasetnosy: + pdina
2014-05-22 01:15:43zyasoftsetassignee: fwierzbicki ->
messages: + msg8536
nosy: + zyasoft
versions: + Jython 2.7, - Jython 2.5
2013-02-25 18:16:16fwierzbickisetpriority: high
2013-02-20 19:31:12fwierzbickisetassignee: otmarhumbel -> fwierzbicki
nosy: + fwierzbicki
versions: + Jython 2.5, - 2.5.1
2010-11-03 07:15:41yannesetmessages: + msg6223
2010-11-03 06:11:41otmarhumbelsetmessages: + msg6222
2010-11-03 05:00:15yannesetmessages: + msg6221
2010-11-02 20:00:32otmarhumbelsetassignee: otmarhumbel
messages: + msg6219
nosy: + otmarhumbel
2010-11-01 13:36:26yannecreate