diff options
author | Mats Wichmann <mats@linux.com> | 2019-06-25 16:56:43 (GMT) |
---|---|---|
committer | Mats Wichmann <mats@linux.com> | 2019-12-05 00:33:25 (GMT) |
commit | d4eaa1986cfffdb11eee0aa5240fa44bef370fb1 (patch) | |
tree | fe156e17caec56884bff27bf350ee3f38950d5cc /doc | |
parent | 714d2c0baf5573c32bf709f3d252496c2359b345 (diff) | |
download | SCons-d4eaa1986cfffdb11eee0aa5240fa44bef370fb1.zip SCons-d4eaa1986cfffdb11eee0aa5240fa44bef370fb1.tar.gz SCons-d4eaa1986cfffdb11eee0aa5240fa44bef370fb1.tar.bz2 |
Improve building of docs using Py3 [ci skip]
* context managers on file r/w + use shutil.copy where it makes sense.
* lxml wants (demands?) that xml files be processed as bytes
* for the phase where we gen the entity files, read as text anyway
* Need to solve a problem where the generated xml is putting the \n in
literally, not evaluating it.
* Fix some examples broken for py3
* Fix more octal constant instances
* Cleanups suggested by PyCharm: staticmethods, two blanks
before class definition, others.
This addresses issues called out in #3300, but is not a complete
solution because the actual doc build step still fails with the
epydoc failures (which aren't directly because of Py3; epydoc
build doesn't work any better on my system with Py3, even with
the forked version with patches).
Signed-off-by: Mats Wichmann <mats@linux.com>
Diffstat (limited to 'doc')
-rw-r--r-- | doc/generated/examples/factories_Chmod_1.xml | 2 | ||||
-rw-r--r-- | doc/generated/functions.gen | 10 | ||||
-rw-r--r-- | doc/man/scons.xml | 4 | ||||
-rw-r--r-- | doc/user/README | 2 | ||||
-rw-r--r-- | doc/user/builders-writing.xml | 12 | ||||
-rw-r--r-- | doc/user/environments.xml | 2 | ||||
-rw-r--r-- | doc/user/factories.xml | 10 | ||||
-rw-r--r-- | doc/user/file-removal.xml | 2 | ||||
-rw-r--r-- | doc/user/mergeflags.xml | 8 | ||||
-rw-r--r-- | doc/user/parseconfig.xml | 4 | ||||
-rw-r--r-- | doc/user/parseflags.xml | 12 | ||||
-rw-r--r-- | doc/user/sideeffect.xml | 2 | ||||
-rw-r--r-- | doc/user/troubleshoot.xml | 4 |
13 files changed, 39 insertions, 35 deletions
diff --git a/doc/generated/examples/factories_Chmod_1.xml b/doc/generated/examples/factories_Chmod_1.xml index a324ed4..59bba55 100644 --- a/doc/generated/examples/factories_Chmod_1.xml +++ b/doc/generated/examples/factories_Chmod_1.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> <screen xmlns="http://www.scons.org/dbxsd/v1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.scons.org/dbxsd/v1.0 http://www.scons.org/dbxsd/v1.0/scons.xsd">% <userinput>scons -Q</userinput> Copy("file.out", "file.in") -Chmod("file.out", 0755) +Chmod("file.out", 0o755) </screen> diff --git a/doc/generated/functions.gen b/doc/generated/functions.gen index f3f2a0c..d24eac3 100644 --- a/doc/generated/functions.gen +++ b/doc/generated/functions.gen @@ -1408,7 +1408,7 @@ This SConstruct: <example_commands xmlns="http://www.scons.org/dbxsd/v1.0"> env=Environment() -print env.Dump('CCCOM') +print(env.Dump('CCCOM')) </example_commands> <para xmlns="http://www.scons.org/dbxsd/v1.0"> @@ -1425,7 +1425,7 @@ While this SConstruct: <example_commands xmlns="http://www.scons.org/dbxsd/v1.0"> env=Environment() -print env.Dump() +print(env.Dump()) </example_commands> <para xmlns="http://www.scons.org/dbxsd/v1.0"> @@ -4463,7 +4463,7 @@ Example: </para> <example_commands xmlns="http://www.scons.org/dbxsd/v1.0"> -print env.subst("The C compiler is: $CC") +print(env.subst("The C compiler is: $CC")) def compile(target, source, env): sourceDir = env.subst("${SOURCE.srcdir}", @@ -4493,9 +4493,9 @@ Examples: </para> <example_commands xmlns="http://www.scons.org/dbxsd/v1.0"> -# makes sure the built library will be installed with 0644 file +# makes sure the built library will be installed with 0o644 file # access mode -Tag( Library( 'lib.c' ), UNIX_ATTR="0644" ) +Tag( Library( 'lib.c' ), UNIX_ATTR="0o644" ) # marks file2.txt to be a documentation file Tag( 'file2.txt', DOC ) diff --git a/doc/man/scons.xml b/doc/man/scons.xml index ae54e2e..5aea45a 100644 --- a/doc/man/scons.xml +++ b/doc/man/scons.xml @@ -5721,11 +5721,11 @@ which can be octal or string, similar to the bash command. Examples:</para> <literallayout class="monospaced"> -Execute(Chmod('file', 0755)) +Execute(Chmod('file', 0o755)) env.Command('foo.out', 'foo.in', [Copy('$TARGET', '$SOURCE'), - Chmod('$TARGET', 0755)]) + Chmod('$TARGET', 0o755)]) Execute(Chmod('file', "ugo+w")) diff --git a/doc/user/README b/doc/user/README index 2d05359..f94632d 100644 --- a/doc/user/README +++ b/doc/user/README @@ -12,7 +12,7 @@ Writing examples: here's a simple template. <scons_example name="Foo"> <file name="SConstruct"> env = Environment() - print env.Dump("CC") + print(env.Dump("CC")) </file> </scons_example> diff --git a/doc/user/builders-writing.xml b/doc/user/builders-writing.xml index e20e99b..a906df8 100644 --- a/doc/user/builders-writing.xml +++ b/doc/user/builders-writing.xml @@ -196,7 +196,7 @@ env.Foo('file.foo', 'file.input') <file name="file.input"> file.input </file> - <file name="foobuild" chmod="0755"> + <file name="foobuild" chmod="0o755"> cat </file> </scons_example> @@ -309,7 +309,7 @@ file.input <file name="hello.c"> hello.c </file> - <file name="foobuild" chmod="0755"> + <file name="foobuild" chmod="0o755"> cat </file> </scons_example> @@ -389,7 +389,7 @@ file1.input <file name="file2.input"> file2.input </file> - <file name="foobuild" chmod="0755"> + <file name="foobuild" chmod="0o755"> cat </file> </scons_example> @@ -682,7 +682,7 @@ env.Foo('file') <file name="file.input"> file.input </file> - <file name="foobuild" chmod="0755"> + <file name="foobuild" chmod="0o755"> cat </file> </scons_example> @@ -766,7 +766,7 @@ file.input <file name="new_source"> new_source </file> - <file name="foobuild" chmod="0755"> + <file name="foobuild" chmod="0o755"> cat </file> </scons_example> @@ -840,7 +840,7 @@ modify1.input <file name="modify2.in"> modify2.input </file> - <file name="my_command" chmod="0755"> + <file name="my_command" chmod="0o755"> cat </file> diff --git a/doc/user/environments.xml b/doc/user/environments.xml index 0b246d2..43503a6 100644 --- a/doc/user/environments.xml +++ b/doc/user/environments.xml @@ -1652,7 +1652,7 @@ env['ENV']['PATH'] = '/usr/local/bin:/bin:/usr/bin' env = Environment() env.Command('foo', [], '__ROOT__/usr/bin/printenv.py') </file> - <file name="__ROOT__/usr/bin/printenv.py" chmod="0755"> + <file name="__ROOT__/usr/bin/printenv.py" chmod="0o755"> #!/usr/bin/env python import os import sys diff --git a/doc/user/factories.xml b/doc/user/factories.xml index c8480db..b68dfd9 100644 --- a/doc/user/factories.xml +++ b/doc/user/factories.xml @@ -161,7 +161,7 @@ env['ENV']['PATH'] = env['ENV']['PATH'] + os.pathsep + os.getcwd() SConscript('S') </file> <file name="file.in">file.in</file> - <file name="modify" chmod="0755"> + <file name="modify" chmod="0o755"> touch $* </file> </scons_example> @@ -231,7 +231,7 @@ env['ENV']['PATH'] = env['ENV']['PATH'] + os.pathsep + os.getcwd() SConscript('S') </file> <file name="file.in">file.in</file> - <file name="modify" chmod="0755"> + <file name="modify" chmod="0o755"> touch $* </file> </scons_example> @@ -325,7 +325,7 @@ env['ENV']['PATH'] = env['ENV']['PATH'] + os.pathsep + os.getcwd() SConscript('S') </file> <file name="file.in">file.in</file> - <file name="modify" chmod="0755"> + <file name="modify" chmod="0o755"> touch $* </file> </scons_example> @@ -416,7 +416,7 @@ env['ENV']['PATH'] = env['ENV']['PATH'] + os.pathsep + os.getcwd() SConscript('S') </file> <file name="file.in">file.in</file> - <file name="process" chmod="0755"> + <file name="process" chmod="0o755"> touch $* </file> </scons_example> @@ -452,7 +452,7 @@ touch $* Command("file.out", "file.in", [ Copy("$TARGET", "$SOURCE"), - Chmod("$TARGET", 0755), + Chmod("$TARGET", 0o755), ]) </file> <file name="file.in">file.in</file> diff --git a/doc/user/file-removal.xml b/doc/user/file-removal.xml index c6c695f..6c7c71a 100644 --- a/doc/user/file-removal.xml +++ b/doc/user/file-removal.xml @@ -214,7 +214,7 @@ foo.in <file name="foo.log"> foo.log </file> - <file name="build" chmod="0755"> + <file name="build" chmod="0o755"> cat $3 > $2 </file> </scons_example> diff --git a/doc/user/mergeflags.xml b/doc/user/mergeflags.xml index 280eb82..879a7b2 100644 --- a/doc/user/mergeflags.xml +++ b/doc/user/mergeflags.xml @@ -77,7 +77,7 @@ env = Environment() env.Append(CCFLAGS = '-option -O3 -O1') flags = { 'CCFLAGS' : '-whatever -O3' } env.MergeFlags(flags) -print env['CCFLAGS'] +print(env['CCFLAGS']) </file> </scons_example> @@ -104,7 +104,7 @@ env = Environment() env.Append(CPPPATH = ['/include', '/usr/local/include', '/usr/include']) flags = { 'CPPPATH' : ['/usr/opt/include', '/usr/local/include'] } env.MergeFlags(flags) -print env['CPPPATH'] +print(env['CPPPATH']) </file> </scons_example> @@ -138,8 +138,8 @@ env = Environment() env.Append(CCFLAGS = '-option -O3 -O1') env.Append(CPPPATH = ['/include', '/usr/local/include', '/usr/include']) env.MergeFlags('-whatever -I/usr/opt/include -O3 -I/usr/local/include') -print env['CCFLAGS'] -print env['CPPPATH'] +print(env['CCFLAGS']) +print(env['CPPPATH']) </file> </scons_example> diff --git a/doc/user/parseconfig.xml b/doc/user/parseconfig.xml index 1ddd42d..a07201a 100644 --- a/doc/user/parseconfig.xml +++ b/doc/user/parseconfig.xml @@ -87,7 +87,7 @@ env = Environment() env['CPPPATH'] = ['/lib/compat'] env.ParseConfig("pkg-config x11 --cflags --libs") -print env['CPPPATH'] +print(env['CPPPATH']) </file> </scons_example> @@ -139,7 +139,7 @@ scons: `.' is up to date. env = Environment() env.ParseConfig("pkg-config x11 --cflags --libs") env.ParseConfig("pkg-config x11 --cflags --libs") -print env['CPPPATH'] +print(env['CPPPATH']) </file> </scons_example> diff --git a/doc/user/parseflags.xml b/doc/user/parseflags.xml index 46d6866..836b7f2 100644 --- a/doc/user/parseflags.xml +++ b/doc/user/parseflags.xml @@ -80,11 +80,12 @@ <scons_example name="parseflags_ex1"> <file name="SConstruct" printme="1"> +from __future__ import print_function env = Environment() d = env.ParseFlags("-I/opt/include -L/opt/lib -lfoo") for k,v in sorted(d.items()): if v: - print k, v + print(k, v) env.MergeFlags(d) env.Program('f1.c') </file> @@ -119,11 +120,12 @@ int main() { return 0; } <scons_example name="parseflags_ex2"> <file name="SConstruct" printme="1"> +from __future__ import print_function env = Environment() d = env.ParseFlags("-whatever") for k,v in sorted(d.items()): if v: - print k, v + print(k, v) env.MergeFlags(d) env.Program('f1.c') </file> @@ -145,11 +147,12 @@ env.Program('f1.c') <scons_example name="parseflags_ex3"> <file name="SConstruct" printme="1"> +from __future__ import print_function env = Environment() d = env.ParseFlags(["-I/opt/include", ["-L/opt/lib", "-lfoo"]]) for k,v in sorted(d.items()): if v: - print k, v + print(k, v) env.MergeFlags(d) env.Program('f1.c') </file> @@ -172,11 +175,12 @@ int main() { return 0; } <scons_example name="parseflags_ex4"> <file name="SConstruct" printme="1"> +from __future__ import print_function env = Environment() d = env.ParseFlags(["!echo -I/opt/include", "!echo -L/opt/lib", "-lfoo"]) for k,v in sorted(d.items()): if v: - print k, v + print(k, v) env.MergeFlags(d) env.Program('f1.c') </file> diff --git a/doc/user/sideeffect.xml b/doc/user/sideeffect.xml index ffbfde7..6a10c3b 100644 --- a/doc/user/sideeffect.xml +++ b/doc/user/sideeffect.xml @@ -164,7 +164,7 @@ env.SideEffect('logfile.txt', f1 + f2) </file> <file name="file1.in">file1.in</file> <file name="file2.in">file2.in</file> - <file name="build" chmod="0755"> + <file name="build" chmod="0o755"> cat </file> </scons_example> diff --git a/doc/user/troubleshoot.xml b/doc/user/troubleshoot.xml index feac970..80e0e24 100644 --- a/doc/user/troubleshoot.xml +++ b/doc/user/troubleshoot.xml @@ -289,7 +289,7 @@ file3.c <scons_example name="troubleshoot_Dump"> <file name="SConstruct" printme="1"> env = Environment() -print env.Dump() +print(env.Dump()) </file> </scons_example> @@ -349,7 +349,7 @@ print env.Dump() <scons_example name="troubleshoot_Dump_ENV"> <file name="SConstruct" printme="1"> env = Environment() -print env.Dump('ENV') +print(env.Dump('ENV')) </file> </scons_example> |