summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc-André Lemburg <mal@egenix.com>2002-12-03 08:45:11 (GMT)
committerMarc-André Lemburg <mal@egenix.com>2002-12-03 08:45:11 (GMT)
commit0375079e934156491ffe04771d7f4470f391377e (patch)
tree53b8a8d457268d7445faebec761310059a96c76f
parent7f6a4390408e28e9c3cc3e1bb32f3908ba969091 (diff)
downloadcpython-0375079e934156491ffe04771d7f4470f391377e.zip
cpython-0375079e934156491ffe04771d7f4470f391377e.tar.gz
cpython-0375079e934156491ffe04771d7f4470f391377e.tar.bz2
Adding Python <= 2.2 support back in.
-rw-r--r--Lib/distutils/util.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/Lib/distutils/util.py b/Lib/distutils/util.py
index 9de6077..17fc320 100644
--- a/Lib/distutils/util.py
+++ b/Lib/distutils/util.py
@@ -359,11 +359,18 @@ def byte_compile (py_files,
# "Indirect" byte-compilation: write a temporary script and then
# run it with the appropriate flags.
if not direct:
- from tempfile import mkstemp
- (script_fd, script_name) = mkstemp(".py")
+ try:
+ from tempfile import mkstemp
+ (script_fd, script_name) = mkstemp(".py")
+ except ImportError:
+ from tempfile import mktemp
+ (script_fd, script_name) = None, mktemp(".py")
log.info("writing byte-compilation script '%s'", script_name)
if not dry_run:
- script = os.fdopen(script_fd, "w")
+ if script_fd is not None:
+ script = os.fdopen(script_fd, "w")
+ else:
+ script = open(script_name, "w")
script.write("""\
from distutils.util import byte_compile