mirror of
https://github.com/python/cpython.git
synced 2025-07-07 19:35:27 +00:00
Create __pycache__ dir when the pyc path is explicitly given
Patch from Arfrever Frehtes Taifersar Arahesis.
This commit is contained in:
parent
e5da82ff4c
commit
25216baf32
2 changed files with 5 additions and 11 deletions
|
@ -123,11 +123,11 @@ def compile(file, cfile=None, dfile=None, doraise=False):
|
|||
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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue