File tree 1 file changed +3
-12
lines changed
1 file changed +3
-12
lines changed Original file line number Diff line number Diff line change 12
12
import subprocess
13
13
import sys
14
14
import sysconfig
15
+ import tempfile
15
16
16
17
from ._log import log
17
18
from ._modified import newer
@@ -405,20 +406,10 @@ def byte_compile( # noqa: C901
405
406
# "Indirect" byte-compilation: write a temporary script and then
406
407
# run it with the appropriate flags.
407
408
if not direct :
408
- try :
409
- from tempfile import mkstemp
410
-
411
- (script_fd , script_name ) = mkstemp (".py" )
412
- except ImportError :
413
- from tempfile import mktemp
414
-
415
- (script_fd , script_name ) = None , mktemp (".py" )
409
+ (script_fd , script_name ) = tempfile .mkstemp (".py" )
416
410
log .info ("writing byte-compilation script '%s'" , script_name )
417
411
if not dry_run :
418
- if script_fd is not None :
419
- script = os .fdopen (script_fd , "w" , encoding = 'utf-8' )
420
- else : # pragma: no cover
421
- script = open (script_name , "w" , encoding = 'utf-8' )
412
+ script = os .fdopen (script_fd , "w" , encoding = 'utf-8' )
422
413
423
414
with script :
424
415
script .write (
You can’t perform that action at this time.
0 commit comments