Kaydet (Commit) 25216baf authored tarafından Benjamin Peterson's avatar Benjamin Peterson

Create __pycache__ dir when the pyc path is explicitly given

Patch from Arfrever Frehtes Taifersar Arahesis.
üst e5da82ff
...@@ -93,12 +93,6 @@ def compile_file(fullname, ddir=None, force=0, rx=None, quiet=False, ...@@ -93,12 +93,6 @@ def compile_file(fullname, ddir=None, force=0, rx=None, quiet=False,
cache_dir = os.path.dirname(cfile) cache_dir = os.path.dirname(cfile)
head, tail = name[:-3], name[-3:] head, tail = name[:-3], name[-3:]
if tail == '.py': if tail == '.py':
if not legacy:
try:
os.mkdir(cache_dir)
except OSError as error:
if error.errno != errno.EEXIST:
raise
if not force: if not force:
try: try:
mtime = int(os.stat(fullname).st_mtime) mtime = int(os.stat(fullname).st_mtime)
......
...@@ -124,7 +124,7 @@ def compile(file, cfile=None, dfile=None, doraise=False): ...@@ -124,7 +124,7 @@ def compile(file, cfile=None, dfile=None, doraise=False):
if cfile is None: if cfile is None:
cfile = imp.cache_from_source(file) cfile = imp.cache_from_source(file)
try: try:
os.mkdir(os.path.dirname(cfile)) os.makedirs(os.path.dirname(cfile))
except OSError as error: except OSError as error:
if error.errno != errno.EEXIST: if error.errno != errno.EEXIST:
raise raise
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment