File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -359,11 +359,18 @@ def byte_compile (py_files,
359359 # "Indirect" byte-compilation: write a temporary script and then
360360 # run it with the appropriate flags.
361361 if not direct :
362- from tempfile import mkstemp
363- (script_fd , script_name ) = mkstemp (".py" )
362+ try :
363+ from tempfile import mkstemp
364+ (script_fd , script_name ) = mkstemp (".py" )
365+ except ImportError :
366+ from tempfile import mktemp
367+ (script_fd , script_name ) = None , mktemp (".py" )
364368 log .info ("writing byte-compilation script '%s'" , script_name )
365369 if not dry_run :
366- script = os .fdopen (script_fd , "w" )
370+ if script_fd is not None :
371+ script = os .fdopen (script_fd , "w" )
372+ else :
373+ script = open (script_name , "w" )
367374
368375 script .write ("""\
369376 from distutils.util import byte_compile
You can’t perform that action at this time.
0 commit comments