diff options
author | Mats Wichmann <mats@linux.com> | 2019-09-10 15:26:57 (GMT) |
---|---|---|
committer | Mats Wichmann <mats@linux.com> | 2019-12-05 00:40:27 (GMT) |
commit | 5e734795b0dc18c6a9955d764ac19f149714fc4f (patch) | |
tree | 587f6aaec107c88721f1c49e919fcf1beb01138a /bin | |
parent | d4eaa1986cfffdb11eee0aa5240fa44bef370fb1 (diff) | |
download | SCons-5e734795b0dc18c6a9955d764ac19f149714fc4f.zip SCons-5e734795b0dc18c6a9955d764ac19f149714fc4f.tar.gz SCons-5e734795b0dc18c6a9955d764ac19f149714fc4f.tar.bz2 |
[PR #3343] fix review comments [ci skip]
get importlib magic number from util
sider complaints about unicode usage
sider complaint about subprocess return value unused
sider complaint about shutil import unused (it is used, but
inside a big string that is written to a file to be executed)
Signed-off-by: Mats Wichmann <mats@linux.com>
Diffstat (limited to 'bin')
-rw-r--r-- | bin/SConsDoc.py | 13 | ||||
-rw-r--r-- | bin/SConsExamples.py | 1 | ||||
-rw-r--r-- | bin/docs-update-generated.py | 2 |
3 files changed, 10 insertions, 6 deletions
diff --git a/bin/SConsDoc.py b/bin/SConsDoc.py index d200f8b..a95930b 100644 --- a/bin/SConsDoc.py +++ b/bin/SConsDoc.py @@ -312,14 +312,20 @@ if not has_libxml2: @staticmethod def writeGenTree(root, fp): dt = DoctypeDeclaration() - encfun = unicode if PY2 else str + try: + encfun = unicode # PY2 + except NameError: + encfun = str fp.write(etree.tostring(root, encoding=encfun, pretty_print=True, doctype=dt.createDoctype())) @staticmethod def writeTree(root, fpath): - encfun = unicode if PY2 else None + try: + encfun = unicode # PY2 + except NameError: + encfun = "utf-8" with open(fpath, 'wb') as fp: fp.write(etree.tostring(root, encoding=encfun, pretty_print=True)) @@ -865,8 +871,7 @@ if PY2: else: # PY3 version, from newer pydoc def importfile(path): """Import a Python source file or compiled file given its path.""" - from importlib import MAGIC_NUMBER - import pydoc + from importlib.util import MAGIC_NUMBER with open(path, 'rb') as ifp: is_bytecode = MAGIC_NUMBER == ifp.read(len(MAGIC_NUMBER)) filename = os.path.basename(path) diff --git a/bin/SConsExamples.py b/bin/SConsExamples.py index 8a264e4..dbb8715 100644 --- a/bin/SConsExamples.py +++ b/bin/SConsExamples.py @@ -92,7 +92,6 @@ import os import re import sys import time -import shutil import SConsDoc from SConsDoc import tf as stf diff --git a/bin/docs-update-generated.py b/bin/docs-update-generated.py index 307f843..78b60a7 100644 --- a/bin/docs-update-generated.py +++ b/bin/docs-update-generated.py @@ -45,7 +45,7 @@ def generate_all(): print("Couldn't create destination folder %s! Exiting..." % gen_folder) return # Call scons-proc.py - rv = subprocess.call([sys.executable, + _ = subprocess.call([sys.executable, os.path.join('bin','scons-proc.py'), '-b', argpair('builders'), '-f', argpair('functions'), |