[Python-checkins] r81005 - in python/branches/py3k/Lib: compileall.py py_compile.py
benjamin.peterson
python-checkins at python.org
Sat May 8 21:52:21 CEST 2010
Author: benjamin.peterson
Date: Sat May 8 21:52:21 2010
New Revision: 81005
Log:
Create __pycache__ dir when the pyc path is explicitly given
Patch from Arfrever Frehtes Taifersar Arahesis.
Modified:
python/branches/py3k/Lib/compileall.py
python/branches/py3k/Lib/py_compile.py
Modified: python/branches/py3k/Lib/compileall.py
==============================================================================
--- python/branches/py3k/Lib/compileall.py (original)
+++ python/branches/py3k/Lib/compileall.py Sat May 8 21:52:21 2010
@@ -93,12 +93,6 @@
cache_dir = os.path.dirname(cfile)
head, tail = name[:-3], name[-3:]
if tail == '.py':
- if not legacy:
- try:
- os.mkdir(cache_dir)
- except OSError as error:
- if error.errno != errno.EEXIST:
- raise
if not force:
try:
mtime = int(os.stat(fullname).st_mtime)
Modified: python/branches/py3k/Lib/py_compile.py
==============================================================================
--- python/branches/py3k/Lib/py_compile.py (original)
+++ python/branches/py3k/Lib/py_compile.py Sat May 8 21:52:21 2010
@@ -123,11 +123,11 @@
return
if cfile is None:
cfile = imp.cache_from_source(file)
- try:
- os.mkdir(os.path.dirname(cfile))
- except OSError as error:
- if error.errno != errno.EEXIST:
- raise
+ try:
+ os.makedirs(os.path.dirname(cfile))
+ except OSError as error:
+ if error.errno != errno.EEXIST:
+ raise
with open(cfile, 'wb') as fc:
fc.write(b'\0\0\0\0')
wr_long(fc, timestamp)
More information about the Python-checkins
mailing list