[issue8563] [PEP 3147] compileall.compile_file() creates empty __pycache__ directories for non-.py files

2010-04-29 Thread Barry A. Warsaw
Barry A. Warsaw ba...@python.org added the comment: Thanks for finding this bug. I'm not sure about the second chunk of your diff (the one that removes __pycache__). In the future, it would help to include a unittest case that illustrates the problem. Here's a patch that includes a test

[issue8563] [PEP 3147] compileall.compile_file() creates empty __pycache__ directories for non-.py files

2010-04-29 Thread Barry A. Warsaw
Changes by Barry A. Warsaw ba...@python.org: -- assignee: - barry ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8563 ___ ___ Python-bugs-list

[issue8563] [PEP 3147] compileall.compile_file() creates empty __pycache__ directories for non-.py files

2010-04-29 Thread Arfrever Frehtes Taifersar Arahesis
Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com added the comment: Here's an example, which shows that an empty __pycache__ has been created: $ mkdir test $ echo : test/file.py $ tree test test └── file.py 0 directories, 1 file $ python3.2 -c 'import compileall;

[issue8563] [PEP 3147] compileall.compile_file() creates empty __pycache__ directories for non-.py files

2010-04-29 Thread Barry A. Warsaw
Barry A. Warsaw ba...@python.org added the comment: Hmm. I'm not sure that getting a SyntaxError is grounds for removing the __pycache__ directory. I think I will commit the fix without that change. -- ___ Python tracker rep...@bugs.python.org

[issue8563] [PEP 3147] compileall.compile_file() creates empty __pycache__ directories for non-.py files

2010-04-29 Thread Arfrever Frehtes Taifersar Arahesis
Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com added the comment: __pycache__ directory could be removed only when os.mkdir(cache_dir) has succeeded. Empty __pycache__ directory existing before call to compileall.compile_file() wouldn't be removed. --

[issue8563] [PEP 3147] compileall.compile_file() creates empty __pycache__ directories for non-.py files

2010-04-29 Thread Barry A. Warsaw
Barry A. Warsaw ba...@python.org added the comment: I guess I don't see the point in removing __pycache__ when the only .py file in the package directory has a SyntaxError. I think that will be a rare case. Won't there usually be other .py files that compile just fine? --

[issue8563] [PEP 3147] compileall.compile_file() creates empty __pycache__ directories for non-.py files

2010-04-29 Thread Barry A. Warsaw
Barry A. Warsaw ba...@python.org added the comment: r80626 -- resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8563 ___

[issue8563] [PEP 3147] compileall.compile_file() creates empty __pycache__ directories for non-.py files

2010-04-29 Thread Arfrever Frehtes Taifersar Arahesis
Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com added the comment: compileall might be used to check if given package supports Python 3. There can be many .py files and all of them can contain syntax specific to Python 2. -- ___ Python

[issue8563] [PEP 3147] compileall.compile_file() creates empty __pycache__ directories for non-.py files

2010-04-29 Thread Barry A. Warsaw
Barry A. Warsaw ba...@python.org added the comment: Hmm. In that case, I think you'd be expecting possible errors and would either have to clean up __pycache__ yourself or turn on legacy mode. -- ___ Python tracker rep...@bugs.python.org

[issue8563] [PEP 3147] compileall.compile_file() creates empty __pycache__ directories for non-.py files

2010-04-29 Thread Arfrever Frehtes Taifersar Arahesis
Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com added the comment: I think that compilation of a single file should try to be an atomic operation, which doesn't leave an empty directory after failure. -- ___ Python tracker

[issue8563] [PEP 3147] compileall.compile_file() creates empty __pycache__ directories for non-.py files

2010-04-28 Thread Arfrever Frehtes Taifersar Arahesis
New submission from Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com: compileall.compile_file() creates empty __pycache__ directories for non-.py files. This problem usually occurs when compileall.compile_file() is called by compileall.compile_dir() and a subdirectory contains