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 | |
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>
-rw-r--r-- | bin/SConsDoc.py | 13 | ||||
-rw-r--r-- | bin/SConsExamples.py | 1 | ||||
-rw-r--r-- | bin/docs-update-generated.py | 2 | ||||
-rw-r--r-- | doc/man/scons.xml | 4 | ||||
-rw-r--r-- | doc/user/depends.xml | 1 |
5 files changed, 13 insertions, 8 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'), diff --git a/doc/man/scons.xml b/doc/man/scons.xml index 5aea45a..01f38d1 100644 --- a/doc/man/scons.xml +++ b/doc/man/scons.xml @@ -2278,10 +2278,10 @@ env.SomeTool(targets, sources) <refsect2 id='builder_methods'><title>Builder Methods</title> -<para>You tell <program>scons</program> what to build +<para>You tell <command>scons</command> what to build by calling Builders, functions which know to take a particular action when given files of a particular type -to produce a particular result type. <program>scons</program> +to produce a particular result type. <command>scons</command> defines a number of builders, and you can also write your own. Builders are attached to a &consenv; as methods, and the available builder methods are listed as diff --git a/doc/user/depends.xml b/doc/user/depends.xml index 5a78eb5..cd5094a 100644 --- a/doc/user/depends.xml +++ b/doc/user/depends.xml @@ -764,6 +764,7 @@ int main() { printf("Hello, world!\n"); } encounter them in older &SConscript; files. </para> + </section> <section> <title>Implicit Dependencies: The &cv-CPPPATH; Construction Variable</title> |