2
0
mirror of https://gitlab.com/ita1024/waf.git synced 2024-11-25 03:09:30 +01:00

Conceal imp warnings in Python3

This commit is contained in:
Thomas Nagy 2019-08-14 22:05:45 +02:00
parent 0c0916ebdb
commit d2060dfd8a
2 changed files with 9 additions and 2 deletions

View File

@ -6,10 +6,17 @@
Classes and functions enabling the command system
"""
import os, re, imp, sys
import os, re, sys
from waflib import Utils, Errors, Logs
import waflib.Node
if sys.hexversion > 0x3040000:
import types
class imp(object):
new_module = lambda x: types.ModuleType(x)
else:
import imp
# the following 3 constants are updated on each new release (do not touch)
HEXVERSION=0x2001200
"""Constant updated on new releases"""

View File

@ -620,7 +620,7 @@ def configure(conf):
v.PYO = getattr(Options.options, 'pyo', 1)
try:
v.PYTAG = conf.cmd_and_log(conf.env.PYTHON + ['-c', "import imp;print(imp.get_tag())"]).strip()
v.PYTAG = conf.cmd_and_log(conf.env.PYTHON + ['-c', "import sys\ntry:\n print(sys.implementation.cache_tag)\nexcept AttributeError:\n import imp\n print(imp.get_tag())\n"]).strip()
except Errors.WafError:
pass