From fdd366414c56cb8dd754daf8aea041bdcb9e0cb0 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sun, 13 Jan 2019 22:52:01 -0600 Subject: fixed mingw emitter to convert str to node before accessing node member, and updated mingw to remove MSVC like nologo flag --- src/engine/SCons/Tool/link.py | 2 ++ src/engine/SCons/Tool/mingw.py | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/engine/SCons/Tool/link.py b/src/engine/SCons/Tool/link.py index 5adc6ca..5d920fb 100644 --- a/src/engine/SCons/Tool/link.py +++ b/src/engine/SCons/Tool/link.py @@ -81,6 +81,8 @@ def _lib_emitter(target, source, env, **kw): if Verbose: print("_lib_emitter: target[0]={!r}".format(target[0].get_path())) for tgt in target: + if SCons.Util.is_String(tgt): + tgt = env.File(tgt) tgt.attributes.shared = 1 try: diff --git a/src/engine/SCons/Tool/mingw.py b/src/engine/SCons/Tool/mingw.py index 738460d..c495041 100644 --- a/src/engine/SCons/Tool/mingw.py +++ b/src/engine/SCons/Tool/mingw.py @@ -167,7 +167,8 @@ def generate(env): env['SHOBJSUFFIX'] = '.o' env['STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME'] = 1 - + if 'CCFLAGS' in env: + env['CCFLAGS'] = SCons.Util.CLVar(str(env['CCFLAGS']).replace('/nologo', '')) env['RC'] = 'windres' env['RCFLAGS'] = SCons.Util.CLVar('') env['RCINCFLAGS'] = '$( ${_concat(RCINCPREFIX, CPPPATH, RCINCSUFFIX, __env__, RDirs, TARGET, SOURCE)} $)' -- cgit v0.12 From 4518d14b9ad05001ad10b6c1e3d066ed8919571c Mon Sep 17 00:00:00 2001 From: Daniel Date: Sun, 13 Jan 2019 22:53:36 -0600 Subject: updated CHANGES.txt --- src/CHANGES.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 9f53b1d..02da450 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -12,6 +12,8 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER From Daniel Moody: - Update TempFileMunge class to use PRINT_CMD_LINE_FUNC + - Update link tool to convert target to node before accessing node member + - Update mingw tool to remove MSVC like nologo CCFLAG RELEASE 3.0.3 - Mon, 07 Jan 2019 20:05:22 -0400 NOTE: 3.0.2 release was dropped because there was a packaging bug. Please consider all 3.0.2 -- cgit v0.12 From 5f22d603fe483ec01764b43216b1908594608398 Mon Sep 17 00:00:00 2001 From: Daniel Date: Fri, 18 Jan 2019 20:53:22 -0600 Subject: switch to codecov and add new coverage for appveyor and travis --- .appveyor.yml | 236 +++++++++++++++++++++++++++++++++++++++++++++++++--------- .codecov.yml | 40 ++++++++++ .travis.yml | 106 +++++++++++++++++++------- 3 files changed, 320 insertions(+), 62 deletions(-) create mode 100644 .codecov.yml diff --git a/.appveyor.yml b/.appveyor.yml index 7f45e17..c9c55a3 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -1,8 +1,11 @@ #version: '3.0.1.{build}' -image: Visual Studio 2017 -shallow_clone: true - +image: + - Ubuntu + - Visual Studio 2015 + - Visual Studio 2017 + + cache: - downloads -> appveyor.yml - '%LOCALAPPDATA%\pip\Cache' @@ -10,69 +13,191 @@ cache: - C:\ProgramData\chocolatey\lib -> appveyor.yml install: - - "set PATH=%PYTHON%;%PYTHON%\\Scripts;C:\\cygwin64\\bin;C:\\msys64;%PATH%" - - python --version - - pip install pypiwin32 - - set STATIC_DEPS=true & pip install lxml - - choco install --allow-empty-checksums dmd - - choco install --allow-empty-checksums ldc - - choco install --allow-empty-checksums swig - - choco install --allow-empty-checksums vswhere - - choco install --allow-empty-checksums xsltproc + ### WINDOWS ### + # add python and python user-base to path for pip installs + - cmd: "C:\\%WINPYTHON%\\python.exe --version" + - cmd: for /F "tokens=*" %%g in ('C:\\%WINPYTHON%\\python.exe -m site --user-base') do (set PYUSERBASESITE=%%g) + - cmd: for /F "tokens=*" %%g in ('C:\\%WINPYTHON%\\python.exe -m site --user-site') do (set PYSITEDIR=%%g) + - cmd: "set PATH=%PYUSERBASESITE%;%PYUSERBASESITE%\\%WINPYTHON%\\Scripts;%PYUSERBASESITE%\\Scripts;C:\\%WINPYTHON%;C:\\%WINPYTHON%\\Scripts;C:\\cygwin64\\bin;C:\\msys64;C:\\ProgramData\\chocolatey\\bin;%PATH%" + - cmd: "C:\\%WINPYTHON%\\python.exe -m pip install --user -U pip setuptools wheel" + - cmd: "C:\\%WINPYTHON%\\python.exe -m pip install --user -U pypiwin32 coverage codecov" + - cmd: set STATIC_DEPS=true & C:\\%WINPYTHON%\\python.exe -m pip install --user -U lxml + # install 3rd party tools to test with + - cmd: choco install --allow-empty-checksums dmd ldc swig vswhere xsltproc + - cmd: set + + ### LINUX ### + - sh: sudo add-apt-repository -y ppa:deadsnakes/ppa + # allow the CI to continue even if some pkg in the pkglist may not be up to date + - sh: sudo apt-get update || true + - sh: sudo apt-get -y install python$PYTHON + - sh: wget https://bootstrap.pypa.io/get-pip.py + - sh: sudo -H python$PYTHON get-pip.py + - sh: which python$PYTHON + - sh: python$PYTHON --version + - sh: export PYSITEDIR=$(python$PYTHON -m site --user-site) + - sh: python$PYTHON -m pip install --user -U pip setuptools wheel + - sh: python$PYTHON -m pip install --user -U coverage codecov + - sh: STATIC_DEPS=true python$PYTHON -m pip install --user -U lxml || true + - sh: ./.travis/install.sh + # workaround for https://github.com/codecov/codecov-python/pull/188 + - sh: export CI=True + - sh: export APPVEYOR=True + - sh: printenv environment: matrix: - - PYTHON: "C:\\Python27" + - WINPYTHON: "Python27" + PYTHON: "2.7" + PYVER: 27 BUILD_JOB_NUM: 1 - - PYTHON: "C:\\Python27" + COVERAGE: 1 + - WINPYTHON: "Python27" + PYTHON: "2.7" + PYVER: 27 BUILD_JOB_NUM: 2 - - PYTHON: "C:\\Python27" + COVERAGE: 1 + - WINPYTHON: "Python27" + PYTHON: "2.7" + PYVER: 27 BUILD_JOB_NUM: 3 - - PYTHON: "C:\\Python27" + COVERAGE: 1 + - WINPYTHON: "Python27" + PYTHON: "2.7" + PYVER: 27 BUILD_JOB_NUM: 4 + COVERAGE: 1 - - PYTHON: "C:\\Python35" + - WINPYTHON: "Python36" + PYTHON: "3.6" + PYVER: 36 BUILD_JOB_NUM: 1 - - PYTHON: "C:\\Python35" + COVERAGE: 1 + - WINPYTHON: "Python36" + PYTHON: "3.6" + PYVER: 36 BUILD_JOB_NUM: 2 - - PYTHON: "C:\\Python35" + COVERAGE: 1 + - WINPYTHON: "Python36" + PYTHON: "3.6" + PYVER: 36 BUILD_JOB_NUM: 3 - - PYTHON: "C:\\Python35" + COVERAGE: 1 + - WINPYTHON: "Python36" + PYTHON: "3.6" + PYVER: 36 BUILD_JOB_NUM: 4 + COVERAGE: 1 - - PYTHON: "C:\\Python36" + - WINPYTHON: "Python35" + PYTHON: "3.5" + PYVER: 35 BUILD_JOB_NUM: 1 - - PYTHON: "C:\\Python36" + - WINPYTHON: "Python35" + PYTHON: "3.5" + PYVER: 35 BUILD_JOB_NUM: 2 - - PYTHON: "C:\\Python36" + - WINPYTHON: "Python35" + PYTHON: "3.5" + PYVER: 35 BUILD_JOB_NUM: 3 - - PYTHON: "C:\\Python36" + - WINPYTHON: "Python35" + PYTHON: "3.5" + PYVER: 35 BUILD_JOB_NUM: 4 + - WINPYTHON: "Python35" + PYTHON: "3.5" + PYVER: 35 + BUILD_JOB_NUM: 1 - - PYTHON: "C:\\Python37" + - WINPYTHON: "Python37" + PYTHON: "3.7" + PYVER: 37 BUILD_JOB_NUM: 1 - - PYTHON: "C:\\Python37" + COVERAGE: 1 + - WINPYTHON: "Python37" + PYTHON: "3.7" + PYVER: 37 BUILD_JOB_NUM: 2 - - PYTHON: "C:\\Python37" + COVERAGE: 1 + - WINPYTHON: "Python37" + PYTHON: "3.7" + PYVER: 37 BUILD_JOB_NUM: 3 - - PYTHON: "C:\\Python37" + COVERAGE: 1 + - WINPYTHON: "Python37" + PYTHON: "3.7" + PYVER: 37 BUILD_JOB_NUM: 4 + COVERAGE: 1 + +matrix: + exclude: + # test python 2.7 on Visual Studio 2015 image + - image: Visual Studio 2015 + WINPYTHON: "Python37" + - image: Visual Studio 2015 + WINPYTHON: "Python36" + - image: Visual Studio 2015 + WINPYTHON: "Python35" + + # test python 3.6 on Visual Studio 2017 image + - image: Visual Studio 2017 + WINPYTHON: "Python27" + - image: Visual Studio 2017 + WINPYTHON: "Python35" + - image: Visual Studio 2017 + WINPYTHON: "Python37" + + # test python 3.7 on Ubuntu + - image: Ubuntu + WINPYTHON: "Python27" + - image: Ubuntu + WINPYTHON: "Python35" + - image: Ubuntu + WINPYTHON: "Python36" before_build: - - ps: dir "C:\Program Files\Git\usr\bin\x*.exe" - ps: | - if (Test-Path "C:\Program Files\Git\usr\bin\xsltproc.EXE" ) { - Remove-Item "C:\Program Files\Git\usr\bin\xsltproc.EXE" -ErrorAction Ignore + if ($isWindows) + { + dir "C:\Program Files\Git\usr\bin\x*.exe" + if (Test-Path "C:\Program Files\Git\usr\bin\xsltproc.EXE" ) { + Remove-Item "C:\Program Files\Git\usr\bin\xsltproc.EXE" -ErrorAction Ignore + } + dir "C:\Program Files\Git\usr\bin\x*.exe" } - - ps: dir "C:\Program Files\Git\usr\bin\x*.exe" - + build: off build_script: - - cmd: python runtest.py -l -a > all_tests.txt - - ps: >- + # get tests all tests + - cmd: "C:\\%WINPYTHON%\\python.exe runtest.py -l -a > all_tests.txt" + - sh: python$PYTHON runtest.py -l -a > all_tests.txt + + # setup coverage is set in environment + - ps: | + if ($env:COVERAGE -eq 1){ + $env:COVERAGE_PROCESS_START = "$($env:APPVEYOR_BUILD_FOLDER)/.coveragerc"; + $env:PYTHONNOUSERSITE = ""; + New-Item -ItemType Directory -Force -Path "$($env:PYSITEDIR)"; + $env:COVERAGE_FILE = "$($env:APPVEYOR_BUILD_FOLDER)/.coverage"; + $usercustomizeText = "import os`r`nos.environ['COVERAGE_PROCESS_START'] = '$($env:COVERAGE_PROCESS_START)'`r`nimport coverage`r`ncoverage.process_startup()"; + $usercustomizeText|Set-Content "$($env:PYSITEDIR)/usercustomize.py"; + if ($isWindows) + { + $coveragercFile = "[run]`r`nsource = $($env:APPVEYOR_BUILD_FOLDER)/src`r`nparallel = True`r`ndisable_warnings = trace-changed`r`nomit =`r`n`t*Tests.py`r`n`tsrc\test_*`r`n`tsrc\setup.py`r`n`r`n[path]`r`nsource = $($env:APPVEYOR_BUILD_FOLDER)`r`n[report]`r`nomit =`r`n`t*Tests.py`r`n`tsrc\test_*`r`n`tsrc\setup.py`r`n`r`n" + } + else + { + $coveragercFile = "[run]`nsource = $($env:APPVEYOR_BUILD_FOLDER)/src`nparallel = True`ndisable_warnings = trace-changed`nomit =`n`t*Tests.py`n`tsrc/test_*`n`tsrc/setup.py`n`n[path]`nsource = $($env:APPVEYOR_BUILD_FOLDER)`n[report]`nomit =`n`t*Tests.py`n`tsrc/test_*`n`tsrc/setup.py`n`n" + } + $coveragercFile|Set-Content "$($env:COVERAGE_PROCESS_START)"; + } + # setup portion of tests for this build job (1-4) + - ps: | $TOTAL_BUILD_JOBS = 4; $Lines = (Get-Content all_tests.txt | Measure-Object -line).Lines; $start = ($Lines / $TOTAL_BUILD_JOBS) * ($Env:BUILD_JOB_NUM - 1); @@ -80,4 +205,43 @@ build_script: if ( $Env:BUILD_JOB_NUM -eq $TOTAL_BUILD_JOBS){ $end = $Lines }; if ( $start -eq 0 ){ $start = 1 }; get-content all_tests.txt | select -first ($end - $start) -skip ($start - 1) | Out-File -Encoding ASCII build_tests.txt; - - cmd: powershell -Command "& { python runtest.py -j 2 -f build_tests.txt; if($LastExitCode -eq 2 -Or $LastExitCode -eq 0) { $host.SetShouldExit(0 )} else {$host.SetShouldExit(1)}}" \ No newline at end of file + + # exclude VS 10.0 because it hangs the testing until this is resolved: + # https://help.appveyor.com/discussions/problems/19283-visual-studio-2010-trial-license-has-expired + - ps: | + New-Item -Name exclude_list.txt -ItemType File + $workaround_image = "Visual Studio 2015" + if ($env:APPVEYOR_BUILD_WORKER_IMAGE -eq $workaround_image){ + Add-Content -Path 'exclude_list.txt' -Value 'test\MSVS\vs-10.0-exec.py' + } + + # NOTE: running powershell from cmd on purpose because it formats the output + # correctly + - cmd: powershell -Command "& { if($env:COVERAGE -eq 1) { coverage run -p --rcfile=$($env:COVERAGE_PROCESS_START) runtest.py --exclude-list exclude_list.txt -f build_tests.txt } else { C:\\%WINPYTHON%\\python.exe runtest.py -j 2 --exclude-list exclude_list.txt -f build_tests.txt }; if($LastExitCode -eq 2 -Or $LastExitCode -eq 0) { $host.SetShouldExit(0 )} else {$host.SetShouldExit(1)}}" + + # unset JAVA_TOOL_OPTIONS because newer java prints this to stderr + - sh: | + unset JAVA_TOOL_OPTIONS + if [ "$COVERAGE" -eq "1" ]; then + coverage run -p --rcfile="$COVERAGE_PROCESS_START" runtest.py --exclude-list exclude_list.txt -f build_tests.txt || if [[ $? == 2 ]]; then true; else false; fi; + else + python$PYTHON runtest.py -j 2 --exclude-list exclude_list.txt -f build_tests.txt || if [[ $? == 2 ]]; then true; else false; fi; + fi + + # run converage +on_finish: + - ps: | + if ($env:COVERAGE -eq 1) + { + & coverage combine + & coverage report + & coverage xml -o coverage_xml.xml + } + # running in powershell causes an error so running in platform + # shells + - cmd: if %COVERAGE% equ 1 codecov -X gcov --file coverage_xml.xml + - sh: if [ $COVERAGE -eq 1 ]; then codecov -X gcov --file coverage_xml.xml; fi + # not using coveralls, so leaving it commented out in case we switch back + #- cmd: "C:\\%WINPYTHON%\\python.exe -m pip install --user -U coveralls" + #- sh: python$PYTHON -m pip install --user -U coveralls + #- ps: coveralls --rcfile="$($env:COVERAGE_PROCESS_START)" diff --git a/.codecov.yml b/.codecov.yml new file mode 100644 index 0000000..9c51ceb --- /dev/null +++ b/.codecov.yml @@ -0,0 +1,40 @@ +codecov: + notify: + # calculate coverge even when we fail + require_ci_to_pass: no + +ignore: + # ignore test files in the source + # this is redundent and should not be in the report anyways + # because the coveragerc file ignores them + - "*Test.py" + - "setup.py" + - "test_*" + +coverage: + precision: 2 + round: down + range: "70...100" + + status: + project: + default: + # compare against the current coverage + # that PR is attempt to merge to + # don't consider a drop in coverage success + target: auto + threshold: null + base: pr + + patch: + default: + # considering only the lines changed + # make sure all new lines in the PR are covered + # to consider a success + target: 100 + threshold: null + base: pr + + changes: no + +comment: off diff --git a/.travis.yml b/.travis.yml index e279ad9..fb48776 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,7 +17,7 @@ install: # pypy is not passing, but allow failures for coverage stage to be reached matrix: allow_failures: - - python: pypy + - stage: Test jobs: include: @@ -27,46 +27,63 @@ jobs: before_script: skip after_success: skip python: 2.7 - env: PYVER=27 + env: + - PYVER=27 + - PYTHON=2.7 sudo: required - + - <<: *test_job python: 3.5 - env: PYVER=35 + env: + - PYVER=35 + - PYTHON=3.5 sudo: required - <<: *test_job python: 3.6 - env: PYVER=36 + env: + - PYVER=36 + - PYTHON=3.6 sudo: required - <<: *test_job python: 3.7 env: - PYVER=37 + - PYTHON=3.7 sudo: required dist: xenial # required for Python 3.7 (travis-ci/travis-ci#9069) - <<: *test_job python: pypy - env: PYVER=pypy + env: + - PYVER=pypy + - PYTHON=pypy sudo: required - &coverage_jobs stage: Coverage - + python: 2.7 before_script: - - sudo pip install coverage - - sudo pip install coveralls + # install our own python so we can modify usercustomize.py + - deactivate + - sudo add-apt-repository -y ppa:deadsnakes/ppa + - sudo apt-get update || true + - sudo apt-get -y install python$PYTHON + - wget https://bootstrap.pypa.io/get-pip.py + - sudo -H python$PYTHON get-pip.py + - which python$PYTHON + - python$PYTHON --version + - python$PYTHON -m pip install --user -U coverage codecov # set this ensure user sites are available - export PYTHONNOUSERSITE= # attempt to get a location where we can store the usercustomize.py file - - python -m site - - export PYSITEDIR=$(python -m site --user-site) + - python$PYTHON -m site + - export PYSITEDIR=$(python$PYTHON -m site --user-site) - sudo mkdir -p $PYSITEDIR - sudo touch ${PYSITEDIR}/usercustomize.py - - export COVERAGE_FILE=$PWD/.coverage_file + - export COVERAGE_FILE=$PWD/.coverage # write the usercustomize.py file so all python processes use coverage and know where the config file is - echo "import os" | sudo tee --append ${PYSITEDIR}/usercustomize.py - echo "os.environ['COVERAGE_PROCESS_START'] = '$PWD/.coveragerc'" | sudo tee --append ${PYSITEDIR}/usercustomize.py @@ -74,42 +91,79 @@ jobs: - echo "coverage.process_startup()" | sudo tee --append ${PYSITEDIR}/usercustomize.py script: - - export TOTAL_BUILD_JOBS=8 + - export TOTAL_BUILD_JOBS=4 # write the coverage config file - export COVERAGE_PROCESS_START=$PWD/.coveragerc - echo "[run]" >> .coveragerc - echo "source = $PWD/src" >> .coveragerc - echo "parallel = True" >> .coveragerc - printf "omit =\n\t*Tests.py\n\tsrc/test_*\n\tsrc/setup.py\n\n" >> .coveragerc - - echo "[path] = $PWD" >> .coveragerc + - echo "[path]" >> .coveragerc + - echo "source = $PWD" >> .coveragerc + - echo "[report]" >> .coveragerc + - printf "omit =\n\t*Tests.py\n\tsrc/test_*\n\tsrc/setup.py\n\n" >> .coveragerc # get a list of all the tests to split them up - - python runtest.py -l -a > all_tests + - python$PYTHON runtest.py -l -a > all_tests - let "start = ($(wc -l < all_tests) / ${TOTAL_BUILD_JOBS}) * (${BUILD_JOB_NUM} - 1)"; true; - let "end = ($(wc -l < all_tests) / ${TOTAL_BUILD_JOBS}) * ${BUILD_JOB_NUM}" - if (( ${BUILD_JOB_NUM} == ${TOTAL_BUILD_JOBS} )); then end=$(wc -l < all_tests); fi - if (( ${start} == 0 )); then start=1; fi - sed -n ${start},${end}p all_tests > build_tests - coverage run -p --rcfile=$PWD/.coveragerc runtest.py -f build_tests || if [[ $? == 2 ]]; then true; else false; fi - - after_success: + + after_script: - coverage combine - coverage report - - coveralls --rcfile=$PWD/.coveragerc + - coverage xml -o coverage_xml.xml + - codecov -X gcov --file coverage_xml.xml + # not using coveralls but leaving it commented to + # make it easy to re-enable + #- python$PYTHON -m pip install --user -U coveralls + #- coveralls --rcfile=$PWD/.coveragerc - env: BUILD_JOB_NUM=1 + env: + - PYVER=27 + - PYTHON=2.7 + - BUILD_JOB_NUM=1 - <<: *coverage_jobs - env: BUILD_JOB_NUM=2 + env: + - PYVER=27 + - PYTHON=2.7 + - BUILD_JOB_NUM=2 - <<: *coverage_jobs - env: BUILD_JOB_NUM=3 + env: + - PYVER=27 + - PYTHON=2.7 + - BUILD_JOB_NUM=3 - <<: *coverage_jobs - env: BUILD_JOB_NUM=4 + env: + - PYVER=27 + - PYTHON=2.7 + - BUILD_JOB_NUM=4 + - <<: *coverage_jobs - env: BUILD_JOB_NUM=5 + python: 3.6 + env: + - PYVER=36 + - PYTHON=3.6 + - BUILD_JOB_NUM=1 - <<: *coverage_jobs - env: BUILD_JOB_NUM=6 + python: 3.6 + env: + - PYVER=36 + - PYTHON=3.6 + - BUILD_JOB_NUM=2 - <<: *coverage_jobs - env: BUILD_JOB_NUM=7 + python: 3.6 + env: + - PYVER=36 + - PYTHON=3.6 + - BUILD_JOB_NUM=3 - <<: *coverage_jobs - env: BUILD_JOB_NUM=8 + python: 3.6 + env: + - PYVER=36 + - PYTHON=3.6 + - BUILD_JOB_NUM=4 -- cgit v0.12 From 55b1e9a31f6f0e463991050a9499498c9cacdf21 Mon Sep 17 00:00:00 2001 From: Daniel Date: Fri, 18 Jan 2019 20:55:12 -0600 Subject: swtich to codecov badge --- README.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.rst b/README.rst index ca66d51..ccc118e 100755 --- a/README.rst +++ b/README.rst @@ -21,9 +21,9 @@ SCons - a software construction tool :target: https://ci.appveyor.com/project/SCons/scons :alt: AppVeyor CI build Status -.. image:: https://coveralls.io/repos/github/SCons/scons/badge.svg?branch=master - :target: https://coveralls.io/github/SCons/scons?branch=master - :alt: Coveralls.io Coverage Status +.. image:: https://codecov.io/gh/dmoody256/scons/branch/master/graph/badge.svg + :target: https://codecov.io/gh/dmoody256/scons + :alt: CodeCov Coverage Status Welcome to the SCons development tree. The real purpose of this tree is to -- cgit v0.12 From 3c785d3842e5cfd41689782d1e6425e0f6fd0f7f Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Sun, 6 Jan 2019 13:32:45 -0700 Subject: Work on Default docu wording a bit more An earlier change updated some examples, this makes some tweaks to the wording as well for Default, DEFAULT_TARGETS, etc. to clarify. Signed-off-by: Mats Wichmann --- doc/man/scons.xml | 2 +- doc/user/command-line.xml | 18 ++++++++++-------- src/CHANGES.txt | 2 ++ src/engine/SCons/Script/SConscript.xml | 4 ++++ 4 files changed, 17 insertions(+), 9 deletions(-) diff --git a/doc/man/scons.xml b/doc/man/scons.xml index 805164c..caeb2b1 100644 --- a/doc/man/scons.xml +++ b/doc/man/scons.xml @@ -274,7 +274,7 @@ scons will build all target files in or below the current directory. Explicit default targets (to be built when no targets are specified on the command line) -may be defined the SConscript file(s) +may be defined in the SConscript file(s) using the Default() function, described below. diff --git a/doc/user/command-line.xml b/doc/user/command-line.xml index 1b329e7..d129d2e 100644 --- a/doc/user/command-line.xml +++ b/doc/user/command-line.xml @@ -1987,17 +1987,16 @@ foo.c - One of the most basic things you can control - is which targets &SCons; will build by default--that is, + You can control + which targets &SCons; will build by default - that is, when there are no targets specified on the command line. As mentioned previously, &SCons; will normally build every target - in or below the current directory - by default--that is, when you don't + in or below the current directory unless you explicitly specify one or more targets on the command line. Sometimes, however, you may want - to specify explicitly that only + to specify that only certain programs, or programs in certain directories, should be built by default. You do this with the &Default; function: @@ -2193,7 +2192,8 @@ prog2.c &SCons; supports a &DEFAULT_TARGETS; variable - that lets you get at the current list of default targets. + that lets you get at the current list of default targets + specified by calls to the &Default; function or method. The &DEFAULT_TARGETS; variable has two important differences from the &COMMAND_LINE_TARGETS; variable. First, the &DEFAULT_TARGETS; variable is a list of @@ -2233,7 +2233,7 @@ prog1.c Second, - the contents of the &DEFAULT_TARGETS; list change + the contents of the &DEFAULT_TARGETS; list changes in response to calls to the &Default; function, as you can see from the following &SConstruct; file: @@ -2351,7 +2351,9 @@ prog2.c Notice how the value of &BUILD_TARGETS; changes depending on whether a target is - specified on the command line: + specified on the command line - &BUILD_TARGETS; + takes from &DEFAULT_TARGETS; + only if there are no &COMMAND_LINE_TARGETS;: diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 840359c..01dda95 100755 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -16,6 +16,7 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER product from the default Visual Studio - Add TEMPFILESUFFIX to allow a customizable filename extension, as described in the patch attached to issue #2431. + - Doc updates around Default(), and the various *TARGETS variables. From Daniel Moody: - Improved support for VC14.1 and Visual Studio 2017, as well as arm and arm64 targets. @@ -25,6 +26,7 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER - Enhance cpp scanner regex logic to detect if/elif expressions without whitespaces but parenthesis like "#if(defined FOO)" or "#elif!(BAR)" correctly. + RELEASE 3.0.3 - Mon, 07 Jan 2019 20:05:22 -0400 NOTE: 3.0.2 release was dropped because there was a packaging bug. Please consider all 3.0.2 content. diff --git a/src/engine/SCons/Script/SConscript.xml b/src/engine/SCons/Script/SConscript.xml index a6258c4..330a56c 100644 --- a/src/engine/SCons/Script/SConscript.xml +++ b/src/engine/SCons/Script/SConscript.xml @@ -38,6 +38,10 @@ Multiple calls to &f-Default; are legal, and add to the list of default targets. +As noted above, both forms of this call affect the +same global list of default targets; the +construction environment method applies +construction variable expansion to the targets. -- cgit v0.12 From 43e2b06f2f5da6ba275647079c992581c025bce7 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sun, 20 Jan 2019 10:28:00 -0600 Subject: switch badge to scons repo, fix mispelling, commented out linux on appveyor --- .appveyor.yml | 5 +++-- .codecov.yml | 2 +- README.rst | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index c9c55a3..d80bdb4 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -1,7 +1,8 @@ #version: '3.0.1.{build}' -image: - - Ubuntu +image: + # linux builds disabled for now + # - Ubuntu - Visual Studio 2015 - Visual Studio 2017 diff --git a/.codecov.yml b/.codecov.yml index 9c51ceb..9ea78f5 100644 --- a/.codecov.yml +++ b/.codecov.yml @@ -5,7 +5,7 @@ codecov: ignore: # ignore test files in the source - # this is redundent and should not be in the report anyways + # this is redundant and should not be in the report anyways # because the coveragerc file ignores them - "*Test.py" - "setup.py" diff --git a/README.rst b/README.rst index ccc118e..36a2689 100755 --- a/README.rst +++ b/README.rst @@ -21,8 +21,8 @@ SCons - a software construction tool :target: https://ci.appveyor.com/project/SCons/scons :alt: AppVeyor CI build Status -.. image:: https://codecov.io/gh/dmoody256/scons/branch/master/graph/badge.svg - :target: https://codecov.io/gh/dmoody256/scons +.. image:: https://codecov.io/gh/SCons/scons/branch/master/graph/badge.svg + :target: https://codecov.io/gh/SCons/scons :alt: CodeCov Coverage Status -- cgit v0.12 From 5d13f0a369a975ca3c6f0aeaecbb57fda4b9bd27 Mon Sep 17 00:00:00 2001 From: William Deegan Date: Sun, 20 Jan 2019 22:17:12 +0000 Subject: Update CHANGES.txt to reference fixed github issues and to highlight initial support for ARM TARGET_ARCH --- src/CHANGES.txt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 840359c..64f02cb 100755 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -7,9 +7,6 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER - From John Doe: - - Whatever John Doe did. - From Mats Wichmann: - Improve finding of Microsoft compiler: add a 'products' wildcard in case 2017 Build Tools only is installed as it is considered a separate @@ -19,6 +16,8 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER From Daniel Moody: - Improved support for VC14.1 and Visual Studio 2017, as well as arm and arm64 targets. + Issues #3268 & Issue #3222 + - Initial support for ARM targets with Visual Studio 2017 - Issue #3182 (You must set TARGET_ARCH for this to work) - Update TempFileMunge class to use PRINT_CMD_LINE_FUNC From Tobias Herzog -- cgit v0.12 From 90b94ae78f57ccdae4e0abcc2de5cd5ab20e80d4 Mon Sep 17 00:00:00 2001 From: William Deegan Date: Sun, 20 Jan 2019 22:18:09 +0000 Subject: Regenerated docs for 3.0.4 release --- doc/generated/examples/caching_ex-random_1.xml | 6 +-- doc/generated/examples/troubleshoot_explain1_3.xml | 2 +- doc/generated/tools.gen | 12 ++--- doc/generated/tools.mod | 4 +- doc/generated/variables.gen | 51 ++++++++++++++++------ doc/generated/variables.mod | 6 ++- 6 files changed, 53 insertions(+), 28 deletions(-) diff --git a/doc/generated/examples/caching_ex-random_1.xml b/doc/generated/examples/caching_ex-random_1.xml index c821b48..0a432e9 100644 --- a/doc/generated/examples/caching_ex-random_1.xml +++ b/doc/generated/examples/caching_ex-random_1.xml @@ -1,9 +1,9 @@ % scons -Q -cc -o f3.o -c f3.c -cc -o f4.o -c f4.c -cc -o f1.o -c f1.c cc -o f5.o -c f5.c +cc -o f3.o -c f3.c cc -o f2.o -c f2.c +cc -o f1.o -c f1.c +cc -o f4.o -c f4.c cc -o prog f1.o f2.o f3.o f4.o f5.o diff --git a/doc/generated/examples/troubleshoot_explain1_3.xml b/doc/generated/examples/troubleshoot_explain1_3.xml index a60ed80..ebc13f8 100644 --- a/doc/generated/examples/troubleshoot_explain1_3.xml +++ b/doc/generated/examples/troubleshoot_explain1_3.xml @@ -3,5 +3,5 @@ cp file.in file.oout scons: warning: Cannot find target file.out after building -File "/home/bdbaddog/scons/git/as_scons/src/script/scons.py", line 204, in <module> +File "/home/bdeegan/devel/scons/git/as_scons/src/script/scons.py", line 204, in <module> diff --git a/doc/generated/tools.gen b/doc/generated/tools.gen index 7ae66c5..7661110 100644 --- a/doc/generated/tools.gen +++ b/doc/generated/tools.gen @@ -778,19 +778,19 @@ Sets construction variables for the Sets: &cv-link-AS;, &cv-link-ASCOM;, &cv-link-ASFLAGS;, &cv-link-ASPPCOM;, &cv-link-ASPPFLAGS;.Uses: &cv-link-ASCOMSTR;, &cv-link-ASPPCOMSTR;. - - Packaging + + packaging -Sets construction variables for the Package Builder. +A framework for building binary and source packages. - - packaging + + Packaging -A framework for building binary and source packages. +Sets construction variables for the Package Builder. diff --git a/doc/generated/tools.mod b/doc/generated/tools.mod index 1209d74..f9bc1d7 100644 --- a/doc/generated/tools.mod +++ b/doc/generated/tools.mod @@ -78,8 +78,8 @@ THIS IS AN AUTOMATICALLY-GENERATED FILE. DO NOT EDIT. mwcc"> mwld"> nasm"> -Packaging"> packaging"> +Packaging"> pdf"> pdflatex"> pdftex"> @@ -186,8 +186,8 @@ THIS IS AN AUTOMATICALLY-GENERATED FILE. DO NOT EDIT. mwcc"> mwld"> nasm"> -Packaging"> packaging"> +Packaging"> pdf"> pdflatex"> pdftex"> diff --git a/doc/generated/variables.gen b/doc/generated/variables.gen index 5ed8c2f..4e84fbc 100644 --- a/doc/generated/variables.gen +++ b/doc/generated/variables.gen @@ -4487,6 +4487,7 @@ constructor; setting it later has no effect. Valid values for Windows are +14.1, 14.0, 14.0Exp, 12.0, @@ -6719,16 +6720,6 @@ Example - - SHLIBVERSIONFLAGS - - -Extra flags added to $SHLINKCOM when building versioned -SharedLibrary. These flags are only used when $SHLIBVERSION is -set. - - - _SHLIBVERSIONFLAGS @@ -6742,6 +6733,16 @@ and some extra dynamically generated options (such as + + SHLIBVERSIONFLAGS + + +Extra flags added to $SHLINKCOM when building versioned +SharedLibrary. These flags are only used when $SHLIBVERSION is +set. + + + SHLINK @@ -7221,18 +7222,24 @@ This variable must be passed as an argument to the Environment() constructor; setting it later has no effect. This is currently only used on Windows, but in the future it will be used on other OSes as well. +If this is set and MSVC_VERSION is not set, this will search for +all installed MSVC's that support the TARGET_ARCH, selecting the +latest version for use. Valid values for Windows are x86, +arm, i386 (for 32 bits); amd64, +arm64, emt64, x86_64 (for 64 bits); and ia64 (Itanium). + For example, if you want to compile 64-bit binaries, you would set TARGET_ARCH='x86_64' in your SCons environment. @@ -7272,14 +7279,30 @@ The suffix used for tar file names. The prefix for a temporary file used -to execute lines longer than $MAXLINELENGTH. -The default is '@'. -This may be set for toolchains that use other values, -such as '-@' for the diab compiler +to store lines lines longer than $MAXLINELENGTH +as operations which call out to a shell will fail +if the line is too long, which particularly +impacts linking. +The default is '@', which works for the Microsoft +and GNU toolchains on Windows. +Set this appropriately for other toolchains, +for example '-@' for the diab compiler or '-via' for ARM toolchain. + + TEMPFILESUFFIX + + +The suffix used for the temporary file name +used for long command lines. The name should +include the dot ('.') if one is wanted as +it will not be added automatically. +The default is '.lnk'. + + + TEX diff --git a/doc/generated/variables.mod b/doc/generated/variables.mod index 7dfb208..ffe4cf1 100644 --- a/doc/generated/variables.mod +++ b/doc/generated/variables.mod @@ -503,8 +503,8 @@ THIS IS AN AUTOMATICALLY-GENERATED FILE. DO NOT EDIT. $_SHLIBSONAME"> $SHLIBSUFFIX"> $SHLIBVERSION"> -$SHLIBVERSIONFLAGS"> $_SHLIBVERSIONFLAGS"> +$SHLIBVERSIONFLAGS"> $SHLINK"> $SHLINKCOM"> $SHLINKCOMSTR"> @@ -544,6 +544,7 @@ THIS IS AN AUTOMATICALLY-GENERATED FILE. DO NOT EDIT. $TARGETS"> $TARSUFFIX"> $TEMPFILEPREFIX"> +$TEMPFILESUFFIX"> $TEX"> $TEXCOM"> $TEXCOMSTR"> @@ -1140,8 +1141,8 @@ THIS IS AN AUTOMATICALLY-GENERATED FILE. DO NOT EDIT. $_SHLIBSONAME"> $SHLIBSUFFIX"> $SHLIBVERSION"> -$SHLIBVERSIONFLAGS"> $_SHLIBVERSIONFLAGS"> +$SHLIBVERSIONFLAGS"> $SHLINK"> $SHLINKCOM"> $SHLINKCOMSTR"> @@ -1181,6 +1182,7 @@ THIS IS AN AUTOMATICALLY-GENERATED FILE. DO NOT EDIT. $TARGETS"> $TARSUFFIX"> $TEMPFILEPREFIX"> +$TEMPFILESUFFIX"> $TEX"> $TEXCOM"> $TEXCOMSTR"> -- cgit v0.12 From d936671a277346ea575a4ba1422ab06c4b8c9ad8 Mon Sep 17 00:00:00 2001 From: William Deegan Date: Sun, 20 Jan 2019 22:48:58 +0000 Subject: Updates for 3.0.4 release --- debian/changelog | 8 ++++++- src/Announce.txt | 6 +++++ src/RELEASE.txt | 71 ++++++++++---------------------------------------------- 3 files changed, 25 insertions(+), 60 deletions(-) diff --git a/debian/changelog b/debian/changelog index 7ef3a14..7698b1e 100755 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,14 @@ +scons (3.0.4) unstable; urgency=low + + * Maintenance Release + + -- William Deegan Sun, 20 Jan 2019 19:44:18 -0700 + scons (3.0.3) unstable; urgency=low * Maintenance Release - -- William Deegan Sat, 07 Jan 2018 19:44:18 -0700 + -- William Deegan Sat, 07 Jan 2019 19:44:18 -0700 scons (3.0.2) unstable; urgency=low diff --git a/src/Announce.txt b/src/Announce.txt index 4058aa6..7eb57ae 100755 --- a/src/Announce.txt +++ b/src/Announce.txt @@ -24,6 +24,12 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER release and consult the CHANGES.txt file for complete a list of changes since last release. This announcement highlights only the important changes. + Please note the following important changes since release 3.0.3: + - Added TEMPFILESUFFIX to allow user to specify suffix for tempfiles used for long command lines + - Initial support for ARM architectures with Microsoft Visual Studio 2017. You must set TARGET_ARCH + to arm or arm64 to enable. + - Fixed issue detecting installs of Microsoft Visual Studio 2017 as well as Microsoft build tools 2017. + Please note the following important changes since release 2.5.1: This is the initial release supporting both python 3.5+ and 2.7.x and pypy diff --git a/src/RELEASE.txt b/src/RELEASE.txt index 8987ee2..c5b6203 100755 --- a/src/RELEASE.txt +++ b/src/RELEASE.txt @@ -3,71 +3,24 @@ http://www.scons.org/download.php - XXX The primary purpose of this release ... XXX - A SCons "checkpoint release" is intended to provide early access to - new features so they can be tested in the field before being released - for adoption by other software distributions. - - Note that a checkpoint release is developed using the same test-driven - development methodology as all SCons releases. Existing SCons - functionality should all work as it does in previous releases (except - for any changes identified in the release notes) and early adopters - should be able to use a checkpoint release safely for production work - with existing SConscript files. If not, it represents not only a bug - in SCons but also a hole in the regression test suite, and we want to - hear about it. - - New features may be more lightly tested than in past releases, - especially as concerns their interaction with all of the other - functionality in SCons. We are especially interested in hearing bug - reports about new functionality. - - We do not recommend that downstream distributions (Debian, Fedora, - etc.) package a checkpoint release, mainly to avoid confusing the - "public" release numbering with the long checkpoint release names. - - Here is a summary of the changes since 1.3.0: + Here is a summary of the changes since 3.0.3: NEW FUNCTIONALITY - - List new features (presumably why a checkpoint is being released) - - DEPRECATED FUNCTIONALITY - - - List anything that's been deprecated since the last release - - CHANGED/ENHANCED EXISTING FUNCTIONALITY - - - List modifications to existing features, where the previous behavior - wouldn't actually be considered a bug + - Added TEMPFILESUFFIX to allow user to specify suffix for tempfiles used for long command lines + - Initial support for ARM architectures with Microsoft Visual Studio 2017. You must set TARGET_ARCH + to arm or arm64 to enable. FIXES - - List fixes of outright bugs - - IMPROVEMENTS - - - List improvements that wouldn't be visible to the user in the - documentation: performance improvements (describe the circumstances - under which they would be observed), or major code cleanups - - PACKAGING - - - List changes in the way SCons is packaged and/or released - - DOCUMENTATION - - - List any significant changes to the documentation (not individual - typo fixes, even if they're mentioned in src/CHANGES.txt to give - the contributor credit) - - DEVELOPMENT - - - List visible changes in the way SCons is developed + - Fixed issue detecting installs of Microsoft Visual Studio 2017 as well as Microsoft build tools 2017. - Thanks to CURLY, LARRY, and MOE for their contributions to this release. - Contributors are listed alphabetically by their last name. -__COPYRIGHT__ -__FILE__ __REVISION__ __DATE__ __DEVELOPER__ +git shortlog --no-merges -ns 3.0.3..HEAD + 17 Daniel + 10 Mats Wichmann + 4 Daniel Moody + 4 William Deegan + 3 anatoly techtonik + 1 Tobias Herzog \ No newline at end of file -- cgit v0.12 From 3a41ed6b288cee8d085373ad7fa02894e1903864 Mon Sep 17 00:00:00 2001 From: William Deegan Date: Sun, 20 Jan 2019 22:51:22 +0000 Subject: Updated files per ReleaseConfig for 3.0.4 release --- README.rst | 14 +++++++------- ReleaseConfig | 2 +- SConstruct | 2 +- src/Announce.txt | 2 +- src/CHANGES.txt | 2 +- src/RELEASE.txt | 2 +- testing/framework/TestSCons.py | 2 +- 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/README.rst b/README.rst index ca66d51..49b1556 100755 --- a/README.rst +++ b/README.rst @@ -499,13 +499,13 @@ about `Executing SCons Without Installing`_):: Depending on the utilities installed on your system, any or all of the following packages will be built:: - build/dist/scons-3.0.3.tar.gz - build/dist/scons-3.0.3.zip - build/dist/scons-doc-3.0.3.tar.gz - build/dist/scons-local-3.0.3.tar.gz - build/dist/scons-local-3.0.3.zip - build/dist/scons-src-3.0.3.tar.gz - build/dist/scons-src-3.0.3.zip + build/dist/scons-3.0.4.tar.gz + build/dist/scons-3.0.4.zip + build/dist/scons-doc-3.0.4.tar.gz + build/dist/scons-local-3.0.4.tar.gz + build/dist/scons-local-3.0.4.zip + build/dist/scons-src-3.0.4.tar.gz + build/dist/scons-src-3.0.4.zip The SConstruct file is supposed to be smart enough to avoid trying to build packages for which you don't have the proper utilities installed. For diff --git a/ReleaseConfig b/ReleaseConfig index 900e8b5..01440ba 100755 --- a/ReleaseConfig +++ b/ReleaseConfig @@ -32,7 +32,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" # 'final', the patchlevel is set to the release date. This value is # mandatory and must be present in this file. #version_tuple = (2, 2, 0, 'final', 0) -version_tuple = (3, 0, 4, 'alpha', 0) +version_tuple = (3, 0, 4) # Python versions prior to unsupported_python_version cause a fatal error # when that version is used. Python versions prior to deprecate_python_version diff --git a/SConstruct b/SConstruct index a7eca26..3d93d1e 100644 --- a/SConstruct +++ b/SConstruct @@ -51,7 +51,7 @@ import textwrap import bootstrap project = 'scons' -default_version = '3.0.3' +default_version = '3.0.4' copyright = "Copyright (c) %s The SCons Foundation" % copyright_years SConsignFile() diff --git a/src/Announce.txt b/src/Announce.txt index 7eb57ae..6558faa 100755 --- a/src/Announce.txt +++ b/src/Announce.txt @@ -18,7 +18,7 @@ So that everyone using SCons can help each other learn how to use it more effectively, please go to http://scons.org/lists.html#users to sign up for the scons-users mailing list. -RELEASE VERSION/DATE TO BE FILLED IN LATER +RELEASE 3.0.4 - Mon, 20 Jan 2019 22:49:27 +0000 Please consult the RELEASE.txt file for a summary of changes since the last release and consult the CHANGES.txt file for complete a list of changes diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 64f02cb..43a7725 100755 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -5,7 +5,7 @@ Change Log -RELEASE VERSION/DATE TO BE FILLED IN LATER +RELEASE 3.0.4 - Mon, 20 Jan 2019 22:49:27 +0000 From Mats Wichmann: - Improve finding of Microsoft compiler: add a 'products' wildcard diff --git a/src/RELEASE.txt b/src/RELEASE.txt index c5b6203..f117758 100755 --- a/src/RELEASE.txt +++ b/src/RELEASE.txt @@ -1,4 +1,4 @@ - A new SCons checkpoint release, 3.0.4.alpha.yyyymmdd, is now available + A new SCons release, 3.0.4, is now available on the SCons download page: http://www.scons.org/download.php diff --git a/testing/framework/TestSCons.py b/testing/framework/TestSCons.py index b543c07..38ffd08 100644 --- a/testing/framework/TestSCons.py +++ b/testing/framework/TestSCons.py @@ -35,7 +35,7 @@ from TestCmd import PIPE # here provides some independent verification that what we packaged # conforms to what we expect. -default_version = '3.0.3' +default_version = '3.0.4' python_version_unsupported = (2, 6, 0) python_version_deprecated = (2, 7, 0) -- cgit v0.12 From 73b2c02d7088c6d6490fdede8396d88103b00482 Mon Sep 17 00:00:00 2001 From: William Deegan Date: Wed, 23 Jan 2019 17:43:22 +0000 Subject: Changes for 3.0.4 release --- README.rst | 2 +- bin/upload-release-files.sh | 2 +- doc/man/scons.xml | 4 ++-- doc/user/copyright.xml | 2 +- src/RELEASE.txt | 5 +++-- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/README.rst b/README.rst index 49b1556..17bbffa 100755 --- a/README.rst +++ b/README.rst @@ -765,5 +765,5 @@ many contributors, including but not at all limited to: \... and many others. -Copyright (c) 2001 - 2018 The SCons Foundation +Copyright (c) 2001 - 2019 The SCons Foundation diff --git a/bin/upload-release-files.sh b/bin/upload-release-files.sh index 4748db1..014134a 100755 --- a/bin/upload-release-files.sh +++ b/bin/upload-release-files.sh @@ -73,7 +73,7 @@ ssh scons@scons.org " cd .. rm latest; ln -s $VERSION latest rm production; ln -s $VERSION production - for f in HTML PDF EPUB PS TEXT; do rm \$f; ln -s $VERSION/\$f \$f; done + for f in HTML PDF EPUB PS TEXT; do rm -f \$f; ln -s $VERSION/\$f \$f; done " echo '*****' echo '***** Now manually update index.php, includes/versions.php and news-raw.xhtml on scons.org.' diff --git a/doc/man/scons.xml b/doc/man/scons.xml index 805164c..0f59967 100644 --- a/doc/man/scons.xml +++ b/doc/man/scons.xml @@ -54,10 +54,10 @@ Steven Knight and the SCons Development Team - 2004 - 2018 + 2004 - 2019 - 2004 - 2018 + 2004 - 2019 The SCons Foundation diff --git a/doc/user/copyright.xml b/doc/user/copyright.xml index 588253c..d36ff1e 100644 --- a/doc/user/copyright.xml +++ b/doc/user/copyright.xml @@ -35,7 +35,7 @@
- SCons User's Guide Copyright (c) 2004-2018 Steven Knight + SCons User's Guide Copyright (c) 2004-2019 Steven Knight
diff --git a/src/RELEASE.txt b/src/RELEASE.txt index f117758..97401cb 100755 --- a/src/RELEASE.txt +++ b/src/RELEASE.txt @@ -2,7 +2,8 @@ on the SCons download page: http://www.scons.org/download.php - + Or via pypi: + pip install scons Here is a summary of the changes since 3.0.3: @@ -23,4 +24,4 @@ git shortlog --no-merges -ns 3.0.3..HEAD 4 Daniel Moody 4 William Deegan 3 anatoly techtonik - 1 Tobias Herzog \ No newline at end of file + 1 Tobias Herzog -- cgit v0.12 From 32646d6a66884e501aaffdf92b7022a543403a0b Mon Sep 17 00:00:00 2001 From: William Deegan Date: Wed, 23 Jan 2019 17:45:40 +0000 Subject: restore to development mode --- ReleaseConfig | 2 +- src/Announce.txt | 2 +- src/CHANGES.txt | 7 +++++ src/RELEASE.txt | 78 ++++++++++++++++++++++++++++++++++++++++++++------------ 4 files changed, 71 insertions(+), 18 deletions(-) diff --git a/ReleaseConfig b/ReleaseConfig index 01440ba..32707c7 100755 --- a/ReleaseConfig +++ b/ReleaseConfig @@ -32,7 +32,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" # 'final', the patchlevel is set to the release date. This value is # mandatory and must be present in this file. #version_tuple = (2, 2, 0, 'final', 0) -version_tuple = (3, 0, 4) +version_tuple = (3, 0, 5, 'alpha', 0) # Python versions prior to unsupported_python_version cause a fatal error # when that version is used. Python versions prior to deprecate_python_version diff --git a/src/Announce.txt b/src/Announce.txt index 6558faa..7eb57ae 100755 --- a/src/Announce.txt +++ b/src/Announce.txt @@ -18,7 +18,7 @@ So that everyone using SCons can help each other learn how to use it more effectively, please go to http://scons.org/lists.html#users to sign up for the scons-users mailing list. -RELEASE 3.0.4 - Mon, 20 Jan 2019 22:49:27 +0000 +RELEASE VERSION/DATE TO BE FILLED IN LATER Please consult the RELEASE.txt file for a summary of changes since the last release and consult the CHANGES.txt file for complete a list of changes diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 43a7725..9c7e3b1 100755 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -5,6 +5,13 @@ Change Log +RELEASE VERSION/DATE TO BE FILLED IN LATER + + From John Doe: + + - Whatever John Doe did. + + RELEASE 3.0.4 - Mon, 20 Jan 2019 22:49:27 +0000 From Mats Wichmann: diff --git a/src/RELEASE.txt b/src/RELEASE.txt index 97401cb..28376a6 100755 --- a/src/RELEASE.txt +++ b/src/RELEASE.txt @@ -1,27 +1,73 @@ - A new SCons release, 3.0.4, is now available + A new SCons checkpoint release, 3.0.5.alpha.yyyymmdd, is now available on the SCons download page: - http://www.scons.org/download.php - Or via pypi: - pip install scons + https://scons.org/pages/download.html - Here is a summary of the changes since 3.0.3: + XXX The primary purpose of this release ... XXX + + A SCons "checkpoint release" is intended to provide early access to + new features so they can be tested in the field before being released + for adoption by other software distributions. + + Note that a checkpoint release is developed using the same test-driven + development methodology as all SCons releases. Existing SCons + functionality should all work as it does in previous releases (except + for any changes identified in the release notes) and early adopters + should be able to use a checkpoint release safely for production work + with existing SConscript files. If not, it represents not only a bug + in SCons but also a hole in the regression test suite, and we want to + hear about it. + + New features may be more lightly tested than in past releases, + especially as concerns their interaction with all of the other + functionality in SCons. We are especially interested in hearing bug + reports about new functionality. + + We do not recommend that downstream distributions (Debian, Fedora, + etc.) package a checkpoint release, mainly to avoid confusing the + "public" release numbering with the long checkpoint release names. + + Here is a summary of the changes since 1.3.0: NEW FUNCTIONALITY - - Added TEMPFILESUFFIX to allow user to specify suffix for tempfiles used for long command lines - - Initial support for ARM architectures with Microsoft Visual Studio 2017. You must set TARGET_ARCH - to arm or arm64 to enable. + - List new features (presumably why a checkpoint is being released) + + DEPRECATED FUNCTIONALITY + + - List anything that's been deprecated since the last release + + CHANGED/ENHANCED EXISTING FUNCTIONALITY + + - List modifications to existing features, where the previous behavior + wouldn't actually be considered a bug FIXES - - Fixed issue detecting installs of Microsoft Visual Studio 2017 as well as Microsoft build tools 2017. + - List fixes of outright bugs + + IMPROVEMENTS + + - List improvements that wouldn't be visible to the user in the + documentation: performance improvements (describe the circumstances + under which they would be observed), or major code cleanups + + PACKAGING + + - List changes in the way SCons is packaged and/or released + + DOCUMENTATION + + - List any significant changes to the documentation (not individual + typo fixes, even if they're mentioned in src/CHANGES.txt to give + the contributor credit) + + DEVELOPMENT + + - List visible changes in the way SCons is developed + Thanks to CURLY, LARRY, and MOE for their contributions to this release. + Contributors are listed alphabetically by their last name. -git shortlog --no-merges -ns 3.0.3..HEAD - 17 Daniel - 10 Mats Wichmann - 4 Daniel Moody - 4 William Deegan - 3 anatoly techtonik - 1 Tobias Herzog +__COPYRIGHT__ +__FILE__ __REVISION__ __DATE__ __DEVELOPER__ -- cgit v0.12 From c3c5c76704eb6847d270c154d672b402aa8a28b0 Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Fri, 25 Jan 2019 12:35:54 -0700 Subject: Quiet Py3 resource warnings Later Pythons (3.6+) enable warnings by default (needed a command line option before then), so some tools give off warnings now. This change quiets the warnings from the gcc, g++ and swig tools. Signed-off-by: Mats Wichmann --- src/CHANGES.txt | 4 ++++ src/engine/SCons/Tool/gcc.py | 38 +++++++++++++++++++++++--------------- src/engine/SCons/Tool/swig.py | 20 +++++++++++++++----- 3 files changed, 42 insertions(+), 20 deletions(-) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 9c7e3b1..94592f5 100755 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -11,6 +11,10 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER - Whatever John Doe did. + From Mats Wichmann: + - Quiet open file ResourceWarnings on Python >= 3.6 caused by + not using a context manager around Popen.stdout + RELEASE 3.0.4 - Mon, 20 Jan 2019 22:49:27 +0000 diff --git a/src/engine/SCons/Tool/gcc.py b/src/engine/SCons/Tool/gcc.py index fabcc96..79b64f0 100644 --- a/src/engine/SCons/Tool/gcc.py +++ b/src/engine/SCons/Tool/gcc.py @@ -68,32 +68,40 @@ def exists(env): def detect_version(env, cc): """Return the version of the GNU compiler, or None if it is not a GNU compiler.""" + version = None cc = env.subst(cc) if not cc: - return None - version = None + return version + + # -dumpversion was added in GCC 3.0. As long as we're supporting + # GCC versions older than that, we should use --version and a + # regular expression. # pipe = SCons.Action._subproc(env, SCons.Util.CLVar(cc) + ['-dumpversion'], pipe = SCons.Action._subproc(env, SCons.Util.CLVar(cc) + ['--version'], stdin='devnull', stderr='devnull', stdout=subprocess.PIPE) - # -dumpversion was added in GCC 3.0. As long as we're supporting - # GCC versions older than that, we should use --version and a - # regular expression. - # line = pipe.stdout.read().strip() + if pipe.wait() != 0: + return version + + with pipe.stdout: + # -dumpversion variant: + # line = pipe.stdout.read().strip() + # --version variant: + line = SCons.Util.to_str(pipe.stdout.readline()) + # Non-GNU compiler's output (like AIX xlc's) may exceed the stdout buffer: + # So continue with reading to let the child process actually terminate. + while SCons.Util.to_str(pipe.stdout.readline()): + pass + + # -dumpversion variant: # if line: - # version = line - line = SCons.Util.to_str(pipe.stdout.readline()) + # version = line + # --version variant: match = re.search(r'[0-9]+(\.[0-9]+)+', line) if match: version = match.group(0) - # Non-GNU compiler's output (like AIX xlc's) may exceed the stdout buffer: - # So continue with reading to let the child process actually terminate. - while SCons.Util.to_str(pipe.stdout.readline()): - pass - ret = pipe.wait() - if ret != 0: - return None + return version # Local Variables: diff --git a/src/engine/SCons/Tool/swig.py b/src/engine/SCons/Tool/swig.py index 08881a0..77cfe1d 100644 --- a/src/engine/SCons/Tool/swig.py +++ b/src/engine/SCons/Tool/swig.py @@ -135,21 +135,31 @@ def _swigEmitter(target, source, env): def _get_swig_version(env, swig): """Run the SWIG command line tool to get and return the version number""" + version = None swig = env.subst(swig) + if not swig: + return version pipe = SCons.Action._subproc(env, SCons.Util.CLVar(swig) + ['-version'], stdin = 'devnull', stderr = 'devnull', stdout = subprocess.PIPE) - if pipe.wait() != 0: return + if pipe.wait() != 0: + return version # MAYBE: out = SCons.Util.to_str (pipe.stdout.read()) - out = SCons.Util.to_str(pipe.stdout.read()) + with pipe.stdout: + out = SCons.Util.to_str(pipe.stdout.read()) + match = re.search('SWIG Version\s+(\S+).*', out, re.MULTILINE) if match: - if verbose: print("Version is:%s"%match.group(1)) - return match.group(1) + version = match.group(1) + if verbose: + print("Version is: %s" % version) else: - if verbose: print("Unable to detect version: [%s]"%out) + if verbose: + print("Unable to detect version: [%s]" % out) + + return version def generate(env): """Add Builders and construction variables for swig to an Environment.""" -- cgit v0.12 From b9e1d971c152a52663c3c87767848a9d716b7c2c Mon Sep 17 00:00:00 2001 From: Daniel Date: Sun, 27 Jan 2019 20:44:50 -0600 Subject: change default for AppendENVPath to not move existing paths --- src/engine/SCons/Environment.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/engine/SCons/Environment.py b/src/engine/SCons/Environment.py index 81d0e5a..152f0bc 100644 --- a/src/engine/SCons/Environment.py +++ b/src/engine/SCons/Environment.py @@ -1217,7 +1217,7 @@ class Base(SubstitutionEnvironment): return path def AppendENVPath(self, name, newpath, envname = 'ENV', - sep = os.pathsep, delete_existing=1): + sep = os.pathsep, delete_existing=0): """Append path elements to the path 'name' in the 'ENV' dictionary for this environment. Will only add any particular path once, and will normpath and normcase all paths to help -- cgit v0.12 From 8666b9e990a85fad8ef5c4d29f7d902947097db3 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sun, 27 Jan 2019 20:46:58 -0600 Subject: updated CHANGES.txt --- src/CHANGES.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 94592f5..b563593 100755 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -11,6 +11,10 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER - Whatever John Doe did. + From Daniel Moody: + - Change the default for AppendENVPath to delete_existing=0, so path + order will not be changed, unless explicitly set (Issue #3276) + From Mats Wichmann: - Quiet open file ResourceWarnings on Python >= 3.6 caused by not using a context manager around Popen.stdout -- cgit v0.12 From 9d1a17770b781abe287e1ff276e80c2958a5b4f6 Mon Sep 17 00:00:00 2001 From: Daniel Moody Date: Mon, 28 Jan 2019 17:09:06 -0600 Subject: remove user base install, add no progess for reliablity, set test envs to original plus 2.7 on 2015, add irc notification for codecov --- .appveyor.yml | 49 +++++++++++++++++-------------------------------- .codecov.yml | 10 ++++++++++ 2 files changed, 27 insertions(+), 32 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index d80bdb4..b8f0913 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -17,12 +17,11 @@ install: ### WINDOWS ### # add python and python user-base to path for pip installs - cmd: "C:\\%WINPYTHON%\\python.exe --version" - - cmd: for /F "tokens=*" %%g in ('C:\\%WINPYTHON%\\python.exe -m site --user-base') do (set PYUSERBASESITE=%%g) - cmd: for /F "tokens=*" %%g in ('C:\\%WINPYTHON%\\python.exe -m site --user-site') do (set PYSITEDIR=%%g) - - cmd: "set PATH=%PYUSERBASESITE%;%PYUSERBASESITE%\\%WINPYTHON%\\Scripts;%PYUSERBASESITE%\\Scripts;C:\\%WINPYTHON%;C:\\%WINPYTHON%\\Scripts;C:\\cygwin64\\bin;C:\\msys64;C:\\ProgramData\\chocolatey\\bin;%PATH%" - - cmd: "C:\\%WINPYTHON%\\python.exe -m pip install --user -U pip setuptools wheel" - - cmd: "C:\\%WINPYTHON%\\python.exe -m pip install --user -U pypiwin32 coverage codecov" - - cmd: set STATIC_DEPS=true & C:\\%WINPYTHON%\\python.exe -m pip install --user -U lxml + - cmd: "set PATH=C:\\%WINPYTHON%;C:\\%WINPYTHON%\\Scripts;C:\\cygwin64\\bin;C:\\msys64;C:\\ProgramData\\chocolatey\\bin;%PATH%" + - cmd: "C:\\%WINPYTHON%\\python.exe -m pip install -U --progress-bar off pip setuptools wheel " + - cmd: "C:\\%WINPYTHON%\\python.exe -m pip install -U --progress-bar off pypiwin32 coverage codecov" + - cmd: set STATIC_DEPS=true & C:\\%WINPYTHON%\\python.exe -m pip install -U --progress-bar off lxml # install 3rd party tools to test with - cmd: choco install --allow-empty-checksums dmd ldc swig vswhere xsltproc - cmd: set @@ -37,13 +36,10 @@ install: - sh: which python$PYTHON - sh: python$PYTHON --version - sh: export PYSITEDIR=$(python$PYTHON -m site --user-site) - - sh: python$PYTHON -m pip install --user -U pip setuptools wheel - - sh: python$PYTHON -m pip install --user -U coverage codecov - - sh: STATIC_DEPS=true python$PYTHON -m pip install --user -U lxml || true + - sh: python$PYTHON -m pip install --user -U --progress-bar off pip setuptools wheel + - sh: python$PYTHON -m pip install --user -U --progress-bar off coverage codecov + - sh: STATIC_DEPS=true python$PYTHON -m pip install --user -U --progress-bar off lxml - sh: ./.travis/install.sh - # workaround for https://github.com/codecov/codecov-python/pull/188 - - sh: export CI=True - - sh: export APPVEYOR=True - sh: printenv @@ -95,62 +91,52 @@ environment: PYTHON: "3.5" PYVER: 35 BUILD_JOB_NUM: 1 + COVERAGE: 0 - WINPYTHON: "Python35" PYTHON: "3.5" PYVER: 35 BUILD_JOB_NUM: 2 + COVERAGE: 0 - WINPYTHON: "Python35" PYTHON: "3.5" PYVER: 35 BUILD_JOB_NUM: 3 + COVERAGE: 0 - WINPYTHON: "Python35" PYTHON: "3.5" PYVER: 35 BUILD_JOB_NUM: 4 - - WINPYTHON: "Python35" - PYTHON: "3.5" - PYVER: 35 - BUILD_JOB_NUM: 1 + COVERAGE: 0 - WINPYTHON: "Python37" PYTHON: "3.7" PYVER: 37 BUILD_JOB_NUM: 1 - COVERAGE: 1 + COVERAGE: 0 - WINPYTHON: "Python37" PYTHON: "3.7" PYVER: 37 BUILD_JOB_NUM: 2 - COVERAGE: 1 + COVERAGE: 0 - WINPYTHON: "Python37" PYTHON: "3.7" PYVER: 37 BUILD_JOB_NUM: 3 - COVERAGE: 1 + COVERAGE: 0 - WINPYTHON: "Python37" PYTHON: "3.7" PYVER: 37 BUILD_JOB_NUM: 4 - COVERAGE: 1 + COVERAGE: 0 matrix: exclude: - # test python 2.7 on Visual Studio 2015 image - - image: Visual Studio 2015 - WINPYTHON: "Python37" + # test python 3.6 on Visual Studio 2015 image - image: Visual Studio 2015 - WINPYTHON: "Python36" + WINPYTHON: "Python37" - image: Visual Studio 2015 WINPYTHON: "Python35" - # test python 3.6 on Visual Studio 2017 image - - image: Visual Studio 2017 - WINPYTHON: "Python27" - - image: Visual Studio 2017 - WINPYTHON: "Python35" - - image: Visual Studio 2017 - WINPYTHON: "Python37" - # test python 3.7 on Ubuntu - image: Ubuntu WINPYTHON: "Python27" @@ -159,7 +145,6 @@ matrix: - image: Ubuntu WINPYTHON: "Python36" - before_build: - ps: | if ($isWindows) diff --git a/.codecov.yml b/.codecov.yml index 9ea78f5..375b10f 100644 --- a/.codecov.yml +++ b/.codecov.yml @@ -16,6 +16,16 @@ coverage: round: down range: "70...100" + notify: + irc: + default: + server: "chat.freenode.net#scons" + branches: master + threshold: null + message: "Coverage {{changed}} for {{owner}}/{{repo}}" # customize the message + flags: null + paths: null + status: project: default: -- cgit v0.12 From 53d22ee6ca4e9c78dc316fc144c8a0452ca677f1 Mon Sep 17 00:00:00 2001 From: Daniel Moody Date: Tue, 29 Jan 2019 16:07:20 -0600 Subject: switch coverage around to get actual build failures --- .travis.yml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index fb48776..3ab601a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,10 +14,17 @@ os: install: - ./.travis/install.sh -# pypy is not passing, but allow failures for coverage stage to be reached +# pypy is not passing atm, but still report build success for now +# allow coverage to fail, so we can still do testing for all platforms matrix: allow_failures: - - stage: Test + - python: pypy + - stage: Coverage + +# run coverage first as its still useful to collect +stages: + - Coverage + - Test jobs: include: -- cgit v0.12 From dd1fe67dbfb929a96c39248c65c97070d9962766 Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 29 Jan 2019 22:09:30 -0600 Subject: update EnvironmentTest to work with new default --- src/engine/SCons/EnvironmentTests.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/engine/SCons/EnvironmentTests.py b/src/engine/SCons/EnvironmentTests.py index 7cd6015..a72c173 100644 --- a/src/engine/SCons/EnvironmentTests.py +++ b/src/engine/SCons/EnvironmentTests.py @@ -1623,9 +1623,9 @@ def exists(env): env1.AppendENVPath('PATH',r'C:\dir\num\two', sep = ';') env1.AppendENVPath('PATH',r'C:\dir\num\three', sep = ';') env1.AppendENVPath('MYPATH',r'C:\mydir\num\three','MYENV', sep = ';') - env1.AppendENVPath('MYPATH',r'C:\mydir\num\one','MYENV', sep = ';') + env1.AppendENVPath('MYPATH',r'C:\mydir\num\one','MYENV', sep = ';', delete_existing=1) # this should do nothing since delete_existing is 0 - env1.AppendENVPath('MYPATH',r'C:\mydir\num\three','MYENV', sep = ';', delete_existing=0) + env1.AppendENVPath('MYPATH',r'C:\mydir\num\three','MYENV', sep = ';') assert(env1['ENV']['PATH'] == r'C:\dir\num\one;C:\dir\num\two;C:\dir\num\three') assert(env1['MYENV']['MYPATH'] == r'C:\mydir\num\two;C:\mydir\num\three;C:\mydir\num\one') -- cgit v0.12 From b68e505d30e5b2f4ed366e6db10cdd14f14b8a80 Mon Sep 17 00:00:00 2001 From: Daniel Date: Wed, 30 Jan 2019 12:32:18 -0600 Subject: check to make sure that the CCFLAGS are a CLVar --- src/engine/SCons/Tool/mingw.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/engine/SCons/Tool/mingw.py b/src/engine/SCons/Tool/mingw.py index c495041..ce31f88 100644 --- a/src/engine/SCons/Tool/mingw.py +++ b/src/engine/SCons/Tool/mingw.py @@ -150,6 +150,12 @@ def generate(env): #... but a few things differ: env['CC'] = 'gcc' + # make sure the msvc tool doesnt break us, it added a /flag + if 'CCFLAGS' in env: + # make sure its a CLVar to handle list or str cases + if type(env['CCFLAGS']) is not SCons.Util.CLVar: + env['CCFLAGS'] = SCons.Util.CLVar(env['CCFLAGS']) + env['CCFLAGS'] = SCons.Util.CLVar(str(env['CCFLAGS']).replace('/nologo', '')) env['SHCCFLAGS'] = SCons.Util.CLVar('$CCFLAGS') env['CXX'] = 'g++' env['SHCXXFLAGS'] = SCons.Util.CLVar('$CXXFLAGS') @@ -167,8 +173,6 @@ def generate(env): env['SHOBJSUFFIX'] = '.o' env['STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME'] = 1 - if 'CCFLAGS' in env: - env['CCFLAGS'] = SCons.Util.CLVar(str(env['CCFLAGS']).replace('/nologo', '')) env['RC'] = 'windres' env['RCFLAGS'] = SCons.Util.CLVar('') env['RCINCFLAGS'] = '$( ${_concat(RCINCPREFIX, CPPPATH, RCINCSUFFIX, __env__, RDirs, TARGET, SOURCE)} $)' -- cgit v0.12 From f4c1d1a8c06f5d259f3e05d525e5357d28d2bf75 Mon Sep 17 00:00:00 2001 From: Daniel Moody Date: Thu, 31 Jan 2019 09:58:47 -0600 Subject: limited the platforms tested and improved comments --- .appveyor.yml | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index b8f0913..466c72d 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -5,8 +5,7 @@ image: # - Ubuntu - Visual Studio 2015 - Visual Studio 2017 - - + cache: - downloads -> appveyor.yml - '%LOCALAPPDATA%\pip\Cache' @@ -42,7 +41,9 @@ install: - sh: ./.travis/install.sh - sh: printenv - +# build matrix will be number of images multiplied +# by each '-' below, split jobs into groups of 4 +# to avoid timeing out environment: matrix: - WINPYTHON: "Python27" @@ -129,13 +130,21 @@ environment: BUILD_JOB_NUM: 4 COVERAGE: 0 +# remove sets of build jobs based on critia below +# to fine tune the number and platforms tested matrix: exclude: - # test python 3.6 on Visual Studio 2015 image + # test python 3.5, 3.6 on Visual Studio 2015 image - image: Visual Studio 2015 WINPYTHON: "Python37" - image: Visual Studio 2015 + WINPYTHON: "Python27" + + # test python 2.7, 3.7 on Visual Studio 2015 image + - image: Visual Studio 2017 WINPYTHON: "Python35" + - image: Visual Studio 2017 + WINPYTHON: "Python36" # test python 3.7 on Ubuntu - image: Ubuntu @@ -145,6 +154,7 @@ matrix: - image: Ubuntu WINPYTHON: "Python36" +# remove some binaries we dont to be found before_build: - ps: | if ($isWindows) @@ -159,11 +169,12 @@ before_build: build: off build_script: - # get tests all tests + # get all tests into a list - cmd: "C:\\%WINPYTHON%\\python.exe runtest.py -l -a > all_tests.txt" - sh: python$PYTHON runtest.py -l -a > all_tests.txt - # setup coverage is set in environment + # setup coverage by creating the coverage config file, and adding coverage + # to the usercustomize so that all python processes start with coverage - ps: | if ($env:COVERAGE -eq 1){ $env:COVERAGE_PROCESS_START = "$($env:APPVEYOR_BUILD_FOLDER)/.coveragerc"; @@ -182,6 +193,7 @@ build_script: } $coveragercFile|Set-Content "$($env:COVERAGE_PROCESS_START)"; } + # setup portion of tests for this build job (1-4) - ps: | $TOTAL_BUILD_JOBS = 4; @@ -201,10 +213,12 @@ build_script: Add-Content -Path 'exclude_list.txt' -Value 'test\MSVS\vs-10.0-exec.py' } + # Windows run the tests # NOTE: running powershell from cmd on purpose because it formats the output # correctly - cmd: powershell -Command "& { if($env:COVERAGE -eq 1) { coverage run -p --rcfile=$($env:COVERAGE_PROCESS_START) runtest.py --exclude-list exclude_list.txt -f build_tests.txt } else { C:\\%WINPYTHON%\\python.exe runtest.py -j 2 --exclude-list exclude_list.txt -f build_tests.txt }; if($LastExitCode -eq 2 -Or $LastExitCode -eq 0) { $host.SetShouldExit(0 )} else {$host.SetShouldExit(1)}}" + # linux run the tests # unset JAVA_TOOL_OPTIONS because newer java prints this to stderr - sh: | unset JAVA_TOOL_OPTIONS @@ -214,7 +228,7 @@ build_script: python$PYTHON runtest.py -j 2 --exclude-list exclude_list.txt -f build_tests.txt || if [[ $? == 2 ]]; then true; else false; fi; fi - # run converage +# run converage even if there was a test failure on_finish: - ps: | if ($env:COVERAGE -eq 1) @@ -223,7 +237,7 @@ on_finish: & coverage report & coverage xml -o coverage_xml.xml } - # running in powershell causes an error so running in platform + # running codecov in powershell causes an error so running in platform # shells - cmd: if %COVERAGE% equ 1 codecov -X gcov --file coverage_xml.xml - sh: if [ $COVERAGE -eq 1 ]; then codecov -X gcov --file coverage_xml.xml; fi -- cgit v0.12 From 15d275627e2a6ee154396e2768cb77aa82a7dd04 Mon Sep 17 00:00:00 2001 From: William Deegan Date: Wed, 30 Jan 2019 13:32:38 -0800 Subject: Add test to check for configure calling configured decider not handling DeciderNeedsNode exception which can be thrown by MD5-Timestamp decider logic --- test/Configure/option--config.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/test/Configure/option--config.py b/test/Configure/option--config.py index 1f40a80..09430d2 100644 --- a/test/Configure/option--config.py +++ b/test/Configure/option--config.py @@ -122,6 +122,25 @@ test.checkLogAndStdout( ["Checking for C header file non_system_header0.h... ", [((".c", CR), (_obj, NCR))]], "config.log", ".sconf_temp", "SConstruct") + +# Check the combination of --config=force and Decider('MD5-timestamp') +# On second run there was an issue where the decider would throw DeciderNeedsNode +# exception which the configure code didn't handle. +SConstruct_path = test.workpath('SConstruct') +test.write(SConstruct_path, """ +env = Environment() +env.Decider('MD5-timestamp') +conf = Configure(env) +conf.TryLink('int main(){return 0;}','.c') +env = conf.Finish() +""") +test.run(arguments='--config=force') +# On second run the sconsign is loaded and decider doesn't just indicate need to rebuild +test.run(arguments='--config=force') +test.must_not_contain(test.workpath('config.log'),"TypeError: 'NoneType' object is not callable") + + + test.pass_test() # Local Variables: -- cgit v0.12 From 48a7fddf3f2cbd628cc2270926268a64a1501222 Mon Sep 17 00:00:00 2001 From: William Deegan Date: Wed, 30 Jan 2019 13:33:19 -0800 Subject: handle exceptions slightly better --- src/engine/SCons/Job.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/engine/SCons/Job.py b/src/engine/SCons/Job.py index c0e80b1..3720ca2 100644 --- a/src/engine/SCons/Job.py +++ b/src/engine/SCons/Job.py @@ -199,7 +199,7 @@ class Serial(object): task.prepare() if task.needs_execute(): task.execute() - except: + except Exception as e: if self.interrupted(): try: raise SCons.Errors.BuildError( -- cgit v0.12 From 533bef13e179053fe56a1e5e504aa080f353ed3d Mon Sep 17 00:00:00 2001 From: William Deegan Date: Wed, 30 Jan 2019 13:33:58 -0800 Subject: Fix configure logic calling configured decider not handling DeciderNeedsNode exception which can be thrown by MD5-Timestamp decider logic --- src/engine/SCons/SConf.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/engine/SCons/SConf.py b/src/engine/SCons/SConf.py index 0dcbab8..f23c401 100644 --- a/src/engine/SCons/SConf.py +++ b/src/engine/SCons/SConf.py @@ -56,6 +56,7 @@ import SCons.Warnings import SCons.Conftest from SCons.Debug import Trace +from SCons.Node import DeciderNeedsNode # Turn off the Conftest error logging SCons.Conftest.LogInputFiles = 0 @@ -330,8 +331,14 @@ class SConfBuildTask(SCons.Taskmaster.AlwaysTask): # that the correct .sconsign info will get calculated # and keep the build state consistent. def force_build(dependency, target, prev_ni, - env_decider=env.decide_source): - env_decider(dependency, target, prev_ni) + env_decider=env.decide_source, + node=None): + try: + env_decider(dependency, target, prev_ni) + except DeciderNeedsNode as e: + e.decider(target, prev_ni, node=target) + except Exception as e: + raise e return True if env.decide_source.__code__ is not force_build.__code__: env.Decider(force_build) -- cgit v0.12 From bd2441310379b8009f1ebdc723ff23bb75cc3eb5 Mon Sep 17 00:00:00 2001 From: William Deegan Date: Wed, 30 Jan 2019 14:07:55 -0800 Subject: Update src/CHANGES.txt fix issue #3283 --- src/CHANGES.txt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index b563593..c6d7191 100755 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -7,9 +7,13 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER - From John Doe: + From William Deegan: - - Whatever John Doe did. + - Fix Issue #3283 - Handle using --config=force in combination with Decider('MD5-timestamp'). + 3.0.2 in fix for issue #2980 added that deciders can throw DeciderNeedsNode exception. + The Configure logic directly calls the decider when using --config=force but wasn't handling + that exception. This would yield minimally configure tests using TryLink() not running and + leaving TypeError Nonetype exception in config.log From Daniel Moody: - Change the default for AppendENVPath to delete_existing=0, so path -- cgit v0.12 From 2860462520f2e0ea0c5ccd5090fbefaef47e66e8 Mon Sep 17 00:00:00 2001 From: William Deegan Date: Fri, 1 Feb 2019 17:59:28 -0500 Subject: Fix new test binary/text read issue for py3.5+. Changed mode to 'r' as just plain part of a line --- test/Configure/option--config.py | 81 +++++++++++++++++++--------------------- 1 file changed, 39 insertions(+), 42 deletions(-) diff --git a/test/Configure/option--config.py b/test/Configure/option--config.py index 09430d2..80a8bcd 100644 --- a/test/Configure/option--config.py +++ b/test/Configure/option--config.py @@ -39,9 +39,9 @@ test = TestSCons.TestSCons() test.subdir('include') NCR = test.NCR # non-cached rebuild -CR = test.CR # cached rebuild (up to date) +CR = test.CR # cached rebuild (up to date) NCF = test.NCF # non-cached build failure -CF = test.CF # cached build failure +CF = test.CF # cached build failure SConstruct_path = test.workpath('SConstruct') @@ -70,36 +70,36 @@ scons: *** "%(conftest_0_c)s" is not yet built and cache is forced. test.run(arguments='--config=cache', status=2, stderr=expect) test.run(arguments='--config=auto') -test.checkLogAndStdout( ["Checking for C header file non_system_header0.h... ", - "Checking for C header file non_system_header1.h... "], - ["yes", "no"], - [[((".c", NCR), (_obj, NCR))], - [((".c", NCR), (_obj, NCF))]], - "config.log", ".sconf_temp", "SConstruct") +test.checkLogAndStdout(["Checking for C header file non_system_header0.h... ", + "Checking for C header file non_system_header1.h... "], + ["yes", "no"], + [[((".c", NCR), (_obj, NCR))], + [((".c", NCR), (_obj, NCF))]], + "config.log", ".sconf_temp", "SConstruct") test.run(arguments='--config=auto') -test.checkLogAndStdout( ["Checking for C header file non_system_header0.h... ", - "Checking for C header file non_system_header1.h... "], - ["yes", "no"], - [[((".c", CR), (_obj, CR))], - [((".c", CR), (_obj, CF))]], - "config.log", ".sconf_temp", "SConstruct") +test.checkLogAndStdout(["Checking for C header file non_system_header0.h... ", + "Checking for C header file non_system_header1.h... "], + ["yes", "no"], + [[((".c", CR), (_obj, CR))], + [((".c", CR), (_obj, CF))]], + "config.log", ".sconf_temp", "SConstruct") test.run(arguments='--config=force') -test.checkLogAndStdout( ["Checking for C header file non_system_header0.h... ", - "Checking for C header file non_system_header1.h... "], - ["yes", "no"], - [[((".c", NCR), (_obj, NCR))], - [((".c", NCR), (_obj, NCF))]], - "config.log", ".sconf_temp", "SConstruct") +test.checkLogAndStdout(["Checking for C header file non_system_header0.h... ", + "Checking for C header file non_system_header1.h... "], + ["yes", "no"], + [[((".c", NCR), (_obj, NCR))], + [((".c", NCR), (_obj, NCF))]], + "config.log", ".sconf_temp", "SConstruct") test.run(arguments='--config=cache') -test.checkLogAndStdout( ["Checking for C header file non_system_header0.h... ", - "Checking for C header file non_system_header1.h... "], - ["yes", "no"], - [[((".c", CR), (_obj, CR))], - [((".c", CR), (_obj, CF))]], - "config.log", ".sconf_temp", "SConstruct") +test.checkLogAndStdout(["Checking for C header file non_system_header0.h... ", + "Checking for C header file non_system_header1.h... "], + ["yes", "no"], + [[((".c", CR), (_obj, CR))], + [((".c", CR), (_obj, CF))]], + "config.log", ".sconf_temp", "SConstruct") test.write(['include', 'non_system_header1.h'], """ /* Another header */ @@ -107,21 +107,20 @@ test.write(['include', 'non_system_header1.h'], """ test.unlink(['include', 'non_system_header0.h']) test.run(arguments='--config=cache') -test.checkLogAndStdout( ["Checking for C header file non_system_header0.h... ", - "Checking for C header file non_system_header1.h... "], - ["yes", "no"], - [[((".c", CR), (_obj, CR))], - [((".c", CR), (_obj, CF))]], - "config.log", ".sconf_temp", "SConstruct") +test.checkLogAndStdout(["Checking for C header file non_system_header0.h... ", + "Checking for C header file non_system_header1.h... "], + ["yes", "no"], + [[((".c", CR), (_obj, CR))], + [((".c", CR), (_obj, CF))]], + "config.log", ".sconf_temp", "SConstruct") test.run(arguments='--config=auto') -test.checkLogAndStdout( ["Checking for C header file non_system_header0.h... ", - "Checking for C header file non_system_header1.h... "], - ["no", "yes"], - [[((".c", CR), (_obj, NCF))], - [((".c", CR), (_obj, NCR))]], - "config.log", ".sconf_temp", "SConstruct") - +test.checkLogAndStdout(["Checking for C header file non_system_header0.h... ", + "Checking for C header file non_system_header1.h... "], + ["no", "yes"], + [[((".c", CR), (_obj, NCF))], + [((".c", CR), (_obj, NCR))]], + "config.log", ".sconf_temp", "SConstruct") # Check the combination of --config=force and Decider('MD5-timestamp') # On second run there was an issue where the decider would throw DeciderNeedsNode @@ -137,9 +136,7 @@ env = conf.Finish() test.run(arguments='--config=force') # On second run the sconsign is loaded and decider doesn't just indicate need to rebuild test.run(arguments='--config=force') -test.must_not_contain(test.workpath('config.log'),"TypeError: 'NoneType' object is not callable") - - +test.must_not_contain(test.workpath('config.log'), "TypeError: 'NoneType' object is not callable", mode='r') test.pass_test() -- cgit v0.12 From dc4b8ba81d9077c86aea6fce4cd0814111339037 Mon Sep 17 00:00:00 2001 From: Daniel Moody Date: Mon, 4 Feb 2019 12:04:27 -0600 Subject: update m4 test to use mingw on windows and not pass if m4 doesn't exist --- test/M4/M4.py | 38 ++++++++++++-------------------------- 1 file changed, 12 insertions(+), 26 deletions(-) diff --git a/test/M4/M4.py b/test/M4/M4.py index 82c084c..1f5c679 100644 --- a/test/M4/M4.py +++ b/test/M4/M4.py @@ -36,8 +36,6 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() - - test.write('mym4.py', """ import sys contents = sys.stdin.read() @@ -60,23 +58,16 @@ line 3 test.run() -import sys - -if sys.platform == 'win32': - # Handle carriage returns. - test.must_match(test.workpath('aaa.x'), "line 1\r\nmym4.py\r\nline 3\r\n") -else: - test.must_match(test.workpath('aaa.x'), "line 1\nmym4.py\nline 3\n") - - +test.must_match(test.workpath('aaa.x'), os.linesep.join(["line 1", "mym4.py", "line 3", ""])) m4 = test.where_is('m4') -if m4: +if not m4: + test.skip_test('M4 not found found; skipping test.\n') - test.file_fixture('wrapper.py') +test.file_fixture('wrapper.py') - test.write('SConstruct', """ +test.write('SConstruct', """ DefaultEnvironment(tools=[]) foo = Environment(tools=['m4'], M4=r'%(m4)s', M4FLAGS='-DFFF=fff') @@ -87,23 +78,18 @@ foo.M4(target = 'foo.x', source = 'foo.x.m4') bar.M4(target = 'bar', source = 'bar.m4') """ % locals()) - test.write('foo.x.m4', "line 1\n" - "FFF\n" - "line 3\n") - - test.write('bar.m4', "line 1\n" - "BBB\n" - "line 3\n") +test.write('foo.x.m4', os.linesep.join(["line 1", "FFF", "line 3"])) - test.run(arguments = '.') +test.write('bar.m4', os.linesep.join(["line 1", "BBB", "line 3"])) - test.up_to_date(arguments = '.') +test.run(arguments = '.') +test.up_to_date(arguments = '.') - test.must_match('wrapper.out', "wrapper.py\n") +test.must_match('wrapper.out', "wrapper.py\n") - test.must_match('foo.x', "line 1\nfff\nline 3\n") +test.must_match('foo.x', os.linesep.join(["line 1", "fff", "line 3"])) - test.must_match('bar', "line 1\nbbb\nline 3\n") +test.must_match('bar', os.linesep.join(["line 1", "bbb", "line 3"])) test.pass_test() -- cgit v0.12 From aabd8be12936101ee73e328964e8e00ddfd153d2 Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Mon, 4 Feb 2019 16:59:41 -0700 Subject: Pretty-print msvs.xml Doc file had large sections in not very readable format, with lots of tags on single line, etc. Ran through a formatting tool and did some manual fixups. Signed-off-by: Mats Wichmann --- src/engine/SCons/Tool/msvs.xml | 963 ++++++++++++++++++++++++----------------- 1 file changed, 563 insertions(+), 400 deletions(-) diff --git a/src/engine/SCons/Tool/msvs.xml b/src/engine/SCons/Tool/msvs.xml index c4701e1..2292522 100644 --- a/src/engine/SCons/Tool/msvs.xml +++ b/src/engine/SCons/Tool/msvs.xml @@ -17,160 +17,212 @@ See its __doc__ string for a discussion of the format. %variables-mod; ]> - -Sets construction variables for Microsoft Visual Studio. - MSVSPROJECTCOM MSVSSOLUTIONCOM -MSVSSCONSCRIPT MSVSSCONS MSVSSCONSFLAGS -MSVSSCONSCOM MSVSBUILDCOM -MSVSREBUILDCOM MSVSCLEANCOM -MSVSENCODING Builds a Microsoft Visual Studio project -file, and by default builds a solution file as well. This -builds a Visual Studio project file, based on the version of Visual Studio -that is configured (either the latest installed version, or the version -specified by &cv-link-MSVS_VERSION; in the Environment constructor). For -Visual Studio 6, it will generate a .dsp file. For Visual -Studio 7 (.NET) and later versions, it will generate a -.vcproj file. By default, this also -generates a solution file for the specified project, a -.dsw file for Visual Studio 6 or a -.sln file for Visual Studio 7 (.NET). This behavior may -be disabled by specifying auto_build_solution=0 when you -call &b-MSVSProject;, in which case you presumably want to build the solution -file(s) by calling the &b-MSVSSolution; Builder (see below). -The &b-MSVSProject; builder takes several lists of filenames to be placed into -the project file. These are currently limited to srcs, -incs, localincs, -resources, and misc. These are pretty -self-explanatory, but it should be noted that these lists are added to the -&cv-link-SOURCES; construction variable as strings, NOT as SCons File Nodes. -This is because they represent file names to be added to the project file, not -the source files used to build the project file. The above -filename lists are all optional, although at least one must be specified for -the resulting project file to be non-empty. In addition to the -above lists of values, the following values may be specified: - - - target - - - The name of the target .dsp or - .vcproj file. The correct suffix for the version - of Visual Studio must be used, but the &cv-link-MSVSPROJECTSUFFIX; - construction variable will be defined to the correct value (see - example below). - - - - - variant - - - The name of this particular variant. For Visual Studio 7 - projects, this can also be a list of variant names. These are - typically things like "Debug" or "Release", but really can be anything - you want. For Visual Studio 7 projects, they may also specify a target - platform separated from the variant name by a | - (vertical pipe) character: Debug|Xbox. The default - target platform is Win32. Multiple calls to &b-MSVSProject; with - different variants are allowed; all variants will be added to the - project file with their appropriate build targets and - sources. - - - - - cmdargs - - - Additional command line arguments for the different - variants. The number of cmdargs entries must match - the number of variant entries, or be empty (not - specified). If you give only one, it will automatically be propagated - to all variants. - - - - - buildtarget - - - An optional string, node, or list of strings or nodes (one - per build variant), to tell the Visual Studio debugger what output - target to use in what build variant. The number of - buildtarget entries must match the number of - variant entries. - - - - - runfile - - - The name of the file that Visual Studio 7 and later will - run and debug. This appears as the value of the - Output field in the resulting Visual Studio project - file. If this is not specified, the default is the same as the - specified buildtarget value. - - - Note that because &SCons; always executes its build -commands from the directory in which the &SConstruct; file is located, if you -generate a project file in a different directory than the &SConstruct; -directory, users will not be able to double-click on the file name in -compilation error messages displayed in the Visual Studio console output -window. This can be remedied by adding the Visual C/C++ /FC -compiler option to the &cv-link-CCFLAGS; variable so that the compiler will -print the full path name of any files that cause compilation errors. - Example usage: - + + + + Sets construction variables for Microsoft Visual Studio. + + + MSVSPROJECTCOM + MSVSSOLUTIONCOM + MSVSSCONSCRIPT + MSVSSCONS + MSVSSCONSFLAGS + MSVSSCONSCOM + MSVSBUILDCOM + MSVSREBUILDCOM + MSVSCLEANCOM + MSVSENCODING + + + + + + + Builds a Microsoft Visual Studio project file, and by default + builds a solution file as well. + + + This builds a Visual Studio project file, based on the + version of Visual Studio that is configured (either the + latest installed version, or the version specified by + &cv-link-MSVS_VERSION; in the Environment constructor). For + Visual Studio 6, it will generate a .dsp + file. For Visual Studio 7 (.NET) and later versions, it will + generate a .vcproj file. + + + By default, this also generates a solution file for the + specified project, a .dsw file for + Visual Studio 6 or a .sln file for + Visual Studio 7 (.NET). This behavior may be disabled by + specifying auto_build_solution=0 when you + call &b-MSVSProject;, in which case you presumably want to + build the solution file(s) by calling the &b-MSVSSolution; + Builder (see below). + + + The &b-MSVSProject; builder takes several lists of filenames + to be placed into the project file. These are currently + limited to srcs, incs, + localincs, resources, and + misc. These are pretty self-explanatory, + but it should be noted that these lists are added to the + &cv-link-SOURCES; construction variable as strings, NOT as + SCons File Nodes. This is because they represent file names + to be added to the project file, not the source files used + to build the project file. + + + The above filename lists are all optional, although at least + one must be specified for the resulting project file to + be non-empty. + + + In addition to the above lists of values, the following values + may be specified: + + + + target + + + The name of the target .dsp + or .vcproj file. + The correct suffix for the version of Visual Studio + must be used, but the &cv-link-MSVSPROJECTSUFFIX; + construction variable will be defined to the correct + value (see example below). + + + + + variant + + + The name of this particular variant. For Visual Studio 7 + projects, this can also be a list of variant names. These + are typically things like "Debug" or "Release", but + really can be anything you want. For Visual Studio + 7 projects, they may also specify a target platform + separated from the variant name by a | + (vertical pipe) character: Debug|Xbox. + The default target platform is Win32. Multiple calls + to &b-MSVSProject; with different variants are allowed; + all variants will be added to the project file with + their appropriate build targets and sources. + + + + + cmdargs + + + Additional command line arguments + for the different variants. The number of + cmdargs entries must match the number + of variant entries, or be empty (not + specified). If you give only one, it will automatically + be propagated to all variants. + + + + + buildtarget + + + An optional string, node, or list of strings + or nodes (one per build variant), to tell + the Visual Studio debugger what output target + to use in what build variant. The number of + buildtarget entries must match the + number of variant entries. + + + + + runfile + + + The name of the file that Visual Studio 7 and + later will run and debug. This appears as the + value of the Output field in the + resulting Visual Studio project file. If this is not + specified, the default is the same as the specified + buildtarget value. + + + + + + Note that because &SCons; always executes its build commands + from the directory in which the &SConstruct; file is located, + if you generate a project file in a different directory + than the &SConstruct; directory, users will not be able to + double-click on the file name in compilation error messages + displayed in the Visual Studio console output window. This can + be remedied by adding the Visual C/C++ /FC + compiler option to the &cv-link-CCFLAGS; variable so that + the compiler will print the full path name of any files that + cause compilation errors. + + Example usage: + barsrcs = ['bar.cpp'] barincs = ['bar.h'] barlocalincs = ['StdAfx.h'] barresources = ['bar.rc','resource.h'] barmisc = ['bar_readme.txt'] -dll = env.SharedLibrary(target = 'bar.dll', - source = barsrcs) +dll = env.SharedLibrary(target='bar.dll', + source=barsrcs) buildtarget = [s for s in dll if str(s).endswith('dll')] -env.MSVSProject(target = 'Bar' + env['MSVSPROJECTSUFFIX'], - srcs = barsrcs, - incs = barincs, - localincs = barlocalincs, - resources = barresources, - misc = barmisc, - buildtarget = buildtarget, - variant = 'Release') - -Starting with version 2.4 of -SCons it's also possible to specify the optional argument -DebugSettings, which creates files for debugging under -Visual Studio: - - DebugSettings - - - A dictionary of debug settings that get written to the - .vcproj.user or the - .vcxproj.user file, depending on the version - installed. As it is done for cmdargs (see above), you can specify a - DebugSettings dictionary per variant. If you - give only one, it will be propagated to all variants. - - - Currently, only Visual Studio v9.0 and Visual Studio -version v11 are implemented, for other versions no file is generated. To -generate the user file, you just need to add a -DebugSettings dictionary to the environment with the -right parameters for your MSVS version. If the dictionary is empty, or does -not contain any good value, no file will be generated.Following -is a more contrived example, involving the setup of a project for variants and -DebugSettings:# Assuming you store your defaults in a file +env.MSVSProject(target='Bar' + env['MSVSPROJECTSUFFIX'], + srcs=barsrcs, + incs=barincs, + localincs=barlocalincs, + resources=barresources, + misc=barmisc, + buildtarget=buildtarget, + variant='Release') + + + Starting with version 2.4 of SCons it is + also possible to specify the optional argument + DebugSettings, which creates files + for debugging under Visual Studio: + + + + DebugSettings + + + A dictionary of debug settings that get written + to the .vcproj.user or the + .vcxproj.user file, depending on the + version installed. As it is done for cmdargs (see above), + you can specify a DebugSettings + dictionary per variant. If you give only one, it will + be propagated to all variants. + + + + + + Currently, only Visual Studio v9.0 and Visual Studio + version v11 are implemented, for other versions no file + is generated. To generate the user file, you just need to + add a DebugSettings dictionary to the + environment with the right parameters for your MSVS version. If + the dictionary is empty, or does not contain any good value, + no file will be generated. + + + Following is a more contrived example, involving the setup + of a project for variants and DebugSettings: + + +# Assuming you store your defaults in a file vars = Variables('variables.py') msvcver = vars.args.get('vc', '9') @@ -179,7 +231,7 @@ if msvcver == '9' or msvcver == '11': env = Environment(MSVC_VERSION=msvcver+'.0', MSVC_BATCH=False) else: env = Environment() - + AddOption('--userfile', action='store_true', dest='userfile', default=False, help="Create Visual Studio Project user file") @@ -214,10 +266,10 @@ V9DebugSettings = { } # -# 2. Because there are a lot of different options depending on the Microsoft -# Visual Studio version, if you use more than one version you have to -# define a dictionary per version, for instance if you want to create a user -# file to launch a specific application for testing your dll with Microsoft +# 2. Because there are a lot of different options depending on the Microsoft +# Visual Studio version, if you use more than one version you have to +# define a dictionary per version, for instance if you want to create a user +# file to launch a specific application for testing your dll with Microsoft # Visual Studio 2012 (v11): # V10DebugSettings = { @@ -249,7 +301,7 @@ V10DebugSettings = { } # -# 3. Select the dictionary you want depending on the version of visual Studio +# 3. Select the dictionary you want depending on the version of visual Studio # Files you want to generate. # if not env.GetOption('userfile'): @@ -258,7 +310,7 @@ elif env.get('MSVC_VERSION', None) == '9.0': dbgSettings = V9DebugSettings elif env.get('MSVC_VERSION', None) == '11.0': dbgSettings = V10DebugSettings -else: +else: dbgSettings = None # @@ -270,251 +322,362 @@ barlocalincs = ['StdAfx.h'] barresources = ['bar.rc','resource.h'] barmisc = ['ReadMe.txt'] -dll = env.SharedLibrary(target = 'bar.dll', - source = barsrcs) - -env.MSVSProject(target = 'Bar' + env['MSVSPROJECTSUFFIX'], - srcs = barsrcs, - incs = barincs, - localincs = barlocalincs, - resources = barresources, - misc = barmisc, - buildtarget = [dll[0]] * 2, - variant = ('Debug|Win32', 'Release|Win32'), - cmdargs = 'vc=%s' % msvcver, - DebugSettings = (dbgSettings, {})) - Builds a Microsoft Visual Studio solution -file. This builds a Visual Studio solution file, based on the -version of Visual Studio that is configured (either the latest installed -version, or the version specified by &cv-link-MSVS_VERSION; in the -construction environment). For Visual Studio 6, it will generate a -.dsw file. For Visual Studio 7 (.NET), it will generate a -.sln file. The following values must be -specified: - - target - - - The name of the target .dsw or .sln file. The correct - suffix for the version of Visual Studio must be used, but the value - &cv-link-MSVSSOLUTIONSUFFIX; will be defined to the correct value (see - example below). - - - - - variant - - - The name of this particular variant, or a list of variant - names (the latter is only supported for MSVS 7 solutions). These are - typically things like "Debug" or "Release", but really can be anything - you want. For MSVS 7 they may also specify target platform, like this - "Debug|Xbox". Default platform is Win32. - - - - - projects - - - A list of project file names, or Project nodes returned by - calls to the &b-MSVSProject; Builder, to be placed into the solution - file. It should be noted that these file names are NOT added to the - $SOURCES environment variable in form of files, but rather as strings. - This is because they represent file names to be added to the solution - file, not the source files used to build the solution - file. - - - Example Usage: -env.MSVSSolution(target = 'Bar' + env['MSVSSOLUTIONSUFFIX'], projects = ['bar' -+ env['MSVSPROJECTSUFFIX']], variant = 'Release') - -When the Microsoft Visual Studio tools are initialized, they set up this -dictionary with the following keys: - - VERSION - - - the version of MSVS being used (can be set via - &cv-link-MSVS_VERSION;) - - - - - VERSIONS - - - the available versions of MSVS installed - - - - - VCINSTALLDIR - - - installed directory of Visual C++ - - - - - VSINSTALLDIR - - - installed directory of Visual Studio - - - - - FRAMEWORKDIR - - - installed directory of the .NET framework - - - - - FRAMEWORKVERSIONS - - - list of installed versions of the .NET framework, sorted - latest to oldest. - - - - - FRAMEWORKVERSION - - - latest installed version of the .NET - framework - - - - - FRAMEWORKSDKDIR - - - installed location of the .NET SDK. - - - - - PLATFORMSDKDIR - - - installed location of the Platform SDK. - - - - - PLATFORMSDK_MODULES - - - dictionary of installed Platform SDK modules, where the - dictionary keys are keywords for the various modules, and the values - are 2-tuples where the first is the release date, and the second is - the version number. - - - If a value isn't set, it wasn't available in the -registry. Sets -the architecture for which the generated project(s) should build. -The default value is x86. amd64 is -also supported by &SCons; for some Visual Studio versions. Trying to set -&cv-MSVS_ARCH; to an architecture that's not supported for a given Visual -Studio version will generate an error. The string placed in a generated +dll = env.SharedLibrary(target='bar.dll', + source=barsrcs) + +env.MSVSProject(target='Bar' + env['MSVSPROJECTSUFFIX'], + srcs=barsrcs, + incs=barincs, + localincs=barlocalincs, + resources=barresources, + misc=barmisc, + buildtarget=[dll[0]] * 2, + variant=('Debug|Win32', 'Release|Win32'), + cmdargs='vc=%s' % msvcver, + DebugSettings=(dbgSettings, {})) + + + + + + Builds a Microsoft Visual Studio solution file. + + This builds a Visual Studio solution file, based on the + version of Visual Studio that is configured (either the + latest installed version, or the version specified by + &cv-link-MSVS_VERSION; in the construction environment). For + Visual Studio 6, it will generate a .dsw + file. For Visual Studio 7 (.NET), it will generate a + .sln file. + + The following values must be specified: + + + target + + + The name of the target .dsw or .sln file. The correct + suffix for the version of Visual Studio must be used, + but the value &cv-link-MSVSSOLUTIONSUFFIX; will be + defined to the correct value (see example below). + + + + variant + + The name of this particular variant, or a list of + variant names (the latter is only supported for MSVS + 7 solutions). These are typically things like "Debug" + or "Release", but really can be anything you want. For + MSVS 7 they may also specify target platform, like this + "Debug|Xbox". Default platform is Win32. + + + + projects + + A list of project file names, or Project nodes returned + by calls to the &b-MSVSProject; Builder, to be placed + into the solution file. It should be noted that these + file names are NOT added to the $SOURCES environment + variable in form of files, but rather as strings. + This is because they represent file names to be added + to the solution file, not the source files used to + build the solution file. + + + + + Example Usage: + +env.MSVSSolution(target='Bar' + env['MSVSSOLUTIONSUFFIX'], projects=['bar' + env['MSVSPROJECTSUFFIX']], variant='Release') + + + + + + When the Microsoft Visual Studio tools are initialized, + they set up this dictionary with the following keys: + + + + VERSION + the version of MSVS being used (can be set via + &cv-link-MSVS_VERSION;) + + + VERSIONS + the available versions of MSVS installed + + + VCINSTALLDIR + installed directory of Visual C++ + + + VSINSTALLDIR + installed directory of Visual Studio + + + FRAMEWORKDIR + installed directory of the .NET framework + + + FRAMEWORKVERSIONS + + list of installed versions of the .NET framework, + sorted latest to oldest. + + + + + FRAMEWORKVERSION + + latest installed version of the .NET framework + + + + FRAMEWORKSDKDIR + + installed location of the .NET SDK. + + + + PLATFORMSDKDIR + + installed location of the Platform SDK. + + + + PLATFORMSDK_MODULES + + + dictionary of installed Platform SDK modules, where the + dictionary keys are keywords for the various modules, + and the values are 2-tuples where the first is the + release date, and the second is the version number. + + + + + If a value is not set, it was not available in the registry. + + + + Sets the architecture for which the generated project(s) + should build. + The default value is x86. + amd64 is also supported by &SCons; for + some Visual Studio versions. Trying to set &cv-MSVS_ARCH; + to an architecture that's not supported for a given Visual + Studio version will generate an error. + + + + + + The string placed in a generated Microsoft Visual Studio project file as the value of the -ProjectGUID attribute. There is no default value. If not -defined, a new GUID is generated. The path name placed in a generated + ProjectGUID attribute. There is no default + value. If not +defined, a new GUID is generated. + + + + + + + The path name placed in a generated Microsoft Visual Studio project file as the value of the -SccAuxPath attribute if the -MSVS_SCC_PROVIDER construction variable is also set. There is -no default value. The root path of projects in -your SCC workspace, i.e the path under which all project and solution files -will be generated. It is used as a reference path from which the relative -paths of the generated Microsoft Visual Studio project and solution files are -computed. The relative project file path is placed as the value of the -SccLocalPath attribute of the project file and as the -values of the -SccProjectFilePathRelativizedFromConnection[i] (where [i] -ranges from 0 to the number of projects in the solution) attributes of the -GlobalSection(SourceCodeControl) section of the Microsoft -Visual Studio solution file. Similarly the relative solution file path is -placed as the values of the SccLocalPath[i] (where [i] -ranges from 0 to the number of projects in the solution) attributes of the -GlobalSection(SourceCodeControl) section of the Microsoft -Visual Studio solution file. This is used only if the -MSVS_SCC_PROVIDER construction variable is also set. The -default value is the current working directory. - The project name placed in -a generated Microsoft Visual Studio project file as the value of the -SccProjectName attribute if the -MSVS_SCC_PROVIDER construction variable is also set. In this -case the string is also placed in the SccProjectName0 -attribute of the GlobalSection(SourceCodeControl) section -of the Microsoft Visual Studio solution file. There is no default value. - The -string placed in a generated Microsoft Visual Studio project file as the value -of the SccProvider attribute. The string is also placed in -the SccProvider0 attribute of the -GlobalSection(SourceCodeControl) section of the Microsoft -Visual Studio solution file. There is no default value. - Sets the preferred version -of Microsoft Visual Studio to use. If &cv-MSVS_VERSION; is not -set, &SCons; will (by default) select the latest version of Visual Studio -installed on your system. So, if you have version 6 and version 7 (MSVS .NET) -installed, it will prefer version 7. You can override this by specifying the -MSVS_VERSION variable in the Environment initialization, -setting it to the appropriate version ('6.0' or '7.0', for example). If the -specified version isn't installed, tool initialization will fail. -This is obsolete: use &cv-MSVC_VERSION; instead. If &cv-MSVS_VERSION; is -set and &cv-MSVC_VERSION; is not, &cv-MSVC_VERSION; will be set automatically -to &cv-MSVS_VERSION;. If both are set to different values, scons will raise an -error. -The build command line placed in a generated Microsoft Visual Studio -project file. The default is to have Visual Studio invoke SCons with any -specified build targets. - The clean command line placed in a generated Microsoft Visual -Studio project file. The default is to have Visual Studio invoke SCons with -the -c option to remove any specified targets. - The encoding string placed in a -generated Microsoft Visual Studio project file. The default is encoding -Windows-1252. The action used to generate Microsoft -Visual Studio project files. The suffix used for Microsoft Visual -Studio project (DSP) files. The default value is .vcproj -when using Visual Studio version 7.x (.NET) or later version, and -.dsp when using earlier versions of Visual Studio. - The -rebuild command line placed in a generated Microsoft Visual Studio project -file. The default is to have Visual Studio invoke SCons with any specified -rebuild targets. -The SCons used in generated Microsoft Visual Studio project files. The -default is the version of SCons being used to generate the project file. - The -SCons flags used in generated Microsoft Visual Studio project files. - The default -SCons command used in generated Microsoft Visual Studio project files. - The sconscript -file (that is, &SConstruct; or &SConscript; file) that will be invoked by -Visual Studio project files (through the &cv-link-MSVSSCONSCOM; variable). The -default is the same sconscript file that contains the call to &b-MSVSProject; -to build the project file. The action used to generate Microsoft -Visual Studio solution files. The suffix used for Microsoft -Visual Studio solution (DSW) files. The default value is -.sln when using Visual Studio version 7.x (.NET), and -.dsw when using earlier versions of Visual Studio. - The -(optional) path to the SCons library directory, initialized from the external -environment. If set, this is used to construct a shorter and more efficient -search path in the &cv-link-MSVSSCONS; command line executed from Microsoft -Visual Studio project files. + SccAuxPath attribute if the + MSVS_SCC_PROVIDER construction variable is + also set. There is +no default value. + + + + + + + The root path of projects in your SCC workspace, i.e the + path under which all project and solution files will be + generated. It is used as a reference path from which the + relative paths of the generated Microsoft Visual Studio project + and solution files are computed. The relative project file path + is placed as the value of the SccLocalPath + attribute of the project file and as the values of the + SccProjectFilePathRelativizedFromConnection[i] + (where [i] ranges from 0 to the number of projects in the solution) + attributes of the GlobalSection(SourceCodeControl) + section of the Microsoft Visual Studio solution file. Similarly + the relative solution file path is placed as the values of the + SccLocalPath[i] (where [i] ranges from 0 + to the number of projects in the solution) attributes of the + GlobalSection(SourceCodeControl) section of + the Microsoft Visual Studio solution file. This is used only if + the MSVS_SCC_PROVIDER construction variable is + also set. The default value is the current working directory. + + + + + + The project name placed in a generated Microsoft + Visual Studio project file as the value of the + SccProjectName attribute if the + MSVS_SCC_PROVIDER construction variable + is also set. In this case the string is also placed in + the SccProjectName0 attribute of the + GlobalSection(SourceCodeControl) section + of the Microsoft Visual Studio solution file. There is no + default value. + + + + + + The string placed in a generated Microsoft + Visual Studio project file as the value of the + SccProvider attribute. The string is + also placed in the SccProvider0 attribute + of the GlobalSection(SourceCodeControl) + section of the Microsoft Visual Studio solution file. There + is no default value. + + + + + Sets the preferred version of Microsoft Visual Studio to use. + + If &cv-MSVS_VERSION; is not set, &SCons; will (by default) + select the latest version of Visual Studio installed on your + system. So, if you have version 6 and version 7 (MSVS .NET) + installed, it will prefer version 7. You can override this by + specifying the MSVS_VERSION variable in the + Environment initialization, setting it to the appropriate + version ('6.0' or '7.0', for example). If the specified + version isn't installed, tool initialization will fail. + + + This is obsolete: use &cv-MSVC_VERSION; instead. If + &cv-MSVS_VERSION; is set and &cv-MSVC_VERSION; is + not, &cv-MSVC_VERSION; will be set automatically to + &cv-MSVS_VERSION;. If both are set to different values, + scons will raise an error. + + + + + + + The build command line placed in a generated Microsoft Visual + Studio project file. The default is to have Visual Studio + invoke SCons with any specified build targets. + + + + + + + The clean command line placed in a generated Microsoft Visual + Studio project file. The default is to have Visual Studio + invoke SCons with the -c option to remove any specified + targets. + + + + + + The encoding string placed in a generated Microsoft + Visual Studio project file. The default is encoding + Windows-1252. + + + + + + The action used to generate Microsoft Visual Studio project files. + + + + + + The suffix used for Microsoft Visual Studio project (DSP) + files. The default value is .vcproj + when using Visual Studio version 7.x (.NET) or later version, + and .dsp when using earlier versions of + Visual Studio. + + + + + + + The rebuild command line placed in a generated Microsoft + Visual Studio project file. The default is to have Visual + Studio invoke SCons with any specified rebuild targets. + + + + + + + + The SCons used in generated Microsoft Visual Studio project + files. The default is the version of SCons being used to + generate the project file. + + + + + + + The SCons flags used in generated Microsoft Visual Studio project files. + + + + + + + The default SCons command used in generated Microsoft Visual + Studio project files. + + + + + + + The sconscript file (that is, &SConstruct; or &SConscript; + file) that will be invoked by Visual Studio project files + (through the &cv-link-MSVSSCONSCOM; variable). The default + is the same sconscript file that contains the call to + &b-MSVSProject; to build the project file. + + + + + + The action used to generate Microsoft Visual Studio solution files. + + + + + The suffix used for Microsoft Visual Studio solution (DSW) + files. The default value is .sln + when using Visual Studio version 7.x (.NET), and + .dsw when using earlier versions of + Visual Studio. + + + + + + + The (optional) path to the SCons library directory, + initialized from the external environment. If set, this is + used to construct a shorter and more efficient search path in + the &cv-link-MSVSSCONS; command line executed from Microsoft + Visual Studio project files. + + + + -- cgit v0.12 From 68069af22c502e61439b006a1c6e0d2431f20949 Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 4 Feb 2019 21:21:16 -0600 Subject: fix for case where nothing is return from vswhere --- src/engine/SCons/Tool/MSCommon/vc.py | 15 +++++---- test/MSVC/no_msvc.py | 51 +++++++++++++++++++++++++++++ test/fixture/no_msvc/no_msvcs_sconstruct.py | 15 +++++++++ test/fixture/no_msvc/no_regs_sconstruct.py | 7 ++++ 4 files changed, 81 insertions(+), 7 deletions(-) create mode 100644 test/MSVC/no_msvc.py create mode 100644 test/fixture/no_msvc/no_msvcs_sconstruct.py create mode 100644 test/fixture/no_msvc/no_regs_sconstruct.py diff --git a/src/engine/SCons/Tool/MSCommon/vc.py b/src/engine/SCons/Tool/MSCommon/vc.py index c4ba803..0393885 100644 --- a/src/engine/SCons/Tool/MSCommon/vc.py +++ b/src/engine/SCons/Tool/MSCommon/vc.py @@ -298,13 +298,14 @@ def find_vc_pdir_vswhere(msvc_version): if os.path.exists(vswhere_path): sp = subprocess.Popen(vswhere_cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) vsdir, err = sp.communicate() - vsdir = vsdir.decode("mbcs").splitlines() - # vswhere could easily return multiple lines - # we could define a way to pick the one we prefer, but since - # this data is currently only used to make a check for existence, - # returning the first hit should be good enough for now. - vc_pdir = os.path.join(vsdir[0], 'VC') - return vc_pdir + if vsdir: + vsdir = vsdir.decode("mbcs").splitlines() + # vswhere could easily return multiple lines + # we could define a way to pick the one we prefer, but since + # this data is currently only used to make a check for existence, + # returning the first hit should be good enough for now. + vc_pdir = os.path.join(vsdir[0], 'VC') + return vc_pdir else: # No vswhere on system, no install info available return None diff --git a/test/MSVC/no_msvc.py b/test/MSVC/no_msvc.py new file mode 100644 index 0000000..d1161c6 --- /dev/null +++ b/test/MSVC/no_msvc.py @@ -0,0 +1,51 @@ +#!/usr/bin/env python +# +# __COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +""" +Test scons when no MSVCs are present. +""" + +import sys + +import TestSCons + +test = TestSCons.TestSCons() + +if sys.platform != 'win32': + test.skip_test("Not win32 platform. Skipping test\n") + +# test find_vc_pdir_vswhere by removing all other VS's reg keys +test.file_fixture('no_msvc/no_regs_sconstruct.py', 'SConstruct') +test.run(arguments='-Q -s', stdout='') + +# test no msvc's +test.file_fixture('no_msvc/no_msvcs_sconstruct.py', 'SConstruct') +test.run(arguments='-Q -s') + +if 'MSVC_VERSION=None' not in test.stdout(): + test.fail_test() + +test.pass_test() \ No newline at end of file diff --git a/test/fixture/no_msvc/no_msvcs_sconstruct.py b/test/fixture/no_msvc/no_msvcs_sconstruct.py new file mode 100644 index 0000000..e0b59e6 --- /dev/null +++ b/test/fixture/no_msvc/no_msvcs_sconstruct.py @@ -0,0 +1,15 @@ +import SCons +import SCons.Tool.MSCommon + +def DummyVsWhere(msvc_version): + # not testing versions with vswhere, so return none + return None + +for key in SCons.Tool.MSCommon.vc._VCVER_TO_PRODUCT_DIR: + SCons.Tool.MSCommon.vc._VCVER_TO_PRODUCT_DIR[key]=[(SCons.Util.HKEY_LOCAL_MACHINE, r'')] + +SCons.Tool.MSCommon.vc.find_vc_pdir_vswhere = DummyVsWhere + +env = SCons.Environment.Environment() + +print('MSVC_VERSION='+str(env.get('MSVC_VERSION'))) \ No newline at end of file diff --git a/test/fixture/no_msvc/no_regs_sconstruct.py b/test/fixture/no_msvc/no_regs_sconstruct.py new file mode 100644 index 0000000..3eeca94 --- /dev/null +++ b/test/fixture/no_msvc/no_regs_sconstruct.py @@ -0,0 +1,7 @@ +import SCons +import SCons.Tool.MSCommon + +for key in SCons.Tool.MSCommon.vc._VCVER_TO_PRODUCT_DIR: + SCons.Tool.MSCommon.vc._VCVER_TO_PRODUCT_DIR[key]=[(SCons.Util.HKEY_LOCAL_MACHINE, r'')] + +env = SCons.Environment.Environment() \ No newline at end of file -- cgit v0.12 From 6a61fae91aa90f985294674852ecf2e569bf6b6e Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 4 Feb 2019 22:19:03 -0600 Subject: update CHANGES.txt --- src/CHANGES.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 5fa5eab..bea98d1 100755 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -18,6 +18,7 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER From Daniel Moody: - Change the default for AppendENVPath to delete_existing=0, so path order will not be changed, unless explicitly set (Issue #3276) + - fix bug where no msvc's are found and an empty list is indexed From Mats Wichmann: - Quiet open file ResourceWarnings on Python >= 3.6 caused by -- cgit v0.12 From b1bfa3bf999c7b9ae7ac971c2bd6d7c181a4684f Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 5 Feb 2019 00:14:56 -0600 Subject: add sconstest.skip for test fixtures --- test/fixture/no_msvc/sconstest.skip | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 test/fixture/no_msvc/sconstest.skip diff --git a/test/fixture/no_msvc/sconstest.skip b/test/fixture/no_msvc/sconstest.skip new file mode 100644 index 0000000..e69de29 -- cgit v0.12 From 441732b3b9fe8d2a47e8778c512b1c47d276fcfb Mon Sep 17 00:00:00 2001 From: William Deegan Date: Tue, 5 Feb 2019 12:08:40 -0500 Subject: [ci skip] update bugfix description --- src/CHANGES.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index bea98d1..8bdafe7 100755 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -18,7 +18,7 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER From Daniel Moody: - Change the default for AppendENVPath to delete_existing=0, so path order will not be changed, unless explicitly set (Issue #3276) - - fix bug where no msvc's are found and an empty list is indexed + - Fixed bug which threw error when running SCons on windows system with no MSVC installed. From Mats Wichmann: - Quiet open file ResourceWarnings on Python >= 3.6 caused by -- cgit v0.12 From 9556926b4113f2db91e1cf493c778b01edc03589 Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Tue, 5 Feb 2019 11:41:24 -0700 Subject: PR #3289: add generated docs The three generated doc files, builders.gen, tools,gen and variables.gen are added to stay in sync with the msvs.xml change. Signed-off-by: Mats Wichmann --- doc/generated/builders.gen | 459 ++++++++++++++++++++++------------------ doc/generated/tools.gen | 17 +- doc/generated/variables.gen | 502 ++++++++++++++++++++++++-------------------- 3 files changed, 544 insertions(+), 434 deletions(-) diff --git a/doc/generated/builders.gen b/doc/generated/builders.gen index 680f72f..6f03cd3 100644 --- a/doc/generated/builders.gen +++ b/doc/generated/builders.gen @@ -838,148 +838,192 @@ Compile files for languages defined in LINGUAS file env.MSVSProject() - Builds a Microsoft Visual Studio project -file, and by default builds a solution file as well. This -builds a Visual Studio project file, based on the version of Visual Studio -that is configured (either the latest installed version, or the version -specified by $MSVS_VERSION in the Environment constructor). For -Visual Studio 6, it will generate a .dsp file. For Visual -Studio 7 (.NET) and later versions, it will generate a -.vcproj file. By default, this also -generates a solution file for the specified project, a -.dsw file for Visual Studio 6 or a -.sln file for Visual Studio 7 (.NET). This behavior may -be disabled by specifying auto_build_solution=0 when you -call MSVSProject, in which case you presumably want to build the solution -file(s) by calling the MSVSSolution Builder (see below). -The MSVSProject builder takes several lists of filenames to be placed into -the project file. These are currently limited to srcs, -incs, localincs, -resources, and misc. These are pretty -self-explanatory, but it should be noted that these lists are added to the -$SOURCES construction variable as strings, NOT as SCons File Nodes. -This is because they represent file names to be added to the project file, not -the source files used to build the project file. The above -filename lists are all optional, although at least one must be specified for -the resulting project file to be non-empty. In addition to the -above lists of values, the following values may be specified: - - - target - - - The name of the target .dsp or - .vcproj file. The correct suffix for the version - of Visual Studio must be used, but the $MSVSPROJECTSUFFIX - construction variable will be defined to the correct value (see - example below). - - - - - variant - - - The name of this particular variant. For Visual Studio 7 - projects, this can also be a list of variant names. These are - typically things like "Debug" or "Release", but really can be anything - you want. For Visual Studio 7 projects, they may also specify a target - platform separated from the variant name by a | - (vertical pipe) character: Debug|Xbox. The default - target platform is Win32. Multiple calls to MSVSProject with - different variants are allowed; all variants will be added to the - project file with their appropriate build targets and - sources. - - - - - cmdargs - - - Additional command line arguments for the different - variants. The number of cmdargs entries must match - the number of variant entries, or be empty (not - specified). If you give only one, it will automatically be propagated - to all variants. - - - - - buildtarget - - - An optional string, node, or list of strings or nodes (one - per build variant), to tell the Visual Studio debugger what output - target to use in what build variant. The number of - buildtarget entries must match the number of - variant entries. - - - - - runfile - - - The name of the file that Visual Studio 7 and later will - run and debug. This appears as the value of the - Output field in the resulting Visual Studio project - file. If this is not specified, the default is the same as the - specified buildtarget value. - - - Note that because SCons always executes its build -commands from the directory in which the SConstruct file is located, if you -generate a project file in a different directory than the SConstruct -directory, users will not be able to double-click on the file name in -compilation error messages displayed in the Visual Studio console output -window. This can be remedied by adding the Visual C/C++ /FC -compiler option to the $CCFLAGS variable so that the compiler will -print the full path name of any files that cause compilation errors. - Example usage: - + + + Builds a Microsoft Visual Studio project file, and by default + builds a solution file as well. + + + This builds a Visual Studio project file, based on the + version of Visual Studio that is configured (either the + latest installed version, or the version specified by + $MSVS_VERSION in the Environment constructor). For + Visual Studio 6, it will generate a .dsp + file. For Visual Studio 7 (.NET) and later versions, it will + generate a .vcproj file. + + + By default, this also generates a solution file for the + specified project, a .dsw file for + Visual Studio 6 or a .sln file for + Visual Studio 7 (.NET). This behavior may be disabled by + specifying auto_build_solution=0 when you + call MSVSProject, in which case you presumably want to + build the solution file(s) by calling the MSVSSolution + Builder (see below). + + + The MSVSProject builder takes several lists of filenames + to be placed into the project file. These are currently + limited to srcs, incs, + localincs, resources, and + misc. These are pretty self-explanatory, + but it should be noted that these lists are added to the + $SOURCES construction variable as strings, NOT as + SCons File Nodes. This is because they represent file names + to be added to the project file, not the source files used + to build the project file. + + + The above filename lists are all optional, although at least + one must be specified for the resulting project file to + be non-empty. + + + In addition to the above lists of values, the following values + may be specified: + + + + target + + + The name of the target .dsp + or .vcproj file. + The correct suffix for the version of Visual Studio + must be used, but the $MSVSPROJECTSUFFIX + construction variable will be defined to the correct + value (see example below). + + + + + variant + + + The name of this particular variant. For Visual Studio 7 + projects, this can also be a list of variant names. These + are typically things like "Debug" or "Release", but + really can be anything you want. For Visual Studio + 7 projects, they may also specify a target platform + separated from the variant name by a | + (vertical pipe) character: Debug|Xbox. + The default target platform is Win32. Multiple calls + to MSVSProject with different variants are allowed; + all variants will be added to the project file with + their appropriate build targets and sources. + + + + + cmdargs + + + Additional command line arguments + for the different variants. The number of + cmdargs entries must match the number + of variant entries, or be empty (not + specified). If you give only one, it will automatically + be propagated to all variants. + + + + + buildtarget + + + An optional string, node, or list of strings + or nodes (one per build variant), to tell + the Visual Studio debugger what output target + to use in what build variant. The number of + buildtarget entries must match the + number of variant entries. + + + + + runfile + + + The name of the file that Visual Studio 7 and + later will run and debug. This appears as the + value of the Output field in the + resulting Visual Studio project file. If this is not + specified, the default is the same as the specified + buildtarget value. + + + + + + Note that because SCons always executes its build commands + from the directory in which the SConstruct file is located, + if you generate a project file in a different directory + than the SConstruct directory, users will not be able to + double-click on the file name in compilation error messages + displayed in the Visual Studio console output window. This can + be remedied by adding the Visual C/C++ /FC + compiler option to the $CCFLAGS variable so that + the compiler will print the full path name of any files that + cause compilation errors. + + Example usage: + barsrcs = ['bar.cpp'] barincs = ['bar.h'] barlocalincs = ['StdAfx.h'] barresources = ['bar.rc','resource.h'] barmisc = ['bar_readme.txt'] -dll = env.SharedLibrary(target = 'bar.dll', - source = barsrcs) +dll = env.SharedLibrary(target='bar.dll', + source=barsrcs) buildtarget = [s for s in dll if str(s).endswith('dll')] -env.MSVSProject(target = 'Bar' + env['MSVSPROJECTSUFFIX'], - srcs = barsrcs, - incs = barincs, - localincs = barlocalincs, - resources = barresources, - misc = barmisc, - buildtarget = buildtarget, - variant = 'Release') - -Starting with version 2.4 of -SCons it's also possible to specify the optional argument -DebugSettings, which creates files for debugging under -Visual Studio: - - DebugSettings - - - A dictionary of debug settings that get written to the - .vcproj.user or the - .vcxproj.user file, depending on the version - installed. As it is done for cmdargs (see above), you can specify a - DebugSettings dictionary per variant. If you - give only one, it will be propagated to all variants. - - - Currently, only Visual Studio v9.0 and Visual Studio -version v11 are implemented, for other versions no file is generated. To -generate the user file, you just need to add a -DebugSettings dictionary to the environment with the -right parameters for your MSVS version. If the dictionary is empty, or does -not contain any good value, no file will be generated.Following -is a more contrived example, involving the setup of a project for variants and -DebugSettings:# Assuming you store your defaults in a file +env.MSVSProject(target='Bar' + env['MSVSPROJECTSUFFIX'], + srcs=barsrcs, + incs=barincs, + localincs=barlocalincs, + resources=barresources, + misc=barmisc, + buildtarget=buildtarget, + variant='Release') + + + Starting with version 2.4 of SCons it is + also possible to specify the optional argument + DebugSettings, which creates files + for debugging under Visual Studio: + + + + DebugSettings + + + A dictionary of debug settings that get written + to the .vcproj.user or the + .vcxproj.user file, depending on the + version installed. As it is done for cmdargs (see above), + you can specify a DebugSettings + dictionary per variant. If you give only one, it will + be propagated to all variants. + + + + + + Currently, only Visual Studio v9.0 and Visual Studio + version v11 are implemented, for other versions no file + is generated. To generate the user file, you just need to + add a DebugSettings dictionary to the + environment with the right parameters for your MSVS version. If + the dictionary is empty, or does not contain any good value, + no file will be generated. + + + Following is a more contrived example, involving the setup + of a project for variants and DebugSettings: + + +# Assuming you store your defaults in a file vars = Variables('variables.py') msvcver = vars.args.get('vc', '9') @@ -988,7 +1032,7 @@ if msvcver == '9' or msvcver == '11': env = Environment(MSVC_VERSION=msvcver+'.0', MSVC_BATCH=False) else: env = Environment() - + AddOption('--userfile', action='store_true', dest='userfile', default=False, help="Create Visual Studio Project user file") @@ -1023,10 +1067,10 @@ V9DebugSettings = { } # -# 2. Because there are a lot of different options depending on the Microsoft -# Visual Studio version, if you use more than one version you have to -# define a dictionary per version, for instance if you want to create a user -# file to launch a specific application for testing your dll with Microsoft +# 2. Because there are a lot of different options depending on the Microsoft +# Visual Studio version, if you use more than one version you have to +# define a dictionary per version, for instance if you want to create a user +# file to launch a specific application for testing your dll with Microsoft # Visual Studio 2012 (v11): # V10DebugSettings = { @@ -1058,7 +1102,7 @@ V10DebugSettings = { } # -# 3. Select the dictionary you want depending on the version of visual Studio +# 3. Select the dictionary you want depending on the version of visual Studio # Files you want to generate. # if not env.GetOption('userfile'): @@ -1067,7 +1111,7 @@ elif env.get('MSVC_VERSION', None) == '9.0': dbgSettings = V9DebugSettings elif env.get('MSVC_VERSION', None) == '11.0': dbgSettings = V10DebugSettings -else: +else: dbgSettings = None # @@ -1079,20 +1123,21 @@ barlocalincs = ['StdAfx.h'] barresources = ['bar.rc','resource.h'] barmisc = ['ReadMe.txt'] -dll = env.SharedLibrary(target = 'bar.dll', - source = barsrcs) - -env.MSVSProject(target = 'Bar' + env['MSVSPROJECTSUFFIX'], - srcs = barsrcs, - incs = barincs, - localincs = barlocalincs, - resources = barresources, - misc = barmisc, - buildtarget = [dll[0]] * 2, - variant = ('Debug|Win32', 'Release|Win32'), - cmdargs = 'vc=%s' % msvcver, - DebugSettings = (dbgSettings, {})) - +dll = env.SharedLibrary(target='bar.dll', + source=barsrcs) + +env.MSVSProject(target='Bar' + env['MSVSPROJECTSUFFIX'], + srcs=barsrcs, + incs=barincs, + localincs=barlocalincs, + resources=barresources, + misc=barmisc, + buildtarget=[dll[0]] * 2, + variant=('Debug|Win32', 'Release|Win32'), + cmdargs='vc=%s' % msvcver, + DebugSettings=(dbgSettings, {})) + +
@@ -1101,54 +1146,60 @@ env.MSVSProject(target = 'Bar' + env['MSVSPROJECTSUFFIX'], env.MSVSSolution() - Builds a Microsoft Visual Studio solution -file. This builds a Visual Studio solution file, based on the -version of Visual Studio that is configured (either the latest installed -version, or the version specified by $MSVS_VERSION in the -construction environment). For Visual Studio 6, it will generate a -.dsw file. For Visual Studio 7 (.NET), it will generate a -.sln file. The following values must be -specified: - - target - - - The name of the target .dsw or .sln file. The correct - suffix for the version of Visual Studio must be used, but the value - $MSVSSOLUTIONSUFFIX will be defined to the correct value (see - example below). - - - - - variant - - - The name of this particular variant, or a list of variant - names (the latter is only supported for MSVS 7 solutions). These are - typically things like "Debug" or "Release", but really can be anything - you want. For MSVS 7 they may also specify target platform, like this - "Debug|Xbox". Default platform is Win32. - - - - - projects - - - A list of project file names, or Project nodes returned by - calls to the MSVSProject Builder, to be placed into the solution - file. It should be noted that these file names are NOT added to the - $SOURCES environment variable in form of files, but rather as strings. - This is because they represent file names to be added to the solution - file, not the source files used to build the solution - file. - - - Example Usage: -env.MSVSSolution(target = 'Bar' + env['MSVSSOLUTIONSUFFIX'], projects = ['bar' -+ env['MSVSPROJECTSUFFIX']], variant = 'Release') - + + Builds a Microsoft Visual Studio solution file. + + This builds a Visual Studio solution file, based on the + version of Visual Studio that is configured (either the + latest installed version, or the version specified by + $MSVS_VERSION in the construction environment). For + Visual Studio 6, it will generate a .dsw + file. For Visual Studio 7 (.NET), it will generate a + .sln file. + + The following values must be specified: + + + target + + + The name of the target .dsw or .sln file. The correct + suffix for the version of Visual Studio must be used, + but the value $MSVSSOLUTIONSUFFIX will be + defined to the correct value (see example below). + + + + variant + + The name of this particular variant, or a list of + variant names (the latter is only supported for MSVS + 7 solutions). These are typically things like "Debug" + or "Release", but really can be anything you want. For + MSVS 7 they may also specify target platform, like this + "Debug|Xbox". Default platform is Win32. + + + + projects + + A list of project file names, or Project nodes returned + by calls to the MSVSProject Builder, to be placed + into the solution file. It should be noted that these + file names are NOT added to the $SOURCES environment + variable in form of files, but rather as strings. + This is because they represent file names to be added + to the solution file, not the source files used to + build the solution file. + + + + + Example Usage: + +env.MSVSSolution(target='Bar' + env['MSVSSOLUTIONSUFFIX'], projects=['bar' + env['MSVSPROJECTSUFFIX']], variant='Release') + + diff --git a/doc/generated/tools.gen b/doc/generated/tools.gen index 7661110..88bd11a 100644 --- a/doc/generated/tools.gen +++ b/doc/generated/tools.gen @@ -750,8 +750,9 @@ Sets construction variables for the Microsoft Visual C/C++ compiler. msvs - -Sets construction variables for Microsoft Visual Studio. Sets: &cv-link-MSVSBUILDCOM;, &cv-link-MSVSCLEANCOM;, &cv-link-MSVSENCODING;, &cv-link-MSVSPROJECTCOM;, &cv-link-MSVSREBUILDCOM;, &cv-link-MSVSSCONS;, &cv-link-MSVSSCONSCOM;, &cv-link-MSVSSCONSCRIPT;, &cv-link-MSVSSCONSFLAGS;, &cv-link-MSVSSOLUTIONCOM;. + + Sets construction variables for Microsoft Visual Studio. + Sets: &cv-link-MSVSBUILDCOM;, &cv-link-MSVSCLEANCOM;, &cv-link-MSVSENCODING;, &cv-link-MSVSPROJECTCOM;, &cv-link-MSVSREBUILDCOM;, &cv-link-MSVSSCONS;, &cv-link-MSVSSCONSCOM;, &cv-link-MSVSSCONSCRIPT;, &cv-link-MSVSSCONSFLAGS;, &cv-link-MSVSSOLUTIONCOM;. mwcc @@ -778,19 +779,19 @@ Sets construction variables for the Sets: &cv-link-AS;, &cv-link-ASCOM;, &cv-link-ASFLAGS;, &cv-link-ASPPCOM;, &cv-link-ASPPFLAGS;.Uses: &cv-link-ASCOMSTR;, &cv-link-ASPPCOMSTR;. - - packaging + + Packaging -A framework for building binary and source packages. +Sets construction variables for the Package Builder. - - Packaging + + packaging -Sets construction variables for the Package Builder. +A framework for building binary and source packages. diff --git a/doc/generated/variables.gen b/doc/generated/variables.gen index 4e84fbc..194fb72 100644 --- a/doc/generated/variables.gen +++ b/doc/generated/variables.gen @@ -3032,15 +3032,6 @@ is -dNOPAUSE -dBATCH -sDEVICE=pdfwrite HOST_ARCH - The name of the host hardware architecture used to create the Environment. - If a platform is specified when creating the Environment, then - that Platform's logic will handle setting this value. - This value is immutable, and should not be changed by the user after - the Environment is initialized. - Currently only set for Win32. - - - Sets the host architecture for Visual Studio compiler. If not set, default to the detected host architecture: note that this may depend on the python you are using. @@ -3056,7 +3047,16 @@ Valid values are the same as for This is currently only used on Windows, but in the future it will be used on other OSes as well. - + + + The name of the host hardware architecture used to create the Environment. + If a platform is specified when creating the Environment, then + that Platform's logic will handle setting this value. + This value is immutable, and should not be changed by the user after + the Environment is initialized. + Currently only set for Win32. + + HOST_OS @@ -3298,7 +3298,7 @@ The command line used to call the Java archive tool. The string displayed when the Java archive tool is called -If this is not set, then $JARCOM (the command line) is displayed. +If this is not set, then $JARCOM (the command line) is displayed. @@ -3308,7 +3308,7 @@ env = Environment(JARCOMSTR = "JARchiving $SOURCES into $TARGET") The string displayed when the Java archive tool is called -If this is not set, then $JARCOM (the command line) is displayed. +If this is not set, then $JARCOM (the command line) is displayed. @@ -4511,254 +4511,308 @@ Versions ending in Exp refer to "Express" or MSVS - -When the Microsoft Visual Studio tools are initialized, they set up this -dictionary with the following keys: - - VERSION - - - the version of MSVS being used (can be set via - $MSVS_VERSION) - - - - - VERSIONS - - - the available versions of MSVS installed - - - - - VCINSTALLDIR - - - installed directory of Visual C++ - - - - - VSINSTALLDIR - - - installed directory of Visual Studio - - - - - FRAMEWORKDIR - - - installed directory of the .NET framework - - - - - FRAMEWORKVERSIONS - - - list of installed versions of the .NET framework, sorted - latest to oldest. - - - - - FRAMEWORKVERSION - - - latest installed version of the .NET - framework - - - - - FRAMEWORKSDKDIR - - - installed location of the .NET SDK. - - - - - PLATFORMSDKDIR - - - installed location of the Platform SDK. - - - - - PLATFORMSDK_MODULES - - - dictionary of installed Platform SDK modules, where the - dictionary keys are keywords for the various modules, and the values - are 2-tuples where the first is the release date, and the second is - the version number. - - - If a value isn't set, it wasn't available in the -registry. + + + When the Microsoft Visual Studio tools are initialized, + they set up this dictionary with the following keys: + + + + VERSION + the version of MSVS being used (can be set via + $MSVS_VERSION) + + + VERSIONS + the available versions of MSVS installed + + + VCINSTALLDIR + installed directory of Visual C++ + + + VSINSTALLDIR + installed directory of Visual Studio + + + FRAMEWORKDIR + installed directory of the .NET framework + + + FRAMEWORKVERSIONS + + list of installed versions of the .NET framework, + sorted latest to oldest. + + + + + FRAMEWORKVERSION + + latest installed version of the .NET framework + + + + FRAMEWORKSDKDIR + + installed location of the .NET SDK. + + + + PLATFORMSDKDIR + + installed location of the Platform SDK. + + + + PLATFORMSDK_MODULES + + + dictionary of installed Platform SDK modules, where the + dictionary keys are keywords for the various modules, + and the values are 2-tuples where the first is the + release date, and the second is the version number. + + + + + If a value is not set, it was not available in the registry. + MSVS_ARCH - Sets -the architecture for which the generated project(s) should build. -The default value is x86. amd64 is -also supported by SCons for some Visual Studio versions. Trying to set -$MSVS_ARCH to an architecture that's not supported for a given Visual -Studio version will generate an error. + + Sets the architecture for which the generated project(s) + should build. + The default value is x86. + amd64 is also supported by SCons for + some Visual Studio versions. Trying to set $MSVS_ARCH + to an architecture that's not supported for a given Visual + Studio version will generate an error. + + MSVS_PROJECT_GUID - The string placed in a generated + + + The string placed in a generated Microsoft Visual Studio project file as the value of the -ProjectGUID attribute. There is no default value. If not -defined, a new GUID is generated. + ProjectGUID attribute. There is no default + value. If not +defined, a new GUID is generated. + + + MSVS_SCC_AUX_PATH - The path name placed in a generated + + + The path name placed in a generated Microsoft Visual Studio project file as the value of the -SccAuxPath attribute if the -MSVS_SCC_PROVIDER construction variable is also set. There is -no default value. + SccAuxPath attribute if the + MSVS_SCC_PROVIDER construction variable is + also set. There is +no default value. + + + MSVS_SCC_CONNECTION_ROOT - The root path of projects in -your SCC workspace, i.e the path under which all project and solution files -will be generated. It is used as a reference path from which the relative -paths of the generated Microsoft Visual Studio project and solution files are -computed. The relative project file path is placed as the value of the -SccLocalPath attribute of the project file and as the -values of the -SccProjectFilePathRelativizedFromConnection[i] (where [i] -ranges from 0 to the number of projects in the solution) attributes of the -GlobalSection(SourceCodeControl) section of the Microsoft -Visual Studio solution file. Similarly the relative solution file path is -placed as the values of the SccLocalPath[i] (where [i] -ranges from 0 to the number of projects in the solution) attributes of the -GlobalSection(SourceCodeControl) section of the Microsoft -Visual Studio solution file. This is used only if the -MSVS_SCC_PROVIDER construction variable is also set. The -default value is the current working directory. + + + The root path of projects in your SCC workspace, i.e the + path under which all project and solution files will be + generated. It is used as a reference path from which the + relative paths of the generated Microsoft Visual Studio project + and solution files are computed. The relative project file path + is placed as the value of the SccLocalPath + attribute of the project file and as the values of the + SccProjectFilePathRelativizedFromConnection[i] + (where [i] ranges from 0 to the number of projects in the solution) + attributes of the GlobalSection(SourceCodeControl) + section of the Microsoft Visual Studio solution file. Similarly + the relative solution file path is placed as the values of the + SccLocalPath[i] (where [i] ranges from 0 + to the number of projects in the solution) attributes of the + GlobalSection(SourceCodeControl) section of + the Microsoft Visual Studio solution file. This is used only if + the MSVS_SCC_PROVIDER construction variable is + also set. The default value is the current working directory. + + MSVS_SCC_PROJECT_NAME - The project name placed in -a generated Microsoft Visual Studio project file as the value of the -SccProjectName attribute if the -MSVS_SCC_PROVIDER construction variable is also set. In this -case the string is also placed in the SccProjectName0 -attribute of the GlobalSection(SourceCodeControl) section -of the Microsoft Visual Studio solution file. There is no default value. - + + + The project name placed in a generated Microsoft + Visual Studio project file as the value of the + SccProjectName attribute if the + MSVS_SCC_PROVIDER construction variable + is also set. In this case the string is also placed in + the SccProjectName0 attribute of the + GlobalSection(SourceCodeControl) section + of the Microsoft Visual Studio solution file. There is no + default value. + + MSVS_SCC_PROVIDER - The -string placed in a generated Microsoft Visual Studio project file as the value -of the SccProvider attribute. The string is also placed in -the SccProvider0 attribute of the -GlobalSection(SourceCodeControl) section of the Microsoft -Visual Studio solution file. There is no default value. + + + The string placed in a generated Microsoft + Visual Studio project file as the value of the + SccProvider attribute. The string is + also placed in the SccProvider0 attribute + of the GlobalSection(SourceCodeControl) + section of the Microsoft Visual Studio solution file. There + is no default value. + + MSVS_VERSION - Sets the preferred version -of Microsoft Visual Studio to use. If $MSVS_VERSION is not -set, SCons will (by default) select the latest version of Visual Studio -installed on your system. So, if you have version 6 and version 7 (MSVS .NET) -installed, it will prefer version 7. You can override this by specifying the -MSVS_VERSION variable in the Environment initialization, -setting it to the appropriate version ('6.0' or '7.0', for example). If the -specified version isn't installed, tool initialization will fail. -This is obsolete: use $MSVC_VERSION instead. If $MSVS_VERSION is -set and $MSVC_VERSION is not, $MSVC_VERSION will be set automatically -to $MSVS_VERSION. If both are set to different values, scons will raise an -error. + + Sets the preferred version of Microsoft Visual Studio to use. + + If $MSVS_VERSION is not set, SCons will (by default) + select the latest version of Visual Studio installed on your + system. So, if you have version 6 and version 7 (MSVS .NET) + installed, it will prefer version 7. You can override this by + specifying the MSVS_VERSION variable in the + Environment initialization, setting it to the appropriate + version ('6.0' or '7.0', for example). If the specified + version isn't installed, tool initialization will fail. + + + This is obsolete: use $MSVC_VERSION instead. If + $MSVS_VERSION is set and $MSVC_VERSION is + not, $MSVC_VERSION will be set automatically to + $MSVS_VERSION. If both are set to different values, + scons will raise an error. + + MSVSBUILDCOM -The build command line placed in a generated Microsoft Visual Studio -project file. The default is to have Visual Studio invoke SCons with any -specified build targets. + + The build command line placed in a generated Microsoft Visual + Studio project file. The default is to have Visual Studio + invoke SCons with any specified build targets. + + MSVSCLEANCOM - The clean command line placed in a generated Microsoft Visual -Studio project file. The default is to have Visual Studio invoke SCons with -the -c option to remove any specified targets. + + + The clean command line placed in a generated Microsoft Visual + Studio project file. The default is to have Visual Studio + invoke SCons with the -c option to remove any specified + targets. + + MSVSENCODING - The encoding string placed in a -generated Microsoft Visual Studio project file. The default is encoding -Windows-1252. + + + The encoding string placed in a generated Microsoft + Visual Studio project file. The default is encoding + Windows-1252. + + MSVSPROJECTCOM - The action used to generate Microsoft -Visual Studio project files. + + The action used to generate Microsoft Visual Studio project files. + MSVSPROJECTSUFFIX - The suffix used for Microsoft Visual -Studio project (DSP) files. The default value is .vcproj -when using Visual Studio version 7.x (.NET) or later version, and -.dsp when using earlier versions of Visual Studio. - + + + The suffix used for Microsoft Visual Studio project (DSP) + files. The default value is .vcproj + when using Visual Studio version 7.x (.NET) or later version, + and .dsp when using earlier versions of + Visual Studio. + + MSVSREBUILDCOM - The -rebuild command line placed in a generated Microsoft Visual Studio project -file. The default is to have Visual Studio invoke SCons with any specified -rebuild targets. + + + The rebuild command line placed in a generated Microsoft + Visual Studio project file. The default is to have Visual + Studio invoke SCons with any specified rebuild targets. + + + MSVSSCONS -The SCons used in generated Microsoft Visual Studio project files. The -default is the version of SCons being used to generate the project file. - + + The SCons used in generated Microsoft Visual Studio project + files. The default is the version of SCons being used to + generate the project file. + + MSVSSCONSCOM - The default -SCons command used in generated Microsoft Visual Studio project files. - + + + The default SCons command used in generated Microsoft Visual + Studio project files. + + MSVSSCONSCRIPT - The sconscript -file (that is, SConstruct or SConscript file) that will be invoked by -Visual Studio project files (through the $MSVSSCONSCOM variable). The -default is the same sconscript file that contains the call to MSVSProject -to build the project file. + + + The sconscript file (that is, SConstruct or SConscript + file) that will be invoked by Visual Studio project files + (through the $MSVSSCONSCOM variable). The default + is the same sconscript file that contains the call to + MSVSProject to build the project file. + + MSVSSCONSFLAGS - The -SCons flags used in generated Microsoft Visual Studio project files. - + + + The SCons flags used in generated Microsoft Visual Studio project files. + + MSVSSOLUTIONCOM - The action used to generate Microsoft -Visual Studio solution files. + + The action used to generate Microsoft Visual Studio solution files. + MSVSSOLUTIONSUFFIX - The suffix used for Microsoft -Visual Studio solution (DSW) files. The default value is -.sln when using Visual Studio version 7.x (.NET), and -.dsw when using earlier versions of Visual Studio. - + + + The suffix used for Microsoft Visual Studio solution (DSW) + files. The default value is .sln + when using Visual Studio version 7.x (.NET), and + .dsw when using earlier versions of + Visual Studio. + + MT @@ -5973,11 +6027,15 @@ below, for more information. SCONS_HOME - The -(optional) path to the SCons library directory, initialized from the external -environment. If set, this is used to construct a shorter and more efficient -search path in the $MSVSSCONS command line executed from Microsoft -Visual Studio project files. + + + The (optional) path to the SCons library directory, + initialized from the external environment. If set, this is + used to construct a shorter and more efficient search path in + the $MSVSSCONS command line executed from Microsoft + Visual Studio project files. + + SHCC @@ -6720,6 +6778,16 @@ Example + + SHLIBVERSIONFLAGS + + +Extra flags added to $SHLINKCOM when building versioned +SharedLibrary. These flags are only used when $SHLIBVERSION is +set. + + + _SHLIBVERSIONFLAGS @@ -6733,16 +6801,6 @@ and some extra dynamically generated options (such as - - SHLIBVERSIONFLAGS - - -Extra flags added to $SHLINKCOM when building versioned -SharedLibrary. These flags are only used when $SHLIBVERSION is -set. - - - SHLINK @@ -7206,13 +7264,6 @@ that may not be set or used in a construction environment. TARGET_ARCH - The name of the target hardware architecture for the compiled objects - created by this Environment. - This defaults to the value of HOST_ARCH, and the user can override it. - Currently only set for Win32. - - - Sets the target architecture for Visual Studio compiler (i.e. the arch of the binaries generated by the compiler). If not set, default to $HOST_ARCH, or, if that is unset, to the architecture of the @@ -7243,7 +7294,14 @@ and ia64 (Itanium). For example, if you want to compile 64-bit binaries, you would set TARGET_ARCH='x86_64' in your SCons environment. - + + + The name of the target hardware architecture for the compiled objects + created by this Environment. + This defaults to the value of HOST_ARCH, and the user can override it. + Currently only set for Win32. + + TARGET_OS -- cgit v0.12 From f04b4313cd4b96bdb01ff77294ca24ee9d9c0ebb Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Wed, 6 Feb 2019 09:10:21 -0700 Subject: Fix problem where API doc gen misses some files In doc/SConscript, the function in bootstrap.py to parse a manifest was called with an scons path (#src/engine) but bootstrap does not run in an scons context, it is run via subprocess.Popen. Preprocess the path. Along the way, change the function to open the file itself instead of being passed a list already read from the file, update the comment, and clean some whitespace issues. Signed-off-by: Mats Wichmann --- SConstruct | 8 +++----- bootstrap.py | 44 +++++++++++++++++++++++++++----------------- doc/SConscript | 17 +++++++++-------- 3 files changed, 39 insertions(+), 30 deletions(-) diff --git a/SConstruct b/SConstruct index 3d93d1e..8f7ceaf 100644 --- a/SConstruct +++ b/SConstruct @@ -335,7 +335,7 @@ python_scons = { 'debian_deps' : [ 'debian/changelog', 'debian/compat', - 'debian/control', + 'debian/control', 'debian/copyright', 'debian/dirs', 'debian/docs', @@ -499,8 +499,7 @@ for p in [ scons ]: # destination files. # manifest_in = File(os.path.join(src, 'MANIFEST.in')).rstr() - manifest_in_lines = open(manifest_in).readlines() - src_files = bootstrap.parseManifestLines(src, manifest_in_lines) + src_files = bootstrap.parseManifestLines(src, manifest_in) raw_files = src_files[:] dst_files = src_files[:] @@ -520,12 +519,11 @@ for p in [ scons ]: MANIFEST_in = File(os.path.join(src, ssubdir, 'MANIFEST.in')).rstr() MANIFEST_in_list.append(MANIFEST_in) - files = bootstrap.parseManifestLines(os.path.join(src, ssubdir), open(MANIFEST_in).readlines()) + files = bootstrap.parseManifestLines(os.path.join(src, ssubdir), MANIFEST_in) raw_files.extend(files) src_files.extend([os.path.join(ssubdir, x) for x in files]) - files = [os.path.join(isubdir, x) for x in files] dst_files.extend(files) for k, f in sp['filemap'].items(): diff --git a/bootstrap.py b/bootstrap.py index ea7e0c8..4ade361 100755 --- a/bootstrap.py +++ b/bootstrap.py @@ -21,6 +21,7 @@ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # +from __future__ import print_function import os import os.path @@ -74,15 +75,24 @@ the following SCons options: "eaten" by the bootstrap.py script. """ -def parseManifestLines(basedir, lines): - """ Scans the single lines of a MANIFEST file, - and returns the list of source files. - Has basic support for recursive globs '**', - filename wildcards of the form '*.xml' and - comment lines, starting with a '#'. +def parseManifestLines(basedir, manifest): + """ + Scans a MANIFEST file, and returns the list of source files. + + Has basic support for recursive globs '**', + filename wildcards of the form '*.xml' and + comment lines, starting with a '#'. + + :param basedir: base path to find files in. Note this does not + run in an SCons context so path must not need + further processing (e.g. no '#' signs) + :param manifest: path to manifest file + :returns: list of files """ sources = [] basewd = os.path.abspath(basedir) + with open(manifest) as m: + lines = m.readlines() for l in lines: if l.startswith('#'): # Skip comments @@ -107,16 +117,16 @@ def parseManifestLines(basedir, lines): def main(): script_dir = os.path.abspath(os.path.dirname(__file__)) - + bootstrap_dir = os.path.join(script_dir, 'bootstrap') - + pass_through_args = [] update_only = None - + requires_an_argument = 'bootstrap.py: %s requires an argument\n' - + search = [script_dir] - + def find(filename, search=search): for dir_name in search: filepath = os.path.join(dir_name, filename) @@ -125,20 +135,20 @@ def main(): sys.stderr.write("could not find `%s' in search path:\n" % filename) sys.stderr.write("\t" + "\n\t".join(search) + "\n") sys.exit(2) - + def must_copy(dst, src): if not os.path.exists(dst): return 1 return not filecmp.cmp(dst,src) - + # Note: We don't use the getopt module to process the command-line # arguments because we'd have to teach it about all of the SCons options. - + command_line_args = sys.argv[1:] - + while command_line_args: arg = command_line_args.pop(0) - + if arg == '--bootstrap_dir': try: bootstrap_dir = command_line_args.pop(0) @@ -180,7 +190,7 @@ def main(): MANIFEST_in = find(os.path.join(src_engine, 'MANIFEST.in')) manifest_files = [os.path.join(src_engine, x) for x in parseManifestLines(os.path.join(script_dir, src_engine), - open(MANIFEST_in).readlines())] + MANIFEST_in)] files = [scons_py] + manifest_files diff --git a/doc/SConscript b/doc/SConscript index ad3eb9b..51ef2db 100644 --- a/doc/SConscript +++ b/doc/SConscript @@ -326,7 +326,7 @@ else: # get included by the document XML files in the subdirectories. # manifest = File('MANIFEST').rstr() - src_files = bootstrap.parseManifestLines('.', open(manifest).readlines()) + src_files = bootstrap.parseManifestLines('.', manifest) for s in src_files: if not s: continue @@ -351,7 +351,7 @@ else: if not os.path.exists(os.path.join(build, doc, 'titlepage')): env.Execute(Mkdir(os.path.join(build, doc, 'titlepage'))) manifest = File(os.path.join(doc, 'MANIFEST')).rstr() - src_files = bootstrap.parseManifestLines(doc, open(manifest).readlines()) + src_files = bootstrap.parseManifestLines(doc, manifest) for s in src_files: if not s: continue @@ -571,14 +571,15 @@ if not epydoc_cli and not epydoc: else: # XXX Should be in common with reading the same thing in # the SConstruct file. - e = os.path.join('#src', 'engine') - manifest_in = File(os.path.join(e, 'MANIFEST.in')).rstr() - sources = bootstrap.parseManifestLines(e, open(manifest_in).readlines()) - - # Don't omit this as we need Platform.virtualenv for the examples to be run + # bootstrap.py runs outside of SCons, so need to process the path + e = Dir(os.path.join('#src', 'engine')).rstr() + sources = bootstrap.parseManifestLines(e, os.path.join(e, 'MANIFEST.in')) + + # Omit some files: + # + # Don't omit Platform as we need Platform.virtualenv for the examples to be run # sources = [x for x in sources if x.find('Platform') == -1] sources = [x for x in sources if x.find('Tool') == -1] - # XXX sources = [x for x in sources if x.find('Options') == -1] e = os.path.join(build, '..', 'scons', 'engine') -- cgit v0.12 From 7813d8b9e219c6020ce9e462f3b1c6be741ed29c Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Wed, 6 Feb 2019 09:35:38 -0700 Subject: Add arm targets to doc for MSVS_ARCH Signed-off-by: Mats Wichmann --- doc/generated/variables.gen | 9 ++++++--- src/engine/SCons/Tool/msvs.xml | 9 ++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/doc/generated/variables.gen b/doc/generated/variables.gen index 194fb72..a6012b6 100644 --- a/doc/generated/variables.gen +++ b/doc/generated/variables.gen @@ -4582,11 +4582,14 @@ Versions ending in Exp refer to "Express" or MSVS_ARCH - Sets the architecture for which the generated project(s) - should build. + Sets the architecture for which the generated project(s) should build. + The default value is x86. amd64 is also supported by SCons for - some Visual Studio versions. Trying to set $MSVS_ARCH + most Visual Studio versions. Since Visual Studio 2015 + arm is supported, and since Visual Studio + 2017 arm64 is supported. + Trying to set $MSVS_ARCH to an architecture that's not supported for a given Visual Studio version will generate an error. diff --git a/src/engine/SCons/Tool/msvs.xml b/src/engine/SCons/Tool/msvs.xml index 2292522..6467a2b 100644 --- a/src/engine/SCons/Tool/msvs.xml +++ b/src/engine/SCons/Tool/msvs.xml @@ -463,11 +463,14 @@ env.MSVSSolution(target='Bar' + env['MSVSSOLUTIONSUFFIX'], projects=['bar' + env - Sets the architecture for which the generated project(s) - should build. + Sets the architecture for which the generated project(s) should build. + The default value is x86. amd64 is also supported by &SCons; for - some Visual Studio versions. Trying to set &cv-MSVS_ARCH; + most Visual Studio versions. Since Visual Studio 2015 + arm is supported, and since Visual Studio + 2017 arm64 is supported. + Trying to set &cv-MSVS_ARCH; to an architecture that's not supported for a given Visual Studio version will generate an error. -- cgit v0.12 From 3454ffa352804f8371dd5822b207f03622b8e3b8 Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 7 Feb 2019 21:51:32 -0600 Subject: switch to 32 bit mingw in appveyor and add mingw env test --- .appveyor.yml | 3 +- test/Win32/msvc_mingw_env.py | 102 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 104 insertions(+), 1 deletion(-) create mode 100644 test/Win32/msvc_mingw_env.py diff --git a/.appveyor.yml b/.appveyor.yml index 466c72d..1849707 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -17,7 +17,8 @@ install: # add python and python user-base to path for pip installs - cmd: "C:\\%WINPYTHON%\\python.exe --version" - cmd: for /F "tokens=*" %%g in ('C:\\%WINPYTHON%\\python.exe -m site --user-site') do (set PYSITEDIR=%%g) - - cmd: "set PATH=C:\\%WINPYTHON%;C:\\%WINPYTHON%\\Scripts;C:\\cygwin64\\bin;C:\\msys64;C:\\ProgramData\\chocolatey\\bin;%PATH%" + # use mingw 32 bit until #3291 is resolved + - cmd: "set PATH=C:\\%WINPYTHON%;C:\\%WINPYTHON%\\Scripts;C:\\MinGW\\bin;C:\\MinGW\\msys\\1.0\\bin;C:\\cygwin\\bin;C:\\ProgramData\\chocolatey\\bin;%PATH%" - cmd: "C:\\%WINPYTHON%\\python.exe -m pip install -U --progress-bar off pip setuptools wheel " - cmd: "C:\\%WINPYTHON%\\python.exe -m pip install -U --progress-bar off pypiwin32 coverage codecov" - cmd: set STATIC_DEPS=true & C:\\%WINPYTHON%\\python.exe -m pip install -U --progress-bar off lxml diff --git a/test/Win32/msvc_mingw_env.py b/test/Win32/msvc_mingw_env.py new file mode 100644 index 0000000..107cd1e --- /dev/null +++ b/test/Win32/msvc_mingw_env.py @@ -0,0 +1,102 @@ +""" +This tests the MinGW with MSVC tool. +""" + +#!/usr/bin/env python +# +# __COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +import sys + +import TestSCons + +test = TestSCons.TestSCons() + +# MinGW is Windows only: +if sys.platform != 'win32': + msg = "Skipping mingw test on non-Windows platform '%s'\n" % sys.platform + test.skip_test(msg) + +test.skip_if_not_msvc() + +# control test: check for nologo and cl in env +test.write('SConstruct',""" +env=Environment(tools=['default']) +print('CCFLAGS=' + str(env['CCFLAGS']).strip()) +print('CC=' + str(env['CC']).strip()) +""") +test.run(arguments='-Q -s') +if('CCFLAGS=/nologo' not in test.stdout() + or 'CC=cl' not in test.stdout()): + test.fail_test() + +# make sure windows msvc doesnt add bad mingw flags +# and that gcc is selected +test.write('SConstruct',""" +env=Environment(tools=['default', 'mingw']) +print('CCFLAGS="' + str(env['CCFLAGS']).strip() + '"') +print('CC=' + str(env['CC']).strip()) +""") +test.run(arguments='-Q -s') +if('CCFLAGS=""' not in test.stdout() + or 'CC=gcc' not in test.stdout()): + test.fail_test() + +# msvc should overwrite the flags and use cl +test.write('SConstruct',""" +env=Environment(tools=['mingw', 'default']) +print('CCFLAGS=' + str(env['CCFLAGS']).strip()) +print('CC=' + str(env['CC']).strip()) +""") +test.run(arguments='-Q -s') +if('CCFLAGS=/nologo' not in test.stdout() + or 'CC=cl' not in test.stdout()): + test.fail_test() + +# test that CCFLAGS are preserved +test.write('SConstruct',""" +env=Environment(tools=['mingw'], CCFLAGS='-myflag') +print(env['CCFLAGS']) +""") +test.run(arguments='-Q -s') +if '-myflag' not in test.stdout(): + test.fail_test() + +# test that it handles a list +test.write('SConstruct',""" +env=Environment(tools=['mingw'], CCFLAGS=['-myflag', '-myflag2']) +print(str(env['CCFLAGS'])) +""") +test.run(arguments='-Q -s') +if "['-myflag', '-myflag2']" not in test.stdout(): + test.fail_test() + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: -- cgit v0.12 From de01f7ea3cd258c893e1262800b96dd85ae89133 Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Fri, 8 Feb 2019 09:45:15 -0700 Subject: Add textfile tool to defaults PR #3242 added the Textfile and Substfile builders to the default builder list (for issue #3147), but didn't finish the job: the textfile tool needs to be added to the default list of tools as well. This time with a testcase that fails if the tool is not added. Minor doc tweak. Signed-off-by: Mats Wichmann --- doc/generated/builders.gen | 4 ++-- doc/generated/functions.gen | 4 ++++ src/CHANGES.txt | 1 + src/engine/SCons/Tool/__init__.py | 2 ++ src/engine/SCons/Tool/textfile.xml | 4 ++-- test/textfile.py | 4 +++- 6 files changed, 14 insertions(+), 5 deletions(-) diff --git a/doc/generated/builders.gen b/doc/generated/builders.gen index 6f03cd3..dc05443 100644 --- a/doc/generated/builders.gen +++ b/doc/generated/builders.gen @@ -2377,7 +2377,7 @@ and the result replaces the key. -env = Environment(tools = ['default', 'textfile']) +env = Environment(tools=['default']) env['prefix'] = '/usr/bin' script_dict = {'@prefix@': '/bin', '@exec_prefix@': '$prefix'} @@ -2404,7 +2404,7 @@ env.Substfile('bar.in', SUBST_DICT = good_bar) # the SUBST_DICT may be in common (and not an override) substutions = {} -subst = Environment(tools = ['textfile'], SUBST_DICT = substitutions) +subst = Environment(tools=['textfile'], SUBST_DICT=substitutions) substitutions['@foo@'] = 'foo' subst['SUBST_DICT']['@bar@'] = 'bar' subst.Substfile('pgm1.c', [Value('#include "@foo@.h"'), diff --git a/doc/generated/functions.gen b/doc/generated/functions.gen index 617a0a4..9fc9d4b 100644 --- a/doc/generated/functions.gen +++ b/doc/generated/functions.gen @@ -1197,6 +1197,10 @@ Multiple calls to Default are legal, and add to the list of default targets. +As noted above, both forms of this call affect the +same global list of default targets; the +construction environment method applies +construction variable expansion to the targets. diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 8bdafe7..654b58c 100755 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -23,6 +23,7 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER From Mats Wichmann: - Quiet open file ResourceWarnings on Python >= 3.6 caused by not using a context manager around Popen.stdout + - Add the textfile tool to the default tool list RELEASE 3.0.4 - Mon, 20 Jan 2019 22:49:27 +0000 diff --git a/src/engine/SCons/Tool/__init__.py b/src/engine/SCons/Tool/__init__.py index f3f0630..74dba75 100644 --- a/src/engine/SCons/Tool/__init__.py +++ b/src/engine/SCons/Tool/__init__.py @@ -1305,6 +1305,8 @@ def tool_list(platform, env): 'tex', 'latex', 'pdflatex', 'pdftex', # Archivers 'tar', 'zip', + # File builders (text) + 'textfile', ], env) tools = ([linker, c_compiler, cxx_compiler, diff --git a/src/engine/SCons/Tool/textfile.xml b/src/engine/SCons/Tool/textfile.xml index 08bbb76..3b4a038 100644 --- a/src/engine/SCons/Tool/textfile.xml +++ b/src/engine/SCons/Tool/textfile.xml @@ -147,7 +147,7 @@ and the result replaces the key. -env = Environment(tools = ['default', 'textfile']) +env = Environment(tools=['default']) env['prefix'] = '/usr/bin' script_dict = {'@prefix@': '/bin', '@exec_prefix@': '$prefix'} @@ -174,7 +174,7 @@ env.Substfile('bar.in', SUBST_DICT = good_bar) # the SUBST_DICT may be in common (and not an override) substutions = {} -subst = Environment(tools = ['textfile'], SUBST_DICT = substitutions) +subst = Environment(tools=['textfile'], SUBST_DICT=substitutions) substitutions['@foo@'] = 'foo' subst['SUBST_DICT']['@bar@'] = 'bar' subst.Substfile('pgm1.c', [Value('#include "@foo@.h"'), diff --git a/test/textfile.py b/test/textfile.py index 46eee34..1d5b3c7 100644 --- a/test/textfile.py +++ b/test/textfile.py @@ -115,6 +115,8 @@ test.write('foo2a.txt', foo2aText) test.write('bar2a.txt', foo2aText) check_times() +# now that textfile is part of default tool list, run one testcase +# without adding it explicitly as a tool to make sure. test.write('SConstruct', """ textlist = ['This line has no substitutions', 'This line has @subst@ substitutions', @@ -125,7 +127,7 @@ sub1 = { '@subst@' : 'most' } sub2 = { '%subst%' : 'many' } sub3 = { '@subst@' : 'most' , '%subst%' : 'many' } -env = Environment(tools = ['textfile']) +env = Environment() t = env.Textfile('text', textlist) # no substitutions -- cgit v0.12 From 583fc95f22008f33600c8e76fe23d14a8913f170 Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Fri, 8 Feb 2019 10:16:03 -0700 Subject: Fix some more subprocess-unclosed-file warnings Following on to PR #3279 which cleaned up warnings for gcc, g++ and swig by using context managers, do the same for Windows vc. Signed-off-by: Mats Wichmann --- src/engine/SCons/Tool/MSCommon/common.py | 6 ++++-- src/engine/SCons/Tool/MSCommon/vc.py | 32 +++++++++++++++++--------------- 2 files changed, 21 insertions(+), 17 deletions(-) diff --git a/src/engine/SCons/Tool/MSCommon/common.py b/src/engine/SCons/Tool/MSCommon/common.py index f7c07b2..6201ba0 100644 --- a/src/engine/SCons/Tool/MSCommon/common.py +++ b/src/engine/SCons/Tool/MSCommon/common.py @@ -188,8 +188,10 @@ def get_output(vcbat, args = None, env = None): # Use the .stdout and .stderr attributes directly because the # .communicate() method uses the threading module on Windows # and won't work under Pythons not built with threading. - stdout = popen.stdout.read() - stderr = popen.stderr.read() + with popen.stdout: + stdout = popen.stdout.read() + with popen.stderr: + stderr = popen.stderr.read() # Extra debug logic, uncomment if necessary # debug('get_output():stdout:%s'%stdout) diff --git a/src/engine/SCons/Tool/MSCommon/vc.py b/src/engine/SCons/Tool/MSCommon/vc.py index 0393885..adc3d94 100644 --- a/src/engine/SCons/Tool/MSCommon/vc.py +++ b/src/engine/SCons/Tool/MSCommon/vc.py @@ -88,7 +88,7 @@ _ARCH_TO_CANONICAL = { "arm64" : "arm64", "aarch64" : "arm64", } - + # get path to the cl.exe dir for newer VS versions # based off a tuple of (host, target) platforms _HOST_TARGET_TO_CL_DIR_GREATER_THAN_14 = { @@ -135,8 +135,8 @@ _HOST_TARGET_ARCH_TO_BAT_ARCH = { _CL_EXE_NAME = 'cl.exe' def get_msvc_version_numeric(msvc_version): - """Get the raw version numbers from a MSVC_VERSION string, so it - could be cast to float or other numeric values. For example, '14.0Exp' + """Get the raw version numbers from a MSVC_VERSION string, so it + could be cast to float or other numeric values. For example, '14.0Exp' would get converted to '14.0'. Args: @@ -296,8 +296,10 @@ def find_vc_pdir_vswhere(msvc_version): vswhere_cmd = [vswhere_path, '-products', '*', '-version', msvc_version, '-property', 'installationPath'] if os.path.exists(vswhere_path): - sp = subprocess.Popen(vswhere_cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - vsdir, err = sp.communicate() + with subprocess.Popen(vswhere_cmd, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE) as sp: + vsdir, err = sp.communicate() if vsdir: vsdir = vsdir.decode("mbcs").splitlines() # vswhere could easily return multiple lines @@ -415,15 +417,15 @@ def find_batch_file(env,msvc_version,host_arch,target_arch): __INSTALLED_VCS_RUN = None def _check_cl_exists_in_vc_dir(env, vc_dir, msvc_version): - """Find the cl.exe on the filesystem in the vc_dir depending on - TARGET_ARCH, HOST_ARCH and the msvc version. TARGET_ARCH and - HOST_ARCH can be extracted from the passed env, unless its None, + """Find the cl.exe on the filesystem in the vc_dir depending on + TARGET_ARCH, HOST_ARCH and the msvc version. TARGET_ARCH and + HOST_ARCH can be extracted from the passed env, unless its None, which then the native platform is assumed the host and target. Args: env: Environment a construction environment, usually if this is passed its - because there is a desired TARGET_ARCH to be used when searching + because there is a desired TARGET_ARCH to be used when searching for a cl.exe vc_dir: str the path to the VC dir in the MSVC installation @@ -434,7 +436,7 @@ def _check_cl_exists_in_vc_dir(env, vc_dir, msvc_version): bool: """ - + # determine if there is a specific target platform we want to build for and # use that to find a list of valid VCs, default is host platform == target platform # and same for if no env is specified to extract target platform from @@ -460,7 +462,7 @@ def _check_cl_exists_in_vc_dir(env, vc_dir, msvc_version): try: with open(default_toolset_file) as f: vc_specific_version = f.readlines()[0].strip() - except IOError: + except IOError: debug('_check_cl_exists_in_vc_dir(): failed to read ' + default_toolset_file) return False except IndexError: @@ -484,14 +486,14 @@ def _check_cl_exists_in_vc_dir(env, vc_dir, msvc_version): if not host_trgt_dir: debug('_check_cl_exists_in_vc_dir(): unsupported host/target platform combo') return False - + cl_path = os.path.join(vc_dir, 'bin', host_trgt_dir, _CL_EXE_NAME) debug('_check_cl_exists_in_vc_dir(): checking for ' + _CL_EXE_NAME + ' at ' + cl_path) cl_path_exists = os.path.exists(cl_path) if not cl_path_exists and host_platform == 'amd64': - # older versions of visual studio only had x86 binaries, - # so if the host platform is amd64, we need to check cross + # older versions of visual studio only had x86 binaries, + # so if the host platform is amd64, we need to check cross # compile options (x86 binary compiles some other target on a 64 bit os) host_trgt_dir = _HOST_TARGET_TO_CL_DIR.get(('x86', target_platform), None) if not host_trgt_dir: @@ -515,7 +517,7 @@ def _check_cl_exists_in_vc_dir(env, vc_dir, msvc_version): else: # version not support return false debug('_check_cl_exists_in_vc_dir(): unsupported MSVC version: ' + str(ver_num)) - + return False def cached_get_installed_vcs(env=None): -- cgit v0.12 From 71ef2d3ae2755b706412c12b1b9d1f9a20046e0c Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Fri, 8 Feb 2019 11:04:13 -0700 Subject: Remove examples directory, it moved to scons-examples tree Signed-off-by: Mats Wichmann --- examples/ipk_packaging/SConstruct | 15 --------------- examples/ipk_packaging/main.c | 4 ---- examples/msi_packaging/README | 1 - examples/msi_packaging/SConstruct | 19 ------------------- examples/msi_packaging/helloworld.dll | 1 - examples/msi_packaging/main.exe | 1 - examples/rpm_packaging/international/SConstruct | 25 ------------------------- examples/rpm_packaging/international/main.c | 4 ---- examples/rpm_packaging/simple/SConstruct | 20 -------------------- examples/rpm_packaging/simple/main.c | 4 ---- examples/src_packaging/SConstruct | 11 ----------- examples/src_packaging/src/foobar.c | 0 examples/src_packaging/src/foobar.h | 0 13 files changed, 105 deletions(-) delete mode 100644 examples/ipk_packaging/SConstruct delete mode 100644 examples/ipk_packaging/main.c delete mode 100644 examples/msi_packaging/README delete mode 100644 examples/msi_packaging/SConstruct delete mode 100644 examples/msi_packaging/helloworld.dll delete mode 100644 examples/msi_packaging/main.exe delete mode 100644 examples/rpm_packaging/international/SConstruct delete mode 100644 examples/rpm_packaging/international/main.c delete mode 100644 examples/rpm_packaging/simple/SConstruct delete mode 100644 examples/rpm_packaging/simple/main.c delete mode 100644 examples/src_packaging/SConstruct delete mode 100644 examples/src_packaging/src/foobar.c delete mode 100644 examples/src_packaging/src/foobar.h diff --git a/examples/ipk_packaging/SConstruct b/examples/ipk_packaging/SConstruct deleted file mode 100644 index c8c54eb..0000000 --- a/examples/ipk_packaging/SConstruct +++ /dev/null @@ -1,15 +0,0 @@ -prog = Install( '/bin/', Program( 'main.c') ) - -Package( projectname = 'foo', - version = '1.2.3', - architecture = 'arm', - x_ipk_maintainer = 'user ', - x_ipk_priority = 'optional', - source_url = 'http://ftp.gnu.org/foo-1.2.3.tar.gz', - x_ipk_depends = 'libc6, grep', - type = 'ipk', - summary = 'bla bla bla', - x_ipk_section = 'extras', - description = 'this should be reallly really long', - source = [ prog ], - ) diff --git a/examples/ipk_packaging/main.c b/examples/ipk_packaging/main.c deleted file mode 100644 index 5940dd6..0000000 --- a/examples/ipk_packaging/main.c +++ /dev/null @@ -1,4 +0,0 @@ -int main( int argc, char *argv[] ) -{ - return 0; -} diff --git a/examples/msi_packaging/README b/examples/msi_packaging/README deleted file mode 100644 index 2e54e70..0000000 --- a/examples/msi_packaging/README +++ /dev/null @@ -1 +0,0 @@ -This is the README file. diff --git a/examples/msi_packaging/SConstruct b/examples/msi_packaging/SConstruct deleted file mode 100644 index cabe70e..0000000 --- a/examples/msi_packaging/SConstruct +++ /dev/null @@ -1,19 +0,0 @@ -# -# Build a minimal msi installer with two features. -# - -f1 = Install( '/bin/', File('main.exe') ) -f2 = Install( '/lib/', File('helloworld.dll') ) -f3 = Install( '/doc/', File('README') ) - -Tag( f2, x_msi_feature = 'Resuable Components' ) -Tag( f3, 'doc' ) - -Package( projectname = 'helloworld', - version = '1.0', - packageversion = '1', - license = 'gpl', - type = 'msi', - vendor = 'Nanosoft', - summary = 'A HelloWorld implementation', - source = [ f1, f2, f3 ], ) diff --git a/examples/msi_packaging/helloworld.dll b/examples/msi_packaging/helloworld.dll deleted file mode 100644 index 1404bcf..0000000 --- a/examples/msi_packaging/helloworld.dll +++ /dev/null @@ -1 +0,0 @@ -a fake .dll diff --git a/examples/msi_packaging/main.exe b/examples/msi_packaging/main.exe deleted file mode 100644 index 36c366c..0000000 --- a/examples/msi_packaging/main.exe +++ /dev/null @@ -1 +0,0 @@ -a fake .exe diff --git a/examples/rpm_packaging/international/SConstruct b/examples/rpm_packaging/international/SConstruct deleted file mode 100644 index 0d14932..0000000 --- a/examples/rpm_packaging/international/SConstruct +++ /dev/null @@ -1,25 +0,0 @@ -# coding: utf-8 -import os - -prog_install = Install( os.path.join( ARGUMENTS.get('prefix', '/'), 'bin'), Program( 'main.c' ) ) -Tag( prog_install, unix_attr='(0755, root, users)' ) - -Default( Package( projectname = 'foo', - version = '1.2.3', - type = 'rpm', - license = 'gpl', - summary = 'hello', - summary_de = 'hallo', - summary_fr = 'bonjour', - packageversion = 0, - x_rpm_Group = 'Application/office', - x_rpm_Group_de = 'Applikation/büro', - x_rpm_Group_fr = 'Application/bureau', - description = 'this should be really long', - description_de = 'das sollte wirklich lang sein', - description_fr = 'ceci devrait être vraiment long', - source = [ prog_install ], - source_url = 'http://foo.org/foo-1.2.3.tar.gz', - ) ) - -Alias ( 'install', prog_install ) diff --git a/examples/rpm_packaging/international/main.c b/examples/rpm_packaging/international/main.c deleted file mode 100644 index 5940dd6..0000000 --- a/examples/rpm_packaging/international/main.c +++ /dev/null @@ -1,4 +0,0 @@ -int main( int argc, char *argv[] ) -{ - return 0; -} diff --git a/examples/rpm_packaging/simple/SConstruct b/examples/rpm_packaging/simple/SConstruct deleted file mode 100644 index 77c9d9b..0000000 --- a/examples/rpm_packaging/simple/SConstruct +++ /dev/null @@ -1,20 +0,0 @@ -import os - -install_dir = os.path.join( ARGUMENTS.get('prefix', '/'), 'bin/' ) -prog_install = Install( install_dir , Program( 'main.c') ) - -Tag( prog_install, unix_attr = '(0755, root, users)' ) - -Package( projectname = 'foo', - version = '1.2.3', - type = 'rpm', - license = 'gpl', - summary = 'bla bla bla', - packageversion = 0, - x_rpm_Group = 'Application/office', - description = 'this should be reallly really long', - source_url = 'http://foo.org/foo-1.2.3.tar.gz', - source = [ prog_install ], - ) - -Alias( 'install', prog_install ) diff --git a/examples/rpm_packaging/simple/main.c b/examples/rpm_packaging/simple/main.c deleted file mode 100644 index 5940dd6..0000000 --- a/examples/rpm_packaging/simple/main.c +++ /dev/null @@ -1,4 +0,0 @@ -int main( int argc, char *argv[] ) -{ - return 0; -} diff --git a/examples/src_packaging/SConstruct b/examples/src_packaging/SConstruct deleted file mode 100644 index 1e662af..0000000 --- a/examples/src_packaging/SConstruct +++ /dev/null @@ -1,11 +0,0 @@ -from glob import glob - -src_files = glob( 'src/*.c' ) -include_files = glob( 'src/*.h' ) - -SharedLibrary( 'foobar', src_files ) - -Package( projectname = 'libfoobar', - version = '1.2.3', - type = [ 'src_zip', 'src_targz', 'src_tarbz2' ], - source = FindSourceFiles() ) diff --git a/examples/src_packaging/src/foobar.c b/examples/src_packaging/src/foobar.c deleted file mode 100644 index e69de29..0000000 diff --git a/examples/src_packaging/src/foobar.h b/examples/src_packaging/src/foobar.h deleted file mode 100644 index e69de29..0000000 -- cgit v0.12 From 991594aa3163bec5d247437a2e5b51d95fbd376c Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Sat, 9 Feb 2019 14:09:33 -0700 Subject: Undo part of the windows context manager change Popen is not a context manager for PY27, lots of tests failed as a result. Signed-off-by: Mats Wichmann --- src/engine/SCons/Tool/MSCommon/vc.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/engine/SCons/Tool/MSCommon/vc.py b/src/engine/SCons/Tool/MSCommon/vc.py index adc3d94..4574043 100644 --- a/src/engine/SCons/Tool/MSCommon/vc.py +++ b/src/engine/SCons/Tool/MSCommon/vc.py @@ -296,10 +296,12 @@ def find_vc_pdir_vswhere(msvc_version): vswhere_cmd = [vswhere_path, '-products', '*', '-version', msvc_version, '-property', 'installationPath'] if os.path.exists(vswhere_path): - with subprocess.Popen(vswhere_cmd, + #TODO PY27 cannot use Popen as context manager + # try putting it back to the old way for now + sp = subprocess.Popen(vswhere_cmd, stdout=subprocess.PIPE, - stderr=subprocess.PIPE) as sp: - vsdir, err = sp.communicate() + stderr=subprocess.PIPE) + vsdir, err = sp.communicate() if vsdir: vsdir = vsdir.decode("mbcs").splitlines() # vswhere could easily return multiple lines -- cgit v0.12 From 9ce611599422e83c371b236440da3d6a87712b87 Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Sun, 10 Feb 2019 08:12:33 -0700 Subject: Fix syntax error from reverting popen context mgr Signed-off-by: Mats Wichmann --- src/engine/SCons/Tool/MSCommon/vc.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/engine/SCons/Tool/MSCommon/vc.py b/src/engine/SCons/Tool/MSCommon/vc.py index 4574043..ea053cb 100644 --- a/src/engine/SCons/Tool/MSCommon/vc.py +++ b/src/engine/SCons/Tool/MSCommon/vc.py @@ -296,9 +296,9 @@ def find_vc_pdir_vswhere(msvc_version): vswhere_cmd = [vswhere_path, '-products', '*', '-version', msvc_version, '-property', 'installationPath'] if os.path.exists(vswhere_path): - #TODO PY27 cannot use Popen as context manager - # try putting it back to the old way for now - sp = subprocess.Popen(vswhere_cmd, + #TODO PY27 cannot use Popen as context manager + # try putting it back to the old way for now + sp = subprocess.Popen(vswhere_cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) vsdir, err = sp.communicate() -- cgit v0.12 From 325bf16d681320cc277fb65c873cae2e0a2cb46c Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Mon, 11 Feb 2019 10:13:15 -0700 Subject: Fix is/is not syntax In a few places, "is" and "is not" are used to compare with a string or integer literal. Python 3.8 flags these with a SyntaxWarning. Changed to == and != Signed-off-by: Mats Wichmann --- src/CHANGES.txt | 1 + src/engine/SCons/ActionTests.py | 8 ++++---- src/engine/SCons/Defaults.py | 2 +- src/engine/SCons/EnvironmentTests.py | 12 ++++++------ test/MSVC/TARGET_ARCH.py | 4 ++-- testing/framework/TestCmd.py | 2 +- 6 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 654b58c..4acfcba 100755 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -24,6 +24,7 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER - Quiet open file ResourceWarnings on Python >= 3.6 caused by not using a context manager around Popen.stdout - Add the textfile tool to the default tool list + - Fix syntax on is/is not cluases: should not use with a literal RELEASE 3.0.4 - Mon, 20 Jan 2019 22:49:27 +0000 diff --git a/src/engine/SCons/ActionTests.py b/src/engine/SCons/ActionTests.py index a27f598..3e83b50 100644 --- a/src/engine/SCons/ActionTests.py +++ b/src/engine/SCons/ActionTests.py @@ -490,7 +490,7 @@ class _ActionActionTestCase(unittest.TestCase): a = SCons.Action._ActionAction(cmdstr='cmdstr') assert not hasattr(a, 'strfunction') - assert a.cmdstr is 'cmdstr', a.cmdstr + assert a.cmdstr == 'cmdstr', a.cmdstr a = SCons.Action._ActionAction(cmdstr=None) assert not hasattr(a, 'strfunction') @@ -504,7 +504,7 @@ class _ActionActionTestCase(unittest.TestCase): assert a.presub is func1, a.presub a = SCons.Action._ActionAction(chdir=1) - assert a.chdir is 1, a.chdir + assert a.chdir == 1, a.chdir a = SCons.Action._ActionAction(exitstatfunc=func1) assert a.exitstatfunc is func1, a.exitstatfunc @@ -518,8 +518,8 @@ class _ActionActionTestCase(unittest.TestCase): strfunction=func1, varlist=t, ) - assert a.chdir is 'x', a.chdir - assert a.cmdstr is 'cmdstr', a.cmdstr + assert a.chdir == 'x', a.chdir + assert a.cmdstr == 'cmdstr', a.cmdstr assert a.exitstatfunc is func3, a.exitstatfunc assert a.presub is func2, a.presub assert a.strfunction is func1, a.strfunction diff --git a/src/engine/SCons/Defaults.py b/src/engine/SCons/Defaults.py index 6b07750..9ca9ccd 100644 --- a/src/engine/SCons/Defaults.py +++ b/src/engine/SCons/Defaults.py @@ -210,7 +210,7 @@ def chmod_func(dest, mode): else: raise SyntaxError("Could not find +, - or =") operation_list = operation.split(operator) - if len(operation_list) is not 2: + if len(operation_list) != 2: raise SyntaxError("More than one operator found") user = operation_list[0].strip().replace("a", "ugo") permission = operation_list[1].strip() diff --git a/src/engine/SCons/EnvironmentTests.py b/src/engine/SCons/EnvironmentTests.py index a72c173..2525e0f 100644 --- a/src/engine/SCons/EnvironmentTests.py +++ b/src/engine/SCons/EnvironmentTests.py @@ -963,7 +963,7 @@ class BaseTestCase(unittest.TestCase,TestEnvironmentFixture): self.assertRaises(AttributeError, getattr, bw, 'foobar') bw.foobar = 42 - assert bw.foobar is 42 + assert bw.foobar == 42 # This unit test is currently disabled because we don't think the # underlying method it tests (Environment.BuilderWrapper.execute()) @@ -1777,15 +1777,15 @@ def exists(env): env2 = env1.Clone() env3 = env1.Clone(tools=[bar, baz]) - assert env1.get('FOO') is 1 + assert env1.get('FOO') == 1 assert env1.get('BAR') is None assert env1.get('BAZ') is None - assert env2.get('FOO') is 1 + assert env2.get('FOO') == 1 assert env2.get('BAR') is None assert env2.get('BAZ') is None - assert env3.get('FOO') is 1 - assert env3.get('BAR') is 2 - assert env3.get('BAZ') is 3 + assert env3.get('FOO') == 1 + assert env3.get('BAR') == 2 + assert env3.get('BAZ') == 3 # Ensure that recursive variable substitution when copying # environments works properly. diff --git a/test/MSVC/TARGET_ARCH.py b/test/MSVC/TARGET_ARCH.py index a960bd8..009909e 100644 --- a/test/MSVC/TARGET_ARCH.py +++ b/test/MSVC/TARGET_ARCH.py @@ -63,7 +63,7 @@ if env.Detect('cl'): env.Command('checkarm', [], 'cl') """ % locals()) test.run(arguments = ".", stderr = None) -if test.stderr().strip() is not "" and "ARM" not in test.stderr(): +if test.stderr().strip() != "" and "ARM" not in test.stderr(): test.fail_test() test.write('SConstruct', """ @@ -73,7 +73,7 @@ if env.Detect('cl'): env.Command('checkarm64', [], 'cl') """ % locals()) test.run(arguments = ".", stderr = None) -if test.stderr().strip() is not "" and "ARM64" not in test.stderr(): +if test.stderr().strip() != "" and "ARM64" not in test.stderr(): test.fail_test() test.pass_test() diff --git a/testing/framework/TestCmd.py b/testing/framework/TestCmd.py index 35e3613..a6a8045 100644 --- a/testing/framework/TestCmd.py +++ b/testing/framework/TestCmd.py @@ -1227,7 +1227,7 @@ class TestCmd(object): the temporary working directories to be preserved for all conditions. """ - if conditions is (): + if not conditions: conditions = ('pass_test', 'fail_test', 'no_result') for cond in conditions: self._preserve[cond] = 1 -- cgit v0.12 From 334e11d04bb3be2f0ed93f929548e6cdc84c3158 Mon Sep 17 00:00:00 2001 From: William Deegan Date: Mon, 11 Feb 2019 19:18:20 -0500 Subject: restore dmoody's trimming of texlive install footprint --- .travis/install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis/install.sh b/.travis/install.sh index 15a36a3..c1a4d02 100755 --- a/.travis/install.sh +++ b/.travis/install.sh @@ -24,7 +24,7 @@ else # dependencies for docbook tests sudo apt-get -y install docbook-xml xsltproc libxml2-dev libxslt-dev fop docbook-xsl-doc-pdf # dependencies for latex tests - sudo apt-get -y install texlive-full biber texmaker + sudo apt-get -y install texlive texlive-latex3 biber texmaker # need some things for building dependencies for other tests sudo apt-get -y install python-pip python-dev build-essential libpcre3-dev autoconf automake libtool bison subversion git # dependencies for docbook tests continued -- cgit v0.12 From 887f4a1b06ceed33ee6ba4c5589a32a607d6b001 Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Thu, 14 Feb 2019 12:42:00 -0700 Subject: Clean up some tests: use context managers Plenty of complaints coming from Python 3.8alpha on unclosed files. Targeted those areas which intersect with PyPy failures - this changeset reduces the PyPy fails by 17 on the local test environment. So this affects both Issue #3299 and the PyPy support project. Signed-off-by: Mats Wichmann --- src/engine/SCons/ActionTests.py | 25 +++++++++------- src/engine/SCons/BuilderTests.py | 14 +++++---- src/engine/SCons/SConfTests.py | 6 ++-- src/engine/SCons/TaskmasterTests.py | 1 + src/engine/SCons/cppTests.py | 3 +- test/Batch/generated.py | 10 ++++--- test/CacheDir/NoCache.py | 3 +- test/Deprecated/TargetSignatures/build-content.py | 3 +- test/Fortran/link-with-cxx.py | 6 ++-- test/MSVC/generate-rc.py | 8 ++--- test/NodeOps.py | 3 +- test/Repository/Local.py | 6 ++-- test/Repository/option-c.py | 3 +- test/Requires/eval-order.py | 10 ++++--- test/Value.py | 10 +++++-- test/VariantDir/File-create.py | 6 ++-- test/chained-build.py | 6 ++-- test/implicit-cache/basic.py | 3 +- test/sconsign/nonwritable.py | 12 +++++--- testing/framework/TestSCons.py | 3 +- testing/framework/TestSCons_time.py | 36 +++++++++++++++++++---- 21 files changed, 119 insertions(+), 58 deletions(-) diff --git a/src/engine/SCons/ActionTests.py b/src/engine/SCons/ActionTests.py index 3e83b50..efe6e98 100644 --- a/src/engine/SCons/ActionTests.py +++ b/src/engine/SCons/ActionTests.py @@ -62,25 +62,28 @@ test = TestCmd.TestCmd(workdir='') test.write('act.py', """\ import os, string, sys -f = open(sys.argv[1], 'w') -f.write("act.py: '" + "' '".join(sys.argv[2:]) + "'\\n") -try: - if sys.argv[3]: - f.write("act.py: '" + os.environ[sys.argv[3]] + "'\\n") -except: - pass -f.close() + +with open(sys.argv[1], 'w') as f: + f.write("act.py: '" + "' '".join(sys.argv[2:]) + "'\\n") + try: + if sys.argv[3]: + f.write("act.py: '" + os.environ[sys.argv[3]] + "'\\n") + except: + pass + if 'ACTPY_PIPE' in os.environ: if 'PIPE_STDOUT_FILE' in os.environ: - stdout_msg = open(os.environ['PIPE_STDOUT_FILE'], 'r').read() + with open(os.environ['PIPE_STDOUT_FILE'], 'r') as f: + stdout_msg = f.read() else: stdout_msg = "act.py: stdout: executed act.py %s\\n" % ' '.join(sys.argv[1:]) sys.stdout.write( stdout_msg ) if 'PIPE_STDERR_FILE' in os.environ: - stderr_msg = open(os.environ['PIPE_STDERR_FILE'], 'r').read() + with open(os.environ['PIPE_STDERR_FILE'], 'r') as f: + stderr_msg = f.read() else: stderr_msg = "act.py: stderr: executed act.py %s\\n" % ' '.join(sys.argv[1:]) - sys.stderr.write( stderr_msg ) + sys.stderr.write(stderr_msg) sys.exit(0) """) diff --git a/src/engine/SCons/BuilderTests.py b/src/engine/SCons/BuilderTests.py index 1e544a1..c9068ed 100644 --- a/src/engine/SCons/BuilderTests.py +++ b/src/engine/SCons/BuilderTests.py @@ -680,7 +680,7 @@ class BuilderTestCase(unittest.TestCase): def test_single_source(self): """Test Builder with single_source flag set""" def func(target, source, env): - open(str(target[0]), "w") + open(str(target[0]), "w") # TODO: this just a throwaway? if (len(source) == 1 and len(target) == 1): env['CNT'][0] = env['CNT'][0] + 1 @@ -736,10 +736,12 @@ class BuilderTestCase(unittest.TestCase): """Testing handling lists of targets and source""" def function2(target, source, env, tlist = [outfile, outfile2], **kw): for t in target: - open(str(t), 'w').write("function2\n") + with open(str(t), 'w') as f: + f.write("function2\n") for t in tlist: if not t in list(map(str, target)): - open(t, 'w').write("function2\n") + with open(t, 'w') as f: + f.write("function2\n") return 1 env = Environment() @@ -765,10 +767,12 @@ class BuilderTestCase(unittest.TestCase): def function3(target, source, env, tlist = [sub1_out, sub2_out]): for t in target: - open(str(t), 'w').write("function3\n") + with open(str(t), 'w') as f: + f.write("function3\n") for t in tlist: if not t in list(map(str, target)): - open(t, 'w').write("function3\n") + with open(t, 'w') as f: + f.write("function3\n") return 1 builder = SCons.Builder.Builder(action = function3) diff --git a/src/engine/SCons/SConfTests.py b/src/engine/SCons/SConfTests.py index cf8a7fb..73fcf8d 100644 --- a/src/engine/SCons/SConfTests.py +++ b/src/engine/SCons/SConfTests.py @@ -298,12 +298,14 @@ int main(void) { """Test SConf.TryAction """ def actionOK(target, source, env): - open(str(target[0]), "w").write("RUN OK\n") + with open(str(target[0]), "w") as f: + f.write("RUN OK\n") return None def actionFAIL(target, source, env): return 1 def actionUnicode(target, source, env): - open(str(target[0]), "wb").write('2\302\242\n') + with open(str(target[0]), "wb") as f: + f.write('2\302\242\n') return None diff --git a/src/engine/SCons/TaskmasterTests.py b/src/engine/SCons/TaskmasterTests.py index 42ed00e..c0c77b0 100644 --- a/src/engine/SCons/TaskmasterTests.py +++ b/src/engine/SCons/TaskmasterTests.py @@ -1085,6 +1085,7 @@ class TaskmasterTestCase(unittest.TestCase): exception_values = [ "integer division or modulo", "integer division or modulo by zero", + "integer division by zero", # PyPy2 ] assert str(exc_value) in exception_values, exc_value diff --git a/src/engine/SCons/cppTests.py b/src/engine/SCons/cppTests.py index ebf7fde..0b346e8 100644 --- a/src/engine/SCons/cppTests.py +++ b/src/engine/SCons/cppTests.py @@ -817,7 +817,8 @@ class fileTestCase(unittest.TestCase): return '\n'.join(map(strip_spaces, lines)) def write(self, file, contents): - open(file, 'w').write(self.strip_initial_spaces(contents)) + with open(file, 'w') as f: + f.write(self.strip_initial_spaces(contents)) def test_basic(self): """Test basic file inclusion""" diff --git a/test/Batch/generated.py b/test/Batch/generated.py index 21b8250..65ce8a8 100644 --- a/test/Batch/generated.py +++ b/test/Batch/generated.py @@ -36,10 +36,12 @@ test = TestSCons.TestSCons() test.write('SConstruct', """ def batch_build(target, source, env): for t, s in zip(target, source): - fp = open(str(t), 'wb') - if str(t) == 'f3.out': - fp.write(open('f3.include', 'rb').read()) - fp.write(open(str(s), 'rb').read()) + with open(str(t), 'wb') as fp: + if str(t) == 'f3.out': + with open('f3.include', 'rb') as f: + fp.write(f.read()) + with open(str(s), 'rb') as f: + fp.write(f.read()) env = Environment() bb = Action(batch_build, batch_key=True) env['BUILDERS']['Batch'] = Builder(action=bb) diff --git a/test/CacheDir/NoCache.py b/test/CacheDir/NoCache.py index f0929aa..8ecfeb3 100644 --- a/test/CacheDir/NoCache.py +++ b/test/CacheDir/NoCache.py @@ -46,7 +46,8 @@ CacheDir(r'%s') g = '%s' def ActionWithUndeclaredInputs(target,source,env): - open(target[0].get_abspath(),'w').write(g) + with open(target[0].get_abspath(),'w') as f: + f.write(g) Command('foo_cached', [], ActionWithUndeclaredInputs) NoCache(Command('foo_notcached', [], ActionWithUndeclaredInputs)) diff --git a/test/Deprecated/TargetSignatures/build-content.py b/test/Deprecated/TargetSignatures/build-content.py index 6a5a8c4..efdaaee 100644 --- a/test/Deprecated/TargetSignatures/build-content.py +++ b/test/Deprecated/TargetSignatures/build-content.py @@ -47,7 +47,8 @@ SetOption('warn', 'deprecated-target-signatures') env = Environment() def copy1(env, source, target): - open(str(target[0]), 'wb').write(open(str(source[0]), 'rb').read()) + with open(str(target[0]), 'wb') as fo, open(str(source[0]), 'rb') as fi: + fo.write(fi.read()) def copy2(env, source, target): %s diff --git a/test/Fortran/link-with-cxx.py b/test/Fortran/link-with-cxx.py index a29558e..bf10fc8 100644 --- a/test/Fortran/link-with-cxx.py +++ b/test/Fortran/link-with-cxx.py @@ -48,7 +48,8 @@ elif sys.argv[1][:5] == '/OUT:': outfile = open(sys.argv[1][5:], 'wb') infiles = sys.argv[2:] for infile in infiles: - outfile.write(open(infile, 'rb').read()) + with open(infile, 'rb') as f: + outfile.write(f.read()) outfile.close() sys.exit(0) """) @@ -69,7 +70,8 @@ import SCons.Tool.link def copier(target, source, env): s = str(source[0]) t = str(target[0]) - open(t, 'wb').write(open(s, 'rb').read()) + with open(t, 'wb') as fo, open(s, 'rb') as fi: + fo.write(fi.read()) env = Environment(CXX = r'%(_python_)s test_linker.py', CXXCOM = Action(copier), SMARTLINK = SCons.Tool.link.smart_link, diff --git a/test/MSVC/generate-rc.py b/test/MSVC/generate-rc.py index 00e9090..3dd4331 100644 --- a/test/MSVC/generate-rc.py +++ b/test/MSVC/generate-rc.py @@ -39,16 +39,16 @@ fake_rc = test.workpath('fake_rc.py') test.write(fake_rc, """\ import sys -contents = open(sys.argv[2], 'r').read() -open(sys.argv[1], 'w').write("fake_rc.py\\n" + contents) +with open(sys.argv[1], 'w') as fo, open(sys.argv[2], 'r') as fi: + fo.write("fake_rc.py\\n" + fi.read()) """) test.write('SConstruct', """ def generate_rc(target, source, env): t = str(target[0]) s = str(source[0]) - tfp = open(t, 'w') - tfp.write('generate_rc\\n' + open(s, 'r').read()) + with open(t, 'w') as fo, open(s, 'r') as fi: + fo.write('generate_rc\\n' + fi.read()) env = Environment(tools=['msvc'], RCCOM=r'%(_python_)s %(fake_rc)s $TARGET $SOURCE') diff --git a/test/NodeOps.py b/test/NodeOps.py index 1f856c3..99a3f6a 100644 --- a/test/NodeOps.py +++ b/test/NodeOps.py @@ -122,7 +122,8 @@ import os Import('*') def mycopy(env, source, target): - open(str(target[0]),'w').write(open(str(source[0]),'r').read()) + with open(str(target[0]), 'wt') as fo, open(str(source[0]), 'rt') as fi: + fo.write(fi.read()) def exists_test(node): before = os.path.exists(str(node)) # doesn't exist yet in VariantDir diff --git a/test/Repository/Local.py b/test/Repository/Local.py index 95fd898..7062075 100644 --- a/test/Repository/Local.py +++ b/test/Repository/Local.py @@ -49,7 +49,8 @@ def copy(env, source, target): source = str(source[0]) target = str(target[0]) print('copy() < %s > %s' % (source, target)) - open(target, "w").write(open(source, "r").read()) + with open(target, 'w') as fo, open(source, 'r') as fi: + fo.write(fi.read()) Build = Builder(action=copy) env = Environment(BUILDERS={'Build':Build}, BBB='bbb') @@ -66,7 +67,8 @@ test.write(['repository', 'src', 'SConscript'], r""" def bbb_copy(env, source, target): target = str(target[0]) print('bbb_copy()') - open(target, "w").write(open('build/bbb.1', "r").read()) + with open(target, 'w') as fo, open('build/bbb.1', 'r') as fi: + fo.write(fi.read()) Import("env") env.Build('bbb.1', 'bbb.0') diff --git a/test/Repository/option-c.py b/test/Repository/option-c.py index b0d8533..58c4876 100644 --- a/test/Repository/option-c.py +++ b/test/Repository/option-c.py @@ -66,7 +66,8 @@ def copy(env, source, target): source = str(source[0]) target = str(target[0]) print('copy() < %s > %s' % (source, target)) - open(target, "w").write(open(source, "r").read()) + with open(target, 'w') as fo, open(source, 'r') as fi: + fo.write(fi.read()) Build = Builder(action=copy) env = Environment(BUILDERS={'Build':Build}) diff --git a/test/Requires/eval-order.py b/test/Requires/eval-order.py index 696b5e9..77fbc98 100644 --- a/test/Requires/eval-order.py +++ b/test/Requires/eval-order.py @@ -34,11 +34,13 @@ test = TestSCons.TestSCons() test.write('SConstruct', """ def copy_and_create_func(target, source, env): - fp = open(str(target[0]), 'w') - for s in source: - fp.write(open(str(s), 'r').read()) - fp.close() + with open(str(target[0]), 'w') as fp: + for s in source: + with open(str(s), 'r') as f: + fp.write(f.read()) open('file.in', 'w').write("file.in 1\\n") + with open('file.in', 'w') as f: + f.write("file.in 1\\n") return None copy_and_create = Action(copy_and_create_func) env = Environment() diff --git a/test/Value.py b/test/Value.py index 34b036b..5a6a48e 100644 --- a/test/Value.py +++ b/test/Value.py @@ -48,7 +48,8 @@ L = len(P) C = Custom(P) def create(target, source, env): - open(str(target[0]), 'wb').write(source[0].get_contents()) + with open(str(target[0]), 'wb') as f: + f.write(source[0].get_contents()) env = Environment() env['BUILDERS']['B'] = Builder(action = create) @@ -62,7 +63,9 @@ def create_value (target, source, env): target[0].write(source[0].get_contents()) def create_value_file (target, source, env): - open(str(target[0]), 'wb').write(source[0].read()) + #open(str(target[0]), 'wb').write(source[0].read()) + with open(str(target[0]), 'wb') as f: + f.write(source[0].read()) env['BUILDERS']['B2'] = Builder(action = create_value) env['BUILDERS']['B3'] = Builder(action = create_value_file) @@ -75,7 +78,8 @@ env.B3('f5.out', V) test.write('put.py', """\ import os import sys -open(sys.argv[-1],'w').write(" ".join(sys.argv[1:-2])) +with open(sys.argv[-1],'w') as f: + f.write(" ".join(sys.argv[1:-2])) """) # Run all of the tests with both types of source signature diff --git a/test/VariantDir/File-create.py b/test/VariantDir/File-create.py index 25e6c09..ad9234b 100644 --- a/test/VariantDir/File-create.py +++ b/test/VariantDir/File-create.py @@ -49,12 +49,14 @@ SConscript('src/SConscript', variant_dir='build1', chdir=1, duplicate=1) test.write(['src', 'SConscript'], """\ #f1_in = File('f1.in') #Command('f1.out', f1_in, Copy('$TARGET', '$SOURCE')) -#open('f1.in', 'w').write("f1.in\\n") +#with open('f1.in', 'w') as f: +# f.write("f1.in\\n") f2_in = File('f2.in') str(f2_in) Command('f2.out', f2_in, Copy('$TARGET', '$SOURCE')) -open('f2.in', 'w').write("f2.in\\n") +with open('f2.in', 'w') as f: + f.write("f2.in\\n") """) test.run(arguments = '--tree=all .') diff --git a/test/chained-build.py b/test/chained-build.py index c3351e1..871a593 100644 --- a/test/chained-build.py +++ b/test/chained-build.py @@ -38,7 +38,8 @@ test.subdir('w1') SConstruct1_contents = """\ def build(env, target, source): - open(str(target[0]), 'wt').write(open(str(source[0]), 'rt').read()) + with open(str(target[0]), 'wt') as fo, open(str(source[0]), 'rt') as fi: + fo.write(fi.read()) env=Environment(BUILDERS={'B' : Builder(action=build)}) env.B('foo.mid', 'foo.in') @@ -46,7 +47,8 @@ env.B('foo.mid', 'foo.in') SConstruct2_contents = """\ def build(env, target, source): - open(str(target[0]), 'wt').write(open(str(source[0]), 'rt').read()) + with open(str(target[0]), 'wt') as fo, open(str(source[0]), 'rt') as fi: + fo.write(fi.read()) env=Environment(BUILDERS={'B' : Builder(action=build)}) env.B('foo.out', 'foo.mid') diff --git a/test/implicit-cache/basic.py b/test/implicit-cache/basic.py index b7cd984..c03a320 100644 --- a/test/implicit-cache/basic.py +++ b/test/implicit-cache/basic.py @@ -65,7 +65,8 @@ env = Environment(CPPPATH=['inc2', include]) SConscript('variant/SConscript', "env") def copy(target, source, env): - open(str(target[0]), 'wt').write(open(str(source[0]), 'rt').read()) + with open(str(target[0]), 'wt') as fo, open(str(source[0]), 'rt') as fi: + fo.write(fi.read()) nodep = env.Command('nodeps.c', 'nodeps.in', action=copy) env.Program('nodeps', 'nodeps.c') diff --git a/test/sconsign/nonwritable.py b/test/sconsign/nonwritable.py index 6f12f18..812a476 100644 --- a/test/sconsign/nonwritable.py +++ b/test/sconsign/nonwritable.py @@ -51,13 +51,15 @@ work2_sub3__sconsign = test.workpath('work2', 'sub3', '.sconsign') SConstruct_contents = """\ def build1(target, source, env): - open(str(target[0]), 'wb').write(open(str(source[0]), 'rb').read()) + with open(str(target[0]), 'wb') as fo, open(str(source[0]), 'rb') as fi: + fo.write(fi.read()) return None def build2(target, source, env): import os import os.path - open(str(target[0]), 'wb').write(open(str(source[0]), 'rb').read()) + with open(str(target[0]), 'wb') as fo, open(str(source[0]), 'rb') as fi: + fo.write(fi.read()) dir, file = os.path.split(str(target[0])) os.chmod(dir, 0o555) return None @@ -92,8 +94,10 @@ test.write(['work2', 'SConstruct'], SConstruct_contents) test.write(['work2', 'foo.in'], "work2/foo.in\n") -pickle.dump({}, open(work2_sub1__sconsign, 'wb'), 1) -pickle.dump({}, open(work2_sub2__sconsign, 'wb'), 1) +with open(work2_sub1__sconsign, 'wb') as p: + pickle.dump({}, p, 1) +with open(work2_sub2__sconsign, 'wb') as p: + pickle.dump({}, p, 1) os.chmod(work2_sub1__sconsign, 0o444) diff --git a/testing/framework/TestSCons.py b/testing/framework/TestSCons.py index 38ffd08..7fe48e8 100644 --- a/testing/framework/TestSCons.py +++ b/testing/framework/TestSCons.py @@ -920,7 +920,8 @@ for opt, arg in cmd_opts: else: opt_string = opt_string + ' ' + opt output.write("/* mymoc.py%s */\\n" % opt_string) for a in args: - contents = open(a, 'r').read() + with open(a, 'r') as f: + contents = f.read() a = a.replace('\\\\', '\\\\\\\\') subst = r'{ my_qt_symbol( "' + a + '\\\\n" ); }' if impl: diff --git a/testing/framework/TestSCons_time.py b/testing/framework/TestSCons_time.py index bc116ec..6299f51 100644 --- a/testing/framework/TestSCons_time.py +++ b/testing/framework/TestSCons_time.py @@ -24,8 +24,7 @@ from TestCommon import __all__ # some of the scons_time tests may need regex-based matching: from TestSCons import search_re, search_re_in_list -__all__.extend([ 'TestSCons_time', - ]) +__all__.extend(['TestSCons_time',]) SConstruct = """\ from __future__ import print_function @@ -37,25 +36,30 @@ scons_py = """\ #!/usr/bin/env python import os import sys + def write_args(fp, args): fp.write(args[0] + '\\n') for arg in args[1:]: fp.write(' ' + arg + '\\n') + write_args(sys.stdout, sys.argv) for arg in sys.argv[1:]: if arg[:10] == '--profile=': - profile = open(arg[10:], 'w') - profile.write('--profile\\n') - write_args(profile, sys.argv) + with open(arg[10:], 'w') as profile: + profile.write('--profile\\n') + write_args(profile, sys.argv) break sys.stdout.write('SCONS_LIB_DIR = ' + os.environ['SCONS_LIB_DIR'] + '\\n') -exec(open('SConstruct', 'r').read()) +with open('SConstruct', 'r') as f: + script = f.read() +exec(script) """ aegis_py = """\ #!/usr/bin/env python import os import sys + script_dir = 'src/script' if not os.path.exists(script_dir): os.makedirs(script_dir) @@ -68,6 +72,20 @@ svn_py = """\ #!/usr/bin/env python import os import sys + +dir = sys.argv[-1] +script_dir = dir + '/src/script' +os.makedirs(script_dir) +open(script_dir + '/scons.py', 'w').write( +r'''%s''') +""" % scons_py + + +git_py = """\ +#!/usr/bin/env python +import os +import sys + dir = sys.argv[-1] script_dir = dir + '/src/script' os.makedirs(script_dir) @@ -239,6 +257,12 @@ class TestSCons_time(TestCommon): os.chmod(name, 0o755) return name + def write_fake_git_py(self, name): + name = self.workpath(name) + self.write(name, git_py) + os.chmod(name, 0o755) + return name + def write_sample_directory(self, archive, dir, files): dir = self.workpath(dir) for name, content in files: -- cgit v0.12 From 62584f156d4e2fef72de4ac31d76f0f7d759624a Mon Sep 17 00:00:00 2001 From: William Deegan Date: Thu, 14 Feb 2019 20:20:19 -0800 Subject: Add ghostscript to travis config to ensure dvipdf is installed --- .travis/install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis/install.sh b/.travis/install.sh index c1a4d02..4f3cbae 100755 --- a/.travis/install.sh +++ b/.travis/install.sh @@ -24,7 +24,7 @@ else # dependencies for docbook tests sudo apt-get -y install docbook-xml xsltproc libxml2-dev libxslt-dev fop docbook-xsl-doc-pdf # dependencies for latex tests - sudo apt-get -y install texlive texlive-latex3 biber texmaker + sudo apt-get -y install texlive texlive-latex3 biber texmaker ghostscript # need some things for building dependencies for other tests sudo apt-get -y install python-pip python-dev build-essential libpcre3-dev autoconf automake libtool bison subversion git # dependencies for docbook tests continued -- cgit v0.12 From 9eb21f94e0490e8e7811f1033ea146acac0b7c34 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sat, 16 Feb 2019 11:10:29 -0600 Subject: update lex tool to find paths on windows --- src/CHANGES.txt | 5 +++-- src/engine/SCons/Tool/lex.py | 44 +++++++++++++++++++++++++++++++++++++++++--- test/LEX/live.py | 18 +++++++++++++----- 3 files changed, 57 insertions(+), 10 deletions(-) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 0d02ec0..bfea661 100755 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -19,6 +19,9 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER - Change the default for AppendENVPath to delete_existing=0, so path order will not be changed, unless explicitly set (Issue #3276) - Fixed bug which threw error when running SCons on windows system with no MSVC installed. + - Update link tool to convert target to node before accessing node member + - Update mingw tool to remove MSVC like nologo CCFLAG + - Update lex tool to work in mingw environments From Mats Wichmann: - Quiet open file ResourceWarnings on Python >= 3.6 caused by @@ -42,8 +45,6 @@ RELEASE 3.0.4 - Mon, 20 Jan 2019 22:49:27 +0000 Issues #3268 & Issue #3222 - Initial support for ARM targets with Visual Studio 2017 - Issue #3182 (You must set TARGET_ARCH for this to work) - Update TempFileMunge class to use PRINT_CMD_LINE_FUNC - - Update link tool to convert target to node before accessing node member - - Update mingw tool to remove MSVC like nologo CCFLAG From Tobias Herzog - Enhance cpp scanner regex logic to detect if/elif expressions without whitespaces but diff --git a/src/engine/SCons/Tool/lex.py b/src/engine/SCons/Tool/lex.py index 280c768..732c0da 100644 --- a/src/engine/SCons/Tool/lex.py +++ b/src/engine/SCons/Tool/lex.py @@ -34,10 +34,13 @@ selection method. __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import os.path +import sys import SCons.Action import SCons.Tool import SCons.Util +from SCons.Platform.mingw import MINGW_DEFAULT_PATHS +from SCons.Platform.cygwin import CYGWIN_DEFAULT_PATHS LexAction = SCons.Action.Action("$LEXCOM", "$LEXCOMSTR") @@ -64,10 +67,42 @@ def lexEmitter(target, source, env): target.append(fileName) return (target, source) +def get_lex_path(env, append_paths=False): + """ + Find the a path containing the lex or flex binaries. If a construction + environment is passed in then append the path to the ENV PATH. + """ + # save existing path to reset if we don't want to append any paths + envPath = env['ENV']['PATH'] + + lex = SCons.Tool.find_program_path(env, 'lex', default_paths=MINGW_DEFAULT_PATHS + CYGWIN_DEFAULT_PATHS ) + if lex: + if not append_paths: + env['ENV']['PATH'] = envPath + else: + lex_bin_dir = os.path.dirname(lex) + env.AppendENVPath('PATH', lex_bin_dir) + return lex + + flex = SCons.Tool.find_program_path(env, 'flex', default_paths=MINGW_DEFAULT_PATHS + CYGWIN_DEFAULT_PATHS ) + if flex: + if not append_paths: + env['ENV']['PATH'] = envPath + else: + flex_bin_dir = os.path.dirname(flex) + env.AppendENVPath('PATH', flex_bin_dir) + return flex + else: + SCons.Warnings.Warning('lex tool requested, but lex or flex binary not found in ENV PATH') + + def generate(env): """Add Builders and construction variables for lex to an Environment.""" c_file, cxx_file = SCons.Tool.createCFileBuilders(env) + if sys.platform == 'win32': + get_lex_path(env, append_paths=True) + # C c_file.add_action(".l", LexAction) c_file.add_emitter(".l", lexEmitter) @@ -82,13 +117,16 @@ def generate(env): # C++ cxx_file.add_action(".ll", LexAction) cxx_file.add_emitter(".ll", lexEmitter) - - env["LEX"] = env.Detect("flex") or "lex" + + env["LEX"] = env.Detect("flex") or "lex" env["LEXFLAGS"] = SCons.Util.CLVar("") env["LEXCOM"] = "$LEX $LEXFLAGS -t $SOURCES > $TARGET" def exists(env): - return env.Detect(["flex", "lex"]) + if sys.platform == 'win32': + return get_lex_path(env) + else: + return env.Detect(["flex", "lex"]) # Local Variables: # tab-width:4 diff --git a/test/LEX/live.py b/test/LEX/live.py index 3d697d5..853e97c 100644 --- a/test/LEX/live.py +++ b/test/LEX/live.py @@ -28,6 +28,8 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" Test LEX and LEXFLAGS with a live lex. """ +import sys + import TestSCons _exe = TestSCons._exe @@ -40,15 +42,24 @@ lex = test.where_is('lex') or test.where_is('flex') if not lex: test.skip_test('No lex or flex found; skipping test.\n') +tools = "'default'" +if sys.platform == 'win32': + # make sure mingw is installed on win32 + if not test.where_is('gcc'): + test.skip_test('No mingw on windows; skipping test.\n') + # lex on win32 has a dependencies on mingw for unix headers + # so add it as a tool to the environment. + tools += ", 'mingw'" test.file_fixture('wrapper.py') test.write('SConstruct', """ -foo = Environment() +foo = Environment(tools=[%(tools)s]) lex = foo.Dictionary('LEX') bar = Environment(LEX = r'%(_python_)s wrapper.py ' + lex, - LEXFLAGS = '-b') + LEXFLAGS = '-b', + tools=[%(tools)s]) foo.Program(target = 'foo', source = 'foo.l') bar.Program(target = 'bar', source = 'bar.l') """ % locals()) @@ -82,9 +93,6 @@ test.must_not_exist(test.workpath('lex.backup')) test.run(program = test.workpath('foo'), stdin = "a\n", stdout = "Afoo.lA\n") - - - test.run(arguments = 'bar' + _exe) test.must_match(test.workpath('wrapper.out'), "wrapper.py\n") -- cgit v0.12 From 2feb2f39ccd71cfd72f42c5f97eedbe23b5a5853 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sat, 16 Feb 2019 11:10:46 -0600 Subject: add check for tar before trying to run test --- test/packaging/multiple-packages-at-once.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/packaging/multiple-packages-at-once.py b/test/packaging/multiple-packages-at-once.py index 8c3f72d..3575996 100644 --- a/test/packaging/multiple-packages-at-once.py +++ b/test/packaging/multiple-packages-at-once.py @@ -38,10 +38,14 @@ python = TestSCons.python test = TestSCons.TestSCons() zip = test.detect('ZIP', 'zip') +tar = test.detect('TAR', 'tar') if not zip: test.skip_test('zip not found, skipping test\n') +if not tar: + test.skip_test('tar not found, skipping test\n') + test.subdir('src') test.write( [ 'src', 'main.c' ], r""" -- cgit v0.12 From 82b1c887016c044bf2437f3cfd34d56915d00574 Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Sat, 16 Feb 2019 16:13:12 -0700 Subject: Update a coupled of README files a bit. Signed-off-by: Mats Wichmann --- README-local | 57 +++++++++++++++++++++++++++++++++++++++++++++------------ README.rst | 26 +++++++++++++------------- 2 files changed, 58 insertions(+), 25 deletions(-) diff --git a/README-local b/README-local index 584234d..314d735 100644 --- a/README-local +++ b/README-local @@ -44,13 +44,14 @@ scons-local package, or any SCons package, at the SCons download page: EXECUTION REQUIREMENTS ====================== -Running SCons requires Python version 2.4 or later. There should be -no other dependencies or requirements to run SCons. +Running SCons requires either Python version 2.7.* or Python 3.5 or higher. +There should be no other dependencies or requirements to run SCons. The default SCons configuration assumes use of the Microsoft Visual C++ -compiler suite on WIN32 systems, and assumes a C compiler named 'cc', -a C++ compiler named 'c++', and a Fortran compiler named 'g77' (such -as found in the GNU C compiler suite) on any other type of system. +compiler suite on WIN32 systems (either through the Visual Studio +product, or through the separate Build Tools), and assumes a C compiler +named 'cc', a C++ compiler named 'c++', and a Fortran compiler named 'g77' +(such as found in the GNU Compiler Collection) on any other type of system. You may, of course, override these default values by appropriate configuration of Environment construction variables. @@ -157,14 +158,23 @@ available at: REPORTING BUGS ============== -You can report bugs either by following the "Tracker - Bugs" link -on the SCons project page: +The SCons project welcomes bug reports and feature requests. - http://sourceforge.net/projects/scons/ +Please make sure you send email with the problem or feature request to +the SCons users mailing list, which you can join via the link below: -or by sending mail to the SCons developers mailing list: + http://two.pairlist.net/mailman/listinfo/scons-users + +Once you have discussed your issue on the users mailing list and the +community has confirmed that it is either a new bug or a duplicate of an +existing bug, then please follow the instructions the community provides +to file a new bug or to add yourself to the CC list for an existing bug + +You can explore the list of existing bugs, which may include workarounds +for the problem you've run into, on GitHub: + + https://github.com/SCons/scons/issues - scons-devel@lists.sourceforge.net MAILING LISTS @@ -173,11 +183,34 @@ MAILING LISTS A mailing list for users of SCons is available. You may send questions or comments to the list at: - scons-users@lists.sourceforge.net + scons-users@scons.org You may subscribe to the scons-users mailing list at: - http://lists.sourceforge.net/lists/listinfo/scons-users + http://two.pairlist.net/mailman/listinfo/scons-users + +An active mailing list for developers of SCons is available. You may +send questions or comments to the list at: + + scons-dev@scons.org + +You may subscribe to the developer's mailing list using form on this page: + + http://two.pairlist.net/mailman/listinfo/scons-dev + +Subscription to the developer's mailing list is by approval. In practice, no +one is refused list membership, but we reserve the right to limit membership +in the future and/or weed out lurkers. + +There is also a low-volume mailing list available for announcements about +SCons. Subscribe by sending email to: + + announce-subscribe@scons.tigris.org + +There are other mailing lists available for SCons users, for notification of +SCons code changes, and for notification of updated bug reports and project +documents. Please see our mailing lists page for details. + FOR MORE INFORMATION diff --git a/README.rst b/README.rst index cffd4f3..ce6f68c 100755 --- a/README.rst +++ b/README.rst @@ -4,15 +4,15 @@ SCons - a software construction tool .. image:: https://img.shields.io/badge/IRC-scons-blue.svg :target: http://webchat.freenode.net/?channels=%23scons&uio=d4 :alt: IRC - + .. image:: https://img.shields.io/sourceforge/dm/scons.svg :target: https://sourceforge.net/projects/scons :alt: Sourceforge Monthly Downloads - + .. image:: https://img.shields.io/sourceforge/dt/scons.svg :target: https://sourceforge.net/projects/scons :alt: Sourceforge Total Downloads - + .. image:: https://travis-ci.org/SCons/scons.svg?branch=master :target: https://travis-ci.org/SCons/scons :alt: Travis CI build status @@ -20,7 +20,7 @@ SCons - a software construction tool .. image:: https://ci.appveyor.com/api/projects/status/github/SCons/scons?svg=true&branch=master :target: https://ci.appveyor.com/project/SCons/scons :alt: AppVeyor CI build Status - + .. image:: https://codecov.io/gh/SCons/scons/branch/master/graph/badge.svg :target: https://codecov.io/gh/SCons/scons :alt: CodeCov Coverage Status @@ -72,7 +72,7 @@ version at the SCons download page: Execution Requirements ====================== -Running SCons requires Python version 2.7.* and Python 3.5 or higher. +Running SCons requires either Python version 2.7.* or Python 3.5 or higher. There should be no other dependencies or requirements to run SCons. The default SCons configuration assumes use of the Microsoft Visual C++ @@ -680,22 +680,22 @@ Reporting Bugs The SCons project welcomes bug reports and feature requests. -Please make sure you send email with the problem or feature request to the SCons user's mailing list, -which you can join via the link below: +Please make sure you send email with the problem or feature request to +the SCons users mailing list, which you can join via the link below: http://two.pairlist.net/mailman/listinfo/scons-users -Once you have discussed your issue on the users mailing list and the community has confirmed that -it is either a new bug or a duplicate of an existing bug, then please follow the instructions the c -ommunity provides to file a new bug or to add yourself to the CC list for an existing bug +Once you have discussed your issue on the users mailing list and the +community has confirmed that it is either a new bug or a duplicate of an +existing bug, then please follow the instructions the community provides +to file a new bug or to add yourself to the CC list for an existing bug -You can explore the list of existing bugs, which may include workarounds for the problem you've -run into on GitHub Issues: +You can explore the list of existing bugs, which may include workarounds +for the problem you've run into on GitHub Issues: https://github.com/SCons/scons/issues - Mailing Lists ============= -- cgit v0.12 From 77560936fe38dccf1c4c46a2b41e3c5d4e3a0462 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sat, 16 Feb 2019 22:24:00 -0600 Subject: condensed and organized code --- src/engine/SCons/Tool/lex.py | 32 ++++++++++++-------------------- 1 file changed, 12 insertions(+), 20 deletions(-) diff --git a/src/engine/SCons/Tool/lex.py b/src/engine/SCons/Tool/lex.py index 732c0da..70c0c5f 100644 --- a/src/engine/SCons/Tool/lex.py +++ b/src/engine/SCons/Tool/lex.py @@ -74,26 +74,18 @@ def get_lex_path(env, append_paths=False): """ # save existing path to reset if we don't want to append any paths envPath = env['ENV']['PATH'] - - lex = SCons.Tool.find_program_path(env, 'lex', default_paths=MINGW_DEFAULT_PATHS + CYGWIN_DEFAULT_PATHS ) - if lex: - if not append_paths: - env['ENV']['PATH'] = envPath - else: - lex_bin_dir = os.path.dirname(lex) - env.AppendENVPath('PATH', lex_bin_dir) - return lex - - flex = SCons.Tool.find_program_path(env, 'flex', default_paths=MINGW_DEFAULT_PATHS + CYGWIN_DEFAULT_PATHS ) - if flex: - if not append_paths: - env['ENV']['PATH'] = envPath - else: - flex_bin_dir = os.path.dirname(flex) - env.AppendENVPath('PATH', flex_bin_dir) - return flex - else: - SCons.Warnings.Warning('lex tool requested, but lex or flex binary not found in ENV PATH') + bins = ['lex', 'flex'] + + for prog in bins: + bin_path = SCons.Tool.find_program_path(env, prog, default_paths=MINGW_DEFAULT_PATHS + CYGWIN_DEFAULT_PATHS ) + if bin_path: + if not append_paths: + env['ENV']['PATH'] = envPath + else: + env.AppendENVPath('PATH', os.path.dirname(bin_path)) + return bin_path + + SCons.Warnings.Warning('lex tool requested, but lex or flex binary not found in ENV PATH') def generate(env): -- cgit v0.12 From 16d8a62b17ae8a3e026d192574a05bdb87140c59 Mon Sep 17 00:00:00 2001 From: Daniel Date: Wed, 20 Feb 2019 00:16:11 -0600 Subject: add win_flex as option for windows, add choco default path, and add flag for nounistd on windows. also more testing --- .appveyor.yml | 4 +- src/engine/SCons/Platform/win32.py | 4 ++ src/engine/SCons/Tool/lex.py | 26 +++++---- src/engine/SCons/Tool/lex.xml | 9 ++++ test/CFILESUFFIX.py | 6 ++- test/CXX/CXXFILESUFFIX.py | 6 ++- test/LEX/LEX.py | 6 ++- test/LEX/LEXFLAGS.py | 25 +++++---- test/LEX/live.py | 21 ++------ test/LEX/live_mingw.py | 107 +++++++++++++++++++++++++++++++++++++ test/LEX/no_lex.py | 59 ++++++++++++++++++++ 11 files changed, 231 insertions(+), 42 deletions(-) create mode 100644 test/LEX/live_mingw.py create mode 100644 test/LEX/no_lex.py diff --git a/.appveyor.yml b/.appveyor.yml index 1849707..cbf7233 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -18,12 +18,12 @@ install: - cmd: "C:\\%WINPYTHON%\\python.exe --version" - cmd: for /F "tokens=*" %%g in ('C:\\%WINPYTHON%\\python.exe -m site --user-site') do (set PYSITEDIR=%%g) # use mingw 32 bit until #3291 is resolved - - cmd: "set PATH=C:\\%WINPYTHON%;C:\\%WINPYTHON%\\Scripts;C:\\MinGW\\bin;C:\\MinGW\\msys\\1.0\\bin;C:\\cygwin\\bin;C:\\ProgramData\\chocolatey\\bin;%PATH%" + - cmd: "set PATH=C:\\%WINPYTHON%;C:\\%WINPYTHON%\\Scripts;C:\\ProgramData\\chocolatey\\bin;C:\\MinGW\\bin;C:\\MinGW\\msys\\1.0\\bin;C:\\cygwin\\bin;%PATH%" - cmd: "C:\\%WINPYTHON%\\python.exe -m pip install -U --progress-bar off pip setuptools wheel " - cmd: "C:\\%WINPYTHON%\\python.exe -m pip install -U --progress-bar off pypiwin32 coverage codecov" - cmd: set STATIC_DEPS=true & C:\\%WINPYTHON%\\python.exe -m pip install -U --progress-bar off lxml # install 3rd party tools to test with - - cmd: choco install --allow-empty-checksums dmd ldc swig vswhere xsltproc + - cmd: choco install --allow-empty-checksums dmd ldc swig vswhere xsltproc winflexbison - cmd: set ### LINUX ### diff --git a/src/engine/SCons/Platform/win32.py b/src/engine/SCons/Platform/win32.py index 2d40fb8..be30546 100644 --- a/src/engine/SCons/Platform/win32.py +++ b/src/engine/SCons/Platform/win32.py @@ -43,6 +43,10 @@ from SCons.Platform.virtualenv import ImportVirtualenv from SCons.Platform.virtualenv import ignore_virtualenv, enable_virtualenv import SCons.Util +CHOCO_DEFAULT_PATH = [ + r'C:\ProgramData\chocolatey\bin' +] + try: import msvcrt import win32api diff --git a/src/engine/SCons/Tool/lex.py b/src/engine/SCons/Tool/lex.py index 70c0c5f..3506f7c 100644 --- a/src/engine/SCons/Tool/lex.py +++ b/src/engine/SCons/Tool/lex.py @@ -41,6 +41,7 @@ import SCons.Tool import SCons.Util from SCons.Platform.mingw import MINGW_DEFAULT_PATHS from SCons.Platform.cygwin import CYGWIN_DEFAULT_PATHS +from SCons.Platform.win32 import CHOCO_DEFAULT_PATH LexAction = SCons.Action.Action("$LEXCOM", "$LEXCOMSTR") @@ -74,17 +75,19 @@ def get_lex_path(env, append_paths=False): """ # save existing path to reset if we don't want to append any paths envPath = env['ENV']['PATH'] - bins = ['lex', 'flex'] + bins = ['win_flex', 'lex', 'flex'] for prog in bins: - bin_path = SCons.Tool.find_program_path(env, prog, default_paths=MINGW_DEFAULT_PATHS + CYGWIN_DEFAULT_PATHS ) + bin_path = SCons.Tool.find_program_path( + env, + prog, + default_paths=CHOCO_DEFAULT_PATH + MINGW_DEFAULT_PATHS + CYGWIN_DEFAULT_PATHS ) if bin_path: if not append_paths: env['ENV']['PATH'] = envPath else: env.AppendENVPath('PATH', os.path.dirname(bin_path)) return bin_path - SCons.Warnings.Warning('lex tool requested, but lex or flex binary not found in ENV PATH') @@ -92,9 +95,6 @@ def generate(env): """Add Builders and construction variables for lex to an Environment.""" c_file, cxx_file = SCons.Tool.createCFileBuilders(env) - if sys.platform == 'win32': - get_lex_path(env, append_paths=True) - # C c_file.add_action(".l", LexAction) c_file.add_emitter(".l", lexEmitter) @@ -109,10 +109,16 @@ def generate(env): # C++ cxx_file.add_action(".ll", LexAction) cxx_file.add_emitter(".ll", lexEmitter) - - env["LEX"] = env.Detect("flex") or "lex" - env["LEXFLAGS"] = SCons.Util.CLVar("") - env["LEXCOM"] = "$LEX $LEXFLAGS -t $SOURCES > $TARGET" + + if sys.platform == 'win32': + get_lex_path(env, append_paths=True) + env["LEX"] = env.Detect(['win_flex', 'lex', 'flex']) + env["LEXUNISTD"] = SCons.Util.CLVar("--nounistd") + env["LEXCOM"] = "$LEX $LEXUNISTD $LEXFLAGS -t $SOURCES > $TARGET" + else: + env["LEX"] = env.Detect(["flex", "lex"]) + env["LEXFLAGS"] = SCons.Util.CLVar("") + env["LEXCOM"] = "$LEX $LEXFLAGS -t $SOURCES > $TARGET" def exists(env): if sys.platform == 'win32': diff --git a/src/engine/SCons/Tool/lex.xml b/src/engine/SCons/Tool/lex.xml index 0388ee3..f933451 100644 --- a/src/engine/SCons/Tool/lex.xml +++ b/src/engine/SCons/Tool/lex.xml @@ -33,6 +33,7 @@ Sets construction variables for the &lex; lexical analyser. LEX LEXFLAGS LEXCOM +LEXUNISTD LEXCOMSTR @@ -78,4 +79,12 @@ General options passed to the lexical analyzer generator. + + + +Used only on windows environments to set a lex flag to prevent 'unistd.h' from being included. The default value is '--nounistd'. + + + + diff --git a/test/CFILESUFFIX.py b/test/CFILESUFFIX.py index 0a3a81a..410ece5 100644 --- a/test/CFILESUFFIX.py +++ b/test/CFILESUFFIX.py @@ -39,7 +39,11 @@ test = TestSCons.TestSCons() test.write('mylex.py', """ import getopt import sys -cmd_opts, args = getopt.getopt(sys.argv[1:], 't', []) +if sys.platform == 'win32': + longopts = ['nounistd'] +else: + longopts = [] +cmd_opts, args = getopt.getopt(sys.argv[1:], 't', longopts) for a in args: contents = open(a, 'rb').read() sys.stdout.write((contents.replace(b'LEX', b'mylex.py')).decode()) diff --git a/test/CXX/CXXFILESUFFIX.py b/test/CXX/CXXFILESUFFIX.py index 9442408..c8dbf0a 100644 --- a/test/CXX/CXXFILESUFFIX.py +++ b/test/CXX/CXXFILESUFFIX.py @@ -35,7 +35,11 @@ test = TestSCons.TestSCons() test.write('mylex.py', """ import getopt import sys -cmd_opts, args = getopt.getopt(sys.argv[1:], 't', []) +if sys.platform == 'win32': + longopts = ['nounistd'] +else: + longopts = [] +cmd_opts, args = getopt.getopt(sys.argv[1:], 't', longopts) for a in args: contents = open(a, 'r').read() sys.stdout.write(contents.replace('LEX', 'mylex.py')) diff --git a/test/LEX/LEX.py b/test/LEX/LEX.py index 1239c6b..65e4497 100644 --- a/test/LEX/LEX.py +++ b/test/LEX/LEX.py @@ -38,7 +38,11 @@ test = TestSCons.TestSCons() test.write('mylex.py', """ import getopt import sys -cmd_opts, args = getopt.getopt(sys.argv[1:], 't', []) +if sys.platform == 'win32': + longopts = ['nounistd'] +else: + longopts = [] +cmd_opts, args = getopt.getopt(sys.argv[1:], 't', longopts) for a in args: contents = open(a, 'rb').read() sys.stdout.write(contents.replace(b'LEX', b'mylex.py').decode()) diff --git a/test/LEX/LEXFLAGS.py b/test/LEX/LEXFLAGS.py index 54df161..51b6614 100644 --- a/test/LEX/LEXFLAGS.py +++ b/test/LEX/LEXFLAGS.py @@ -25,6 +25,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import os +import sys import TestSCons @@ -35,22 +36,25 @@ test = TestSCons.TestSCons() test.subdir('in') - - test.write('mylex.py', """ import getopt import sys -cmd_opts, args = getopt.getopt(sys.argv[1:], 'I:tx', []) +import os +if sys.platform == 'win32': + longopts = ['nounistd'] +else: + longopts = [] +cmd_opts, args = getopt.getopt(sys.argv[1:], 'I:tx', longopts) opt_string = '' i_arguments = '' for opt, arg in cmd_opts: if opt == '-I': i_arguments = i_arguments + ' ' + arg else: opt_string = opt_string + ' ' + opt for a in args: - contents = open(a, 'rb').read() - contents = contents.replace(b'LEXFLAGS', opt_string.encode()) - contents = contents.replace(b'I_ARGS', i_arguments.encode()) - sys.stdout.write(contents.decode()) + contents = open(a, 'r').read() + contents = contents.replace('LEXFLAGS', opt_string) + contents = contents.replace('I_ARGS', i_arguments) + sys.stdout.write(contents) sys.exit(0) """) @@ -61,13 +65,16 @@ env = Environment(LEX = r'%(_python_)s mylex.py', env.CFile(target = 'out/aaa', source = 'in/aaa.l') """ % locals()) -test.write(['in', 'aaa.l'], "aaa.l\nLEXFLAGS\nI_ARGS\n") +test.write(['in', 'aaa.l'], "aaa.l\nLEXFLAGS\nI_ARGS\n") test.run('.', stderr = None) +lexflags = ' -x -t' +if sys.platform == 'win32': + lexflags = ' --nounistd' + lexflags # Read in with mode='r' because mylex.py implicitley wrote to stdout # with mode='w'. -test.must_match(['out', 'aaa.c'], "aaa.l\n -x -t\n out in\n", mode='r') +test.must_match(['out', 'aaa.c'], "aaa.l\n%s\n out in\n" % lexflags, mode='r') diff --git a/test/LEX/live.py b/test/LEX/live.py index 853e97c..91a2d49 100644 --- a/test/LEX/live.py +++ b/test/LEX/live.py @@ -28,8 +28,6 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" Test LEX and LEXFLAGS with a live lex. """ -import sys - import TestSCons _exe = TestSCons._exe @@ -37,29 +35,18 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() -lex = test.where_is('lex') or test.where_is('flex') +lex = test.where_is('win_flex') or test.where_is('lex') or test.where_is('flex') if not lex: test.skip_test('No lex or flex found; skipping test.\n') -tools = "'default'" -if sys.platform == 'win32': - # make sure mingw is installed on win32 - if not test.where_is('gcc'): - test.skip_test('No mingw on windows; skipping test.\n') - # lex on win32 has a dependencies on mingw for unix headers - # so add it as a tool to the environment. - tools += ", 'mingw'" - - test.file_fixture('wrapper.py') test.write('SConstruct', """ -foo = Environment(tools=[%(tools)s]) +foo = Environment() lex = foo.Dictionary('LEX') bar = Environment(LEX = r'%(_python_)s wrapper.py ' + lex, - LEXFLAGS = '-b', - tools=[%(tools)s]) + LEXFLAGS = '-b') foo.Program(target = 'foo', source = 'foo.l') bar.Program(target = 'bar', source = 'bar.l') """ % locals()) @@ -100,8 +87,6 @@ test.must_exist(test.workpath('lex.backup')) test.run(program = test.workpath('bar'), stdin = "b\n", stdout = "Bbar.lB\n") - - test.pass_test() # Local Variables: diff --git a/test/LEX/live_mingw.py b/test/LEX/live_mingw.py new file mode 100644 index 0000000..13e2342 --- /dev/null +++ b/test/LEX/live_mingw.py @@ -0,0 +1,107 @@ +#!/usr/bin/env python +# +# __COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +""" +Test LEX and LEXFLAGS and unistd.h with a live lex in mingw environment. +""" + +import sys + +import TestSCons + +_exe = TestSCons._exe +_python_ = TestSCons._python_ + +test = TestSCons.TestSCons() + +if sys.platform != 'win32': + test.skip_test('Not windows environment; skipping test.\n') + +if not test.where_is('gcc'): + test.skip_test('No mingw or cygwin on windows; skipping test.\n') + +lex = test.where_is('lex') or test.where_is('flex') + +if not lex: + test.skip_test('No lex or flex found; skipping test.\n') + +test.file_fixture('wrapper.py') + +test.write('SConstruct', """ +foo = Environment(tools=['default', 'mingw', 'lex'], LEXUNISTD="") +lex = foo.Dictionary('LEX') +bar = Environment(LEX = r'%(_python_)s wrapper.py ' + lex, + LEXFLAGS = '-b', + LEXUNISTD="", + tools=['default', 'mingw', 'lex']) +foo.Program(target = 'foo', source = 'foo.l') +bar.Program(target = 'bar', source = 'bar.l') +""" % locals()) + +lex = r""" +%%%% +a printf("A%sA"); +b printf("B%sB"); +%%%% +int +yywrap() +{ + return 1; +} + +int +main() +{ + yylex(); +} +""" + +test.write('foo.l', lex % ('foo.l', 'foo.l')) + +test.write('bar.l', lex % ('bar.l', 'bar.l')) + +test.run(arguments = 'foo' + _exe, stderr = None) + +test.must_not_exist(test.workpath('wrapper.out')) +test.must_not_exist(test.workpath('lex.backup')) + +test.run(program = test.workpath('foo'), stdin = "a\n", stdout = "Afoo.lA\n") + +test.run(arguments = 'bar' + _exe) + +test.must_match(test.workpath('wrapper.out'), "wrapper.py\n") +test.must_exist(test.workpath('lex.backup')) + +test.run(program = test.workpath('bar'), stdin = "b\n", stdout = "Bbar.lB\n") +test.must_contain(test.workpath('bar.c'), "unistd.h") + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/LEX/no_lex.py b/test/LEX/no_lex.py new file mode 100644 index 0000000..89ffdc7 --- /dev/null +++ b/test/LEX/no_lex.py @@ -0,0 +1,59 @@ +#!/usr/bin/env python +# +# __COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +""" +Test Environments are functional and return None when no lex tool is found. +""" + +import TestSCons + +test = TestSCons.TestSCons() + +test.write('SConstruct', """ +import SCons + +def no_lex(env, key_program, default_paths=[]): + return None + +class TestEnvironment(SCons.Environment.Environment): + def Detect(self, progs): + return None + +SCons.Tool.find_program_path = no_lex + +foo = TestEnvironment(tools=['default', 'lex']) +print(foo.Dictionary('LEX')) +""" % locals()) + +test.run(arguments = '-Q -s', stdout = 'None\n' ) + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: -- cgit v0.12 From c647a8da560d9127e21ca1ff561ba4ab5d20219d Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Wed, 20 Feb 2019 18:03:03 -0700 Subject: Minor manpage bugfix Signed-off-by: Mats Wichmann --- doc/man/scons.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/man/scons.xml b/doc/man/scons.xml index dc6c36c..9172b15 100644 --- a/doc/man/scons.xml +++ b/doc/man/scons.xml @@ -2321,12 +2321,12 @@ that are not absolute path names / on POSIX systems or -\fR +\ on Windows systems, with or without an optional drive letter) are interpreted relative to the directory containing the -SConscript +SConscript file being read. An initial # -- cgit v0.12 From f48ffbc7e74602d851fb9ccebaa5c05eb3aa8c2e Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Sat, 23 Feb 2019 09:38:02 -0800 Subject: [ci skip] correct TempFileMunge docstring TEMPFILEEXTENSION in class TempFileMunge docstring should be TEMPFILESUFFIX to match the code Signed-off-by: Mats Wichmann --- src/engine/SCons/Platform/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/engine/SCons/Platform/__init__.py b/src/engine/SCons/Platform/__init__.py index 3168378..71d292e 100644 --- a/src/engine/SCons/Platform/__init__.py +++ b/src/engine/SCons/Platform/__init__.py @@ -155,9 +155,9 @@ class TempFileMunge(object): env["TEMPFILEPREFIX"] = '' # (the empty string) PC Lint You can configure the extension of the temporary file through the - TEMPFILEEXTENSION variable, which defaults to '.lnk' (see comments + TEMPFILESUFFIX variable, which defaults to '.lnk' (see comments in the code below): - env["TEMPFILEEXTENSION"] = '.lnt' # PC Lint + env["TEMPFILESUFFIX"] = '.lnt' # PC Lint """ def __init__(self, cmd, cmdstr = None): self.cmd = cmd -- cgit v0.12 From 28d90499867ace9e16c117b1cbf960aca8e67c8e Mon Sep 17 00:00:00 2001 From: William Deegan Date: Tue, 26 Feb 2019 21:52:46 -0800 Subject: On windows first try with native file paths with \\ then swap path to normalized path string with / separators. On a fresh windows build the node string will have windows dirsep and not normalizd. This yielded broken builds for the Meta project' --- src/engine/SCons/Node/FS.py | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/src/engine/SCons/Node/FS.py b/src/engine/SCons/Node/FS.py index 77c340f..f2ba7be 100644 --- a/src/engine/SCons/Node/FS.py +++ b/src/engine/SCons/Node/FS.py @@ -3338,17 +3338,29 @@ class File(Base): # First try the simple name for node c_str = str(self) + df = dmap.get(c_str, None) + if df: + return df + if os.altsep: c_str = c_str.replace(os.sep, os.altsep) - df = dmap.get(c_str, None) + df = dmap.get(c_str, None) + if df: + return df + if not df: try: # this should yield a path which matches what's in the sconsign c_str = self.get_path() + df = dmap.get(c_str, None) + if df: + return df + if os.altsep: c_str = c_str.replace(os.sep, os.altsep) - - df = dmap.get(c_str, None) + df = dmap.get(c_str, None) + if df: + return df except AttributeError as e: raise FileBuildInfoFileToCsigMappingError("No mapping from file name to content signature for :%s"%c_str) @@ -3388,16 +3400,23 @@ class File(Base): dependency_map = self._build_dependency_map(bi) rebuilt = True - prev_ni = self._get_previous_signatures(dependency_map) + new_prev_ni = self._get_previous_signatures(dependency_map) + new = self.changed_timestamp_match(target, new_prev_ni) + old = self.changed_timestamp_match(target, prev_ni) + + if old != new: + print("Mismatch self.changed_timestamp_match(%s, prev_ni) old:%s new:%s"%(str(target), old, new)) + new_prev_ni = self._get_previous_signatures(dependency_map) + - if not self.changed_timestamp_match(target, prev_ni): + if not new: try: # NOTE: We're modifying the current node's csig in a query. - self.get_ninfo().csig = prev_ni.csig + self.get_ninfo().csig = new_prev_ni.csig except AttributeError: pass return False - return self.changed_content(target, prev_ni) + return self.changed_content(target, new_prev_ni) def changed_timestamp_newer(self, target, prev_ni): try: -- cgit v0.12 From e863e1bc71aea05c554e6d06014b51c19f5a6bf5 Mon Sep 17 00:00:00 2001 From: William Deegan Date: Wed, 27 Feb 2019 14:41:06 -0800 Subject: Add test for GH Issue #3303 --- test/Configure/option--config.py | 10 ++++++++++ test/fixture/test_main.c | 4 ++++ 2 files changed, 14 insertions(+) create mode 100644 test/fixture/test_main.c diff --git a/test/Configure/option--config.py b/test/Configure/option--config.py index 80a8bcd..02f10ce 100644 --- a/test/Configure/option--config.py +++ b/test/Configure/option--config.py @@ -122,6 +122,9 @@ test.checkLogAndStdout(["Checking for C header file non_system_header0.h... ", [((".c", CR), (_obj, NCR))]], "config.log", ".sconf_temp", "SConstruct") + +test.file_fixture('test_main.c') + # Check the combination of --config=force and Decider('MD5-timestamp') # On second run there was an issue where the decider would throw DeciderNeedsNode # exception which the configure code didn't handle. @@ -132,12 +135,19 @@ env.Decider('MD5-timestamp') conf = Configure(env) conf.TryLink('int main(){return 0;}','.c') env = conf.Finish() +env.Program('test_main.c') """) test.run(arguments='--config=force') # On second run the sconsign is loaded and decider doesn't just indicate need to rebuild test.run(arguments='--config=force') test.must_not_contain(test.workpath('config.log'), "TypeError: 'NoneType' object is not callable", mode='r') +# Now check to check that test_main.c didn't rebuild on second run above. +# This fixes an issue where --config=force overwrites the Environments decider and is not reset when +# the configure context is done. +# https://github.com/SCons/scons/issues/3303 +test.fail_test(test.stdout().find('test_main.o') != -1) + test.pass_test() # Local Variables: diff --git a/test/fixture/test_main.c b/test/fixture/test_main.c new file mode 100644 index 0000000..adbe919 --- /dev/null +++ b/test/fixture/test_main.c @@ -0,0 +1,4 @@ +int main( int argc, char* argv[] ) +{ + return 0; +} -- cgit v0.12 From 043f3fe3c182730eca17d68030f1de34fa88477e Mon Sep 17 00:00:00 2001 From: William Deegan Date: Wed, 27 Feb 2019 14:42:01 -0800 Subject: Fix Issue #3303 --config=force overwritting passed in Environment's Decider and not cleaning it up when configure context is complete --- src/CHANGES.txt | 2 + src/engine/SCons/Environment.py | 1 + src/engine/SCons/SConf.py | 81 +++++++++++++++++++++++++++++------------ 3 files changed, 61 insertions(+), 23 deletions(-) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 4acfcba..8fccdeb 100755 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -14,6 +14,8 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER The Configure logic directly calls the decider when using --config=force but wasn't handling that exception. This would yield minimally configure tests using TryLink() not running and leaving TypeError Nonetype exception in config.log + - Fix Issue #3303 - Handle --config=force overwriting the Environment passed into Configure()'s + Decider and not clearing it when the configure context is completed. From Daniel Moody: - Change the default for AppendENVPath to delete_existing=0, so path diff --git a/src/engine/SCons/Environment.py b/src/engine/SCons/Environment.py index 152f0bc..eea8aed 100644 --- a/src/engine/SCons/Environment.py +++ b/src/engine/SCons/Environment.py @@ -2372,6 +2372,7 @@ class OverrideEnvironment(Base): kw = copy_non_reserved_keywords(kw) self.__dict__['overrides'].update(semi_deepcopy(kw)) + # The entry point that will be used by the external world # to refer to a construction environment. This allows the wrapper # interface to extend a construction environment for its own purposes diff --git a/src/engine/SCons/SConf.py b/src/engine/SCons/SConf.py index f23c401..b123c11 100644 --- a/src/engine/SCons/SConf.py +++ b/src/engine/SCons/SConf.py @@ -324,24 +324,6 @@ class SConfBuildTask(SCons.Taskmaster.AlwaysTask): s = sys.stdout = sys.stderr = Streamer(sys.stdout) try: env = self.targets[0].get_build_env() - if cache_mode == FORCE: - # Set up the Decider() to force rebuilds by saying - # that every source has changed. Note that we still - # call the environment's underlying source decider so - # that the correct .sconsign info will get calculated - # and keep the build state consistent. - def force_build(dependency, target, prev_ni, - env_decider=env.decide_source, - node=None): - try: - env_decider(dependency, target, prev_ni) - except DeciderNeedsNode as e: - e.decider(target, prev_ni, node=target) - except Exception as e: - raise e - return True - if env.decide_source.__code__ is not force_build.__code__: - env.Decider(force_build) env['PSTDOUT'] = env['PSTDERR'] = s try: sconf.cached = 0 @@ -412,12 +394,42 @@ class SConfBase(object): build tests in the VariantDir, not in the SourceDir) """ global SConfFS + + # Now create isolated override so setting source_decider doesn't affect parent Environment + if cache_mode == FORCE: + self.original_env = env + self.env = env.Clone() + + # Set up the Decider() to force rebuilds by saying + # that every source has changed. Note that we still + # call the environment's underlying source decider so + # that the correct .sconsign info will get calculated + # and keep the build state consistent. + def force_build(dependency, target, prev_ni, + env_decider=env.decide_source, + node=None): + try: + env_decider(dependency, target, prev_ni) + except DeciderNeedsNode as e: + e.decider(target, prev_ni, node=target) + except Exception as e: + raise e + return True + + if self.env.decide_source.__code__ is not force_build.__code__: + self.env.Decider(force_build) + + else: + self.env = env + + # print("Override env:%s"%env) + if not SConfFS: SConfFS = SCons.Node.FS.default_fs or \ SCons.Node.FS.FS(env.fs.pathTop) if sconf_global is not None: raise SCons.Errors.UserError - self.env = env + if log_file is not None: log_file = SConfFS.File(env.subst(log_file)) self.logfile = log_file @@ -456,6 +468,7 @@ class SConfBase(object): env = sconf.Finish() """ self._shutdown() + return self.env def Define(self, name, value = None, comment = None): @@ -510,6 +523,20 @@ class SConfBase(object): n.attributes = SCons.Node.Node.Attrs() n.attributes.keep_targetinfo = 1 + if True: + # Some checkers have intermediate files (for example anything that compiles a c file into a program to run + # Those files need to be set to not release their target info, otherwise taskmaster will throw a + # Nonetype not callable + for c in n.children(scan=False): + # Keep debug code here. + # print("Checking [%s] for builders and then setting keep_targetinfo"%c) + if c.has_builder(): + n.store_info = 0 + if not hasattr(c, 'attributes'): + c.attributes = SCons.Node.Node.Attrs() + c.attributes.keep_targetinfo = 1 + # pass + ret = 1 try: @@ -746,10 +773,18 @@ class SConfBase(object): self.logstream.write("\n") self.logstream.close() self.logstream = None - # remove the SConfSourceBuilder from the environment - blds = self.env['BUILDERS'] - del blds['SConfSourceBuilder'] - self.env.Replace( BUILDERS=blds ) + + # Now reset the decider if we changed it due to --config=force + # We saved original Environment passed in and cloned it to isolate + # it from being changed. + if cache_mode == FORCE: + self.env.Decider(self.original_env.decide_source) + + # remove the SConfSourceBuilder from the environment + blds = self.env['BUILDERS'] + del blds['SConfSourceBuilder'] + self.env.Replace( BUILDERS=blds ) + self.active = 0 sconf_global = None if not self.config_h is None: -- cgit v0.12 From 32201ba249861390fae34198eedd787972db09ea Mon Sep 17 00:00:00 2001 From: "Bernhard M. Wiedemann" Date: Wed, 27 Feb 2019 11:50:47 +0100 Subject: Do not store build host name if reproducible builds are wanted. See https://reproducible-builds.org/ for why this is good. This affected scons itself, which differed in the line __buildsys__ = "..." --- SConstruct | 8 ++++++-- src/CHANGES.txt | 3 +++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/SConstruct b/SConstruct index 8f7ceaf..760b1c6 100644 --- a/SConstruct +++ b/SConstruct @@ -84,7 +84,10 @@ if not developer: build_system = ARGUMENTS.get('BUILD_SYSTEM') if not build_system: - build_system = socket.gethostname().split('.')[0] + if os.environ.get('SOURCE_DATE_EPOCH'): + build_system = '_reproducible' + else: + build_system = socket.gethostname().split('.')[0] version = ARGUMENTS.get('VERSION', '') if not version: @@ -159,7 +162,8 @@ command_line_variables = [ ("BUILD_SYSTEM=", "The system on which the packages were built. " + "The default is whatever hostname is returned " + - "by socket.gethostname()."), + "by socket.gethostname(). If SOURCE_DATE_EPOCH " + + "env var is set, '_reproducible' is the default."), ("CHECKPOINT=", "The specific checkpoint release being packaged, " + "which will be appended to the VERSION string. " + diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 0d02ec0..39b11f2 100755 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -26,6 +26,9 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER - Add the textfile tool to the default tool list - Fix syntax on is/is not cluases: should not use with a literal + From Bernhard M. Wiedemann: + - Do not store build host name if reproducible builds are wanted + RELEASE 3.0.4 - Mon, 20 Jan 2019 22:49:27 +0000 -- cgit v0.12 From 46fe4773a2d063ad9bf74ff3aef258da102865d8 Mon Sep 17 00:00:00 2001 From: "Bernhard M. Wiedemann" Date: Thu, 28 Feb 2019 16:23:25 +0100 Subject: Do not store build user name --- SConstruct | 6 +++++- src/CHANGES.txt | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/SConstruct b/SConstruct index 760b1c6..b94a3e3 100644 --- a/SConstruct +++ b/SConstruct @@ -81,6 +81,8 @@ if not developer: developer = os.environ.get(variable) if developer: break + if os.environ.get('SOURCE_DATE_EPOCH'): + developer = '_reproducible' build_system = ARGUMENTS.get('BUILD_SYSTEM') if not build_system: @@ -181,7 +183,9 @@ command_line_variables = [ ("DEVELOPER=", "The developer who created the packages. " + "The default is the first set environment " + - "variable from the list $USERNAME, $LOGNAME, $USER."), + "variable from the list $USERNAME, $LOGNAME, $USER." + + "If the SOURCE_DATE_EPOCH env var is set, " + + "'_reproducible' is the default."), ("REVISION=", "The revision number of the source being built. " + "The default is the git hash returned " + diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 39b11f2..b9052bb 100755 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -27,7 +27,7 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER - Fix syntax on is/is not cluases: should not use with a literal From Bernhard M. Wiedemann: - - Do not store build host name if reproducible builds are wanted + - Do not store build host+user name if reproducible builds are wanted RELEASE 3.0.4 - Mon, 20 Jan 2019 22:49:27 +0000 -- cgit v0.12 From 060f9646633146fb9c64d2a31e9c3f3117c2f85b Mon Sep 17 00:00:00 2001 From: "Bernhard M. Wiedemann" Date: Thu, 28 Feb 2019 16:31:41 +0100 Subject: Fix typo --- src/CHANGES.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index b9052bb..1eb08db 100755 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -24,7 +24,7 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER - Quiet open file ResourceWarnings on Python >= 3.6 caused by not using a context manager around Popen.stdout - Add the textfile tool to the default tool list - - Fix syntax on is/is not cluases: should not use with a literal + - Fix syntax on is/is not clauses: should not use with a literal From Bernhard M. Wiedemann: - Do not store build host+user name if reproducible builds are wanted -- cgit v0.12 From 910af82db286c12414b2abc252c484bcaaa9beb4 Mon Sep 17 00:00:00 2001 From: William Deegan Date: Thu, 28 Feb 2019 11:20:58 -0500 Subject: Update SConf tests to add scan arg to mocked out Node children() method since this is now used by SConf's logic --- src/engine/SCons/SConfTests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/engine/SCons/SConfTests.py b/src/engine/SCons/SConfTests.py index cf8a7fb..ff544f5 100644 --- a/src/engine/SCons/SConfTests.py +++ b/src/engine/SCons/SConfTests.py @@ -194,7 +194,7 @@ class SConfTestCase(unittest.TestCase): pass def add_post_action(self, *actions): pass - def children(self): + def children(self, scan = 1): return [] def get_state(self): return self.state -- cgit v0.12 From 2ea6b7a551620c56f61a5dd9a9c94e342993795e Mon Sep 17 00:00:00 2001 From: William Deegan Date: Thu, 28 Feb 2019 13:21:58 -0500 Subject: Add debug logic to try to find why test/TEX/variant_dir.py is failing not finding dvipdf --- .travis/install.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis/install.sh b/.travis/install.sh index c1a4d02..b4b9ef1 100755 --- a/.travis/install.sh +++ b/.travis/install.sh @@ -47,4 +47,6 @@ else tar xzf rel-3.0.12.tar.gz cd swig-rel-3.0.12 && ./autogen.sh && ./configure --prefix=/usr && make && sudo make install && cd .. fi + + which dvipdf fi -- cgit v0.12 From 7b192e7b4c92606ffe1b07adbb82bda039a17975 Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 28 Feb 2019 23:16:12 -0600 Subject: only use no-unistd option with MSVC environment --- src/CHANGES.txt | 4 +++- src/engine/SCons/Tool/lex.py | 10 ++++++---- src/engine/SCons/Tool/msvc.py | 4 ++++ 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index bfea661..7393664 100755 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -21,7 +21,9 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER - Fixed bug which threw error when running SCons on windows system with no MSVC installed. - Update link tool to convert target to node before accessing node member - Update mingw tool to remove MSVC like nologo CCFLAG - - Update lex tool to work in mingw environments + - Add default paths for lex tool on windows + - Add lex construction variable LEXUNISTD for turning off unix headers on windows + - Update lex tool to use win_flex on windows if available From Mats Wichmann: - Quiet open file ResourceWarnings on Python >= 3.6 caused by diff --git a/src/engine/SCons/Tool/lex.py b/src/engine/SCons/Tool/lex.py index 3506f7c..a63ddc9 100644 --- a/src/engine/SCons/Tool/lex.py +++ b/src/engine/SCons/Tool/lex.py @@ -75,7 +75,7 @@ def get_lex_path(env, append_paths=False): """ # save existing path to reset if we don't want to append any paths envPath = env['ENV']['PATH'] - bins = ['win_flex', 'lex', 'flex'] + bins = ['flex', 'lex', 'win_flex'] for prog in bins: bin_path = SCons.Tool.find_program_path( @@ -110,14 +110,16 @@ def generate(env): cxx_file.add_action(".ll", LexAction) cxx_file.add_emitter(".ll", lexEmitter) + env["LEXFLAGS"] = SCons.Util.CLVar("") + if sys.platform == 'win32': get_lex_path(env, append_paths=True) - env["LEX"] = env.Detect(['win_flex', 'lex', 'flex']) - env["LEXUNISTD"] = SCons.Util.CLVar("--nounistd") + env["LEX"] = env.Detect(['flex', 'lex', 'win_flex']) + if not env.get("LEXUNISTD"): + env["LEXUNISTD"] = SCons.Util.CLVar("") env["LEXCOM"] = "$LEX $LEXUNISTD $LEXFLAGS -t $SOURCES > $TARGET" else: env["LEX"] = env.Detect(["flex", "lex"]) - env["LEXFLAGS"] = SCons.Util.CLVar("") env["LEXCOM"] = "$LEX $LEXFLAGS -t $SOURCES > $TARGET" def exists(env): diff --git a/src/engine/SCons/Tool/msvc.py b/src/engine/SCons/Tool/msvc.py index 9f3c1fa..2352088 100644 --- a/src/engine/SCons/Tool/msvc.py +++ b/src/engine/SCons/Tool/msvc.py @@ -271,6 +271,10 @@ def generate(env): env['SHOBJPREFIX'] = '$OBJPREFIX' env['SHOBJSUFFIX'] = '$OBJSUFFIX' + # MSVC probably wont support unistd.h so default + # without it for lex generation + env["LEXUNISTD"] = SCons.Util.CLVar("--nounistd") + # Set-up ms tools paths msvc_setup_env_once(env) -- cgit v0.12 From f765b5c4fa6b41de214b243daa6dd3ad6356dfe2 Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Tue, 12 Feb 2019 09:42:43 -0700 Subject: Drop -tt flag in runtest.py Test runs launch Python with the -tt flag to error on inconsistent tab usage. That flag is no longer part of Python 3, though it is silently accepted and ignored in cpython. In PyPy3, it errors. We have other ways to detect such things now anyway, so just drop. Signed-off-by: Mats Wichmann --- runtest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtest.py b/runtest.py index 9ffe374..eecf19d 100755 --- a/runtest.py +++ b/runtest.py @@ -797,7 +797,7 @@ tests_failing = 0 def run_test(t, io_lock, run_async=True): global tests_completed, tests_passing, tests_failing header = "" - command_args = ['-tt'] + command_args = [] if debug: command_args.append(debug) command_args.append(t.path) -- cgit v0.12 From 83c4b8ff692066bf29daa9a6aebf10818a914475 Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Fri, 1 Mar 2019 09:46:54 -0700 Subject: [WIP] for #3304: drop use of -tt if py3 As noted in issue #3304, the Python flag to error on inconsistent tabs/spaces has been dropped for Python 3 interpreters; while CPython still accepts it, silently ignoring it, PyPy3 errors out. This change adds the flag throughout the testsuite run only if using a Python2 interpreter. Signed-off-by: Mats Wichmann --- SConstruct | 6 ------ runtest.py | 2 ++ test/runtest/baseline/combined.py | 7 ++++--- test/runtest/baseline/fail.py | 3 ++- test/runtest/baseline/no_result.py | 3 ++- test/runtest/baseline/pass.py | 3 ++- test/runtest/fallback.py | 7 ++++--- test/runtest/noqmtest.py | 7 ++++--- test/runtest/print_time.py | 7 ++++--- test/runtest/python.py | 7 ++++++- test/runtest/simple/combined.py | 7 ++++--- test/runtest/simple/fail.py | 3 ++- test/runtest/simple/no_result.py | 3 ++- test/runtest/simple/pass.py | 3 ++- test/runtest/src.py | 5 +++-- test/runtest/testargv.py | 5 +++-- test/runtest/testlistfile.py | 3 ++- test/runtest/xml/output.py | 7 ++++--- testing/framework/TestRuntest.py | 10 ++++++++-- testing/framework/TestSCons.py | 4 +++- testing/framework/TestSCons_time.py | 4 +++- 21 files changed, 66 insertions(+), 40 deletions(-) diff --git a/SConstruct b/SConstruct index b94a3e3..5ac5692 100644 --- a/SConstruct +++ b/SConstruct @@ -46,8 +46,6 @@ import time import socket import textwrap - - import bootstrap project = 'scons' @@ -56,7 +54,6 @@ copyright = "Copyright (c) %s The SCons Foundation" % copyright_years SConsignFile() - # # We let the presence or absence of various utilities determine whether # or not we bother to build certain pieces of things. This should allow @@ -129,9 +126,6 @@ if build_id is None: else: build_id = '' - -python_ver = sys.version[0:3] - # # Adding some paths to sys.path, this is mainly needed # for the doc toolchain. diff --git a/runtest.py b/runtest.py index eecf19d..ccc170a 100755 --- a/runtest.py +++ b/runtest.py @@ -798,6 +798,8 @@ def run_test(t, io_lock, run_async=True): global tests_completed, tests_passing, tests_failing header = "" command_args = [] + if sys.version_info[0] < 3: + command_args.append('-tt') if debug: command_args.append(debug) command_args.append(t.path) diff --git a/test/runtest/baseline/combined.py b/test/runtest/baseline/combined.py index 35c1796..228d42d 100644 --- a/test/runtest/baseline/combined.py +++ b/test/runtest/baseline/combined.py @@ -34,6 +34,7 @@ import os import TestRuntest pythonstring = TestRuntest.pythonstring +pythonflags = TestRuntest.pythonflags test_fail_py = os.path.join('test', 'fail.py') test_no_result_py = os.path.join('test', 'no_result.py') test_pass_py = os.path.join('test', 'pass.py') @@ -49,11 +50,11 @@ test.write_no_result_test(['test', 'no_result.py']) test.write_passing_test(['test', 'pass.py']) expect_stdout = """\ -%(pythonstring)s -tt %(test_fail_py)s +%(pythonstring)s%(pythonflags)s %(test_fail_py)s FAILING TEST STDOUT -%(pythonstring)s -tt %(test_no_result_py)s +%(pythonstring)s%(pythonflags)s %(test_no_result_py)s NO RESULT TEST STDOUT -%(pythonstring)s -tt %(test_pass_py)s +%(pythonstring)s%(pythonflags)s %(test_pass_py)s PASSING TEST STDOUT Failed the following test: diff --git a/test/runtest/baseline/fail.py b/test/runtest/baseline/fail.py index 5687160..e2aff4a 100644 --- a/test/runtest/baseline/fail.py +++ b/test/runtest/baseline/fail.py @@ -31,6 +31,7 @@ Test how we handle a failing test specified on the command line. import TestRuntest pythonstring = TestRuntest.pythonstring +pythonflags = TestRuntest.pythonflags test = TestRuntest.TestRuntest() @@ -39,7 +40,7 @@ test.subdir('test') test.write_failing_test(['test', 'fail.py']) expect_stdout = """\ -%(pythonstring)s -tt test/fail.py +%(pythonstring)s%(pythonflags)s test/fail.py FAILING TEST STDOUT """ % locals() diff --git a/test/runtest/baseline/no_result.py b/test/runtest/baseline/no_result.py index 2149594..b63d0c6 100644 --- a/test/runtest/baseline/no_result.py +++ b/test/runtest/baseline/no_result.py @@ -31,6 +31,7 @@ Test how we handle a no-results test specified on the command line. import TestRuntest pythonstring = TestRuntest.pythonstring +pythonflags = TestRuntest.pythonflags test = TestRuntest.TestRuntest() @@ -39,7 +40,7 @@ test.subdir('test') test.write_no_result_test(['test', 'no_result.py']) expect_stdout = """\ -%(pythonstring)s -tt test/no_result.py +%(pythonstring)s%(pythonflags)s test/no_result.py NO RESULT TEST STDOUT """ % locals() diff --git a/test/runtest/baseline/pass.py b/test/runtest/baseline/pass.py index affa486..481fc97 100644 --- a/test/runtest/baseline/pass.py +++ b/test/runtest/baseline/pass.py @@ -33,6 +33,7 @@ import os import TestRuntest pythonstring = TestRuntest.pythonstring +pythonflags = TestRuntest.pythonflags test_pass_py = os.path.join('test', 'pass.py') test = TestRuntest.TestRuntest() @@ -42,7 +43,7 @@ test.subdir('test') test.write_passing_test(['test', 'pass.py']) expect_stdout = """\ -%(pythonstring)s -tt %(test_pass_py)s +%(pythonstring)s%(pythonflags)s %(test_pass_py)s PASSING TEST STDOUT """ % locals() diff --git a/test/runtest/fallback.py b/test/runtest/fallback.py index 1229b28..b137307 100644 --- a/test/runtest/fallback.py +++ b/test/runtest/fallback.py @@ -34,6 +34,7 @@ import os import TestRuntest pythonstring = TestRuntest.pythonstring +pythonflags = TestRuntest.pythonflags test = TestRuntest.TestRuntest() @@ -56,11 +57,11 @@ test.write_no_result_test(test_no_result_py) test.write_passing_test(test_pass_py) expect_stdout = """\ -%(pythonstring)s -tt %(test_fail_py)s +%(pythonstring)s%(pythonflags)s %(test_fail_py)s FAILING TEST STDOUT -%(pythonstring)s -tt %(test_no_result_py)s +%(pythonstring)s%(pythonflags)s %(test_no_result_py)s NO RESULT TEST STDOUT -%(pythonstring)s -tt %(test_pass_py)s +%(pythonstring)s%(pythonflags)s %(test_pass_py)s PASSING TEST STDOUT Failed the following test: diff --git a/test/runtest/noqmtest.py b/test/runtest/noqmtest.py index cea2f11..fcf7ac0 100644 --- a/test/runtest/noqmtest.py +++ b/test/runtest/noqmtest.py @@ -34,6 +34,7 @@ import os import TestRuntest pythonstring = TestRuntest.pythonstring +pythonflags = TestRuntest.pythonflags test = TestRuntest.TestRuntest() @@ -48,11 +49,11 @@ test.write_no_result_test(test_no_result_py) test.write_passing_test(test_pass_py) expect_stdout = """\ -%(pythonstring)s -tt %(test_fail_py)s +%(pythonstring)s%(pythonflags)s %(test_fail_py)s FAILING TEST STDOUT -%(pythonstring)s -tt %(test_no_result_py)s +%(pythonstring)s%(pythonflags)s %(test_no_result_py)s NO RESULT TEST STDOUT -%(pythonstring)s -tt %(test_pass_py)s +%(pythonstring)s%(pythonflags)s %(test_pass_py)s PASSING TEST STDOUT Failed the following test: diff --git a/test/runtest/print_time.py b/test/runtest/print_time.py index 244c6f8..322b88b 100644 --- a/test/runtest/print_time.py +++ b/test/runtest/print_time.py @@ -36,6 +36,7 @@ import TestCmd import TestRuntest pythonstring = re.escape(TestRuntest.pythonstring) +pythonflags = TestRuntest.pythonflags test_fail_py = re.escape(os.path.join('test', 'fail.py')) test_no_result_py = re.escape(os.path.join('test', 'no_result.py')) test_pass_py = re.escape(os.path.join('test', 'pass.py')) @@ -51,13 +52,13 @@ test.write_no_result_test(['test', 'no_result.py']) test.write_passing_test(['test', 'pass.py']) expect_stdout = """\ -%(pythonstring)s -tt %(test_fail_py)s +%(pythonstring)s%(pythonflags)s %(test_fail_py)s FAILING TEST STDOUT Test execution time: \\d+.\\d seconds -%(pythonstring)s -tt %(test_no_result_py)s +%(pythonstring)s%(pythonflags)s %(test_no_result_py)s NO RESULT TEST STDOUT Test execution time: \\d+.\\d seconds -%(pythonstring)s -tt %(test_pass_py)s +%(pythonstring)s%(pythonflags)s %(test_pass_py)s PASSING TEST STDOUT Test execution time: \\d+.\\d seconds Total execution time for all tests: \\d+.\\d seconds diff --git a/test/runtest/python.py b/test/runtest/python.py index bcbc062..14156e0 100644 --- a/test/runtest/python.py +++ b/test/runtest/python.py @@ -43,6 +43,11 @@ test_pass_py = os.path.join('test', 'pass.py') head, python = os.path.split(TestRuntest.python) head, dir = os.path.split(head) +# deciding whether or not to use -tt flag here is dicey. +# we'll go ahead and use TestRuntest.pythonflags, but it uses the +# python version then in use, which could be different +pythonflags = TestRuntest.pythonflags + # We have to normalize the python path here, because some installations don't like # getting called with "/bin/../bin/python" as first argument, e.g. Fedora 17 Desktop. mypython = os.path.normpath(os.path.join(head, dir, os.path.pardir, dir, python)) @@ -60,7 +65,7 @@ test.subdir('test') test.write_passing_test(['test', 'pass.py']) expect_stdout = """\ -%(mypythonstring)s -tt %(test_pass_py)s +%(mypythonstring)s%(pythonflags)s %(test_pass_py)s PASSING TEST STDOUT """ % locals() diff --git a/test/runtest/simple/combined.py b/test/runtest/simple/combined.py index 616f4d5..ec0a1bb 100644 --- a/test/runtest/simple/combined.py +++ b/test/runtest/simple/combined.py @@ -37,6 +37,7 @@ import TestRuntest test = TestRuntest.TestRuntest() pythonstring = TestRuntest.pythonstring +pythonflags = TestRuntest.pythonflags test_fail_py = os.path.join('test', 'fail.py') test_no_result_py = os.path.join('test', 'no_result.py') test_pass_py = os.path.join('test', 'pass.py') @@ -50,11 +51,11 @@ test.write_no_result_test(['test', 'no_result.py']) test.write_passing_test(['test', 'pass.py']) expect_stdout = """\ -%(pythonstring)s -tt %(test_fail_py)s +%(pythonstring)s%(pythonflags)s %(test_fail_py)s FAILING TEST STDOUT -%(pythonstring)s -tt %(test_no_result_py)s +%(pythonstring)s%(pythonflags)s %(test_no_result_py)s NO RESULT TEST STDOUT -%(pythonstring)s -tt %(test_pass_py)s +%(pythonstring)s%(pythonflags)s %(test_pass_py)s PASSING TEST STDOUT Failed the following test: diff --git a/test/runtest/simple/fail.py b/test/runtest/simple/fail.py index 8b800fb..f26f00e 100644 --- a/test/runtest/simple/fail.py +++ b/test/runtest/simple/fail.py @@ -31,6 +31,7 @@ Test how we handle a failing test specified on the command line. import TestRuntest pythonstring = TestRuntest.pythonstring +pythonflags = TestRuntest.pythonflags test = TestRuntest.TestRuntest() @@ -39,7 +40,7 @@ test.subdir('test') test.write_failing_test(['test', 'fail.py']) expect_stdout = """\ -%(pythonstring)s -tt test/fail.py +%(pythonstring)s%(pythonflags)s test/fail.py FAILING TEST STDOUT """ % locals() diff --git a/test/runtest/simple/no_result.py b/test/runtest/simple/no_result.py index 91af7e4..2fd40b4 100644 --- a/test/runtest/simple/no_result.py +++ b/test/runtest/simple/no_result.py @@ -31,6 +31,7 @@ Test how we handle a no-results test specified on the command line. import TestRuntest pythonstring = TestRuntest.pythonstring +pythonflags = TestRuntest.pythonflags test = TestRuntest.TestRuntest() @@ -39,7 +40,7 @@ test.subdir('test') test.write_no_result_test(['test', 'no_result.py']) expect_stdout = """\ -%(pythonstring)s -tt test/no_result.py +%(pythonstring)s%(pythonflags)s test/no_result.py NO RESULT TEST STDOUT """ % locals() diff --git a/test/runtest/simple/pass.py b/test/runtest/simple/pass.py index 6e5b6b0..7ceb9a0 100644 --- a/test/runtest/simple/pass.py +++ b/test/runtest/simple/pass.py @@ -31,6 +31,7 @@ Test how we handle a passing test specified on the command line. import TestRuntest pythonstring = TestRuntest.pythonstring +pythonflags = TestRuntest.pythonflags test = TestRuntest.TestRuntest() @@ -39,7 +40,7 @@ test.subdir('test') test.write_passing_test(['test', 'pass.py']) expect_stdout = """\ -%(pythonstring)s -tt test/pass.py +%(pythonstring)s%(pythonflags)s test/pass.py PASSING TEST STDOUT """ % locals() diff --git a/test/runtest/src.py b/test/runtest/src.py index 23894f9..cbce2bd 100644 --- a/test/runtest/src.py +++ b/test/runtest/src.py @@ -39,6 +39,7 @@ test.subdir(['src'], ['src', 'suite']) pythonstring = TestRuntest.pythonstring +pythonflags = TestRuntest.pythonflags src_passTests_py = os.path.join('src', 'passTests.py') src_suite_passTests_py = os.path.join('src', 'suite', 'passTests.py') @@ -51,9 +52,9 @@ test.write_passing_test(['src', 'suite', 'pass.py']) test.write_passing_test(['src', 'suite', 'passTests.py']) expect_stdout = """\ -%(pythonstring)s -tt %(src_passTests_py)s +%(pythonstring)s%(pythonflags)s %(src_passTests_py)s PASSING TEST STDOUT -%(pythonstring)s -tt %(src_suite_passTests_py)s +%(pythonstring)s%(pythonflags)s %(src_suite_passTests_py)s PASSING TEST STDOUT """ % locals() diff --git a/test/runtest/testargv.py b/test/runtest/testargv.py index 62faf51..22e57e8 100644 --- a/test/runtest/testargv.py +++ b/test/runtest/testargv.py @@ -40,6 +40,7 @@ test.subdir('test', ['test', 'subdir']) files = {} files['pythonstring'] = TestRuntest.pythonstring +files['pythonflags'] = TestRuntest.pythonflags files['one'] = os.path.join('test/subdir', 'test_one.py') files['two'] = os.path.join('test/subdir', 'two.py') @@ -50,9 +51,9 @@ test.write_passing_test(files['two']) test.write_passing_test(files['three']) expect_stdout = """\ -%(pythonstring)s -tt %(one)s +%(pythonstring)s%(pythonflags)s %(one)s PASSING TEST STDOUT -%(pythonstring)s -tt %(two)s +%(pythonstring)s%(pythonflags)s %(two)s PASSING TEST STDOUT """ % files diff --git a/test/runtest/testlistfile.py b/test/runtest/testlistfile.py index b86b0f2..063a8d0 100644 --- a/test/runtest/testlistfile.py +++ b/test/runtest/testlistfile.py @@ -34,6 +34,7 @@ import re import TestRuntest pythonstring = TestRuntest.pythonstring +pythonflags = TestRuntest.pythonflags test_fail_py = os.path.join('test', 'fail.py') test_no_result_py = os.path.join('test', 'no_result.py') test_pass_py = os.path.join('test', 'pass.py') @@ -54,7 +55,7 @@ test.write('t.txt', """\ """ % locals()) expect_stdout = """\ -%(pythonstring)s -tt %(test_pass_py)s +%(pythonstring)s%(pythonflags)s %(test_pass_py)s PASSING TEST STDOUT """ % locals() diff --git a/test/runtest/xml/output.py b/test/runtest/xml/output.py index e669a3a..88bca04 100644 --- a/test/runtest/xml/output.py +++ b/test/runtest/xml/output.py @@ -38,6 +38,7 @@ test = TestRuntest.TestRuntest(match = TestCmd.match_re, diff = TestCmd.diff_re) pythonstring = re.escape(TestRuntest.pythonstring) +pythonflags = TestRuntest.pythonflags test_fail_py = re.escape(os.path.join('test', 'fail.py')) test_no_result_py = re.escape(os.path.join('test', 'no_result.py')) test_pass_py = re.escape(os.path.join('test', 'pass.py')) @@ -58,7 +59,7 @@ expect = """\ %(test_fail_py)s - %(pythonstring)s -tt %(test_fail_py)s + %(pythonstring)s%(pythonflags)s %(test_fail_py)s 1 FAILING TEST STDOUT @@ -68,7 +69,7 @@ expect = """\ %(test_no_result_py)s - %(pythonstring)s -tt %(test_no_result_py)s + %(pythonstring)s%(pythonflags)s %(test_no_result_py)s 2 NO RESULT TEST STDOUT @@ -78,7 +79,7 @@ expect = """\ %(test_pass_py)s - %(pythonstring)s -tt %(test_pass_py)s + %(pythonstring)s%(pythonflags)s %(test_pass_py)s 0 PASSING TEST STDOUT diff --git a/testing/framework/TestRuntest.py b/testing/framework/TestRuntest.py index 7b3bb52..faf5d60 100644 --- a/testing/framework/TestRuntest.py +++ b/testing/framework/TestRuntest.py @@ -27,6 +27,7 @@ from TestCommon import __all__ __all__.extend([ 'TestRuntest', 'pythonstring', + 'pythonflags', ]) if re.search('\s', python): @@ -34,7 +35,9 @@ if re.search('\s', python): else: pythonstring = python pythonstring = pythonstring.replace('\\', '\\\\') - +pythonflags = '' +if sys.version_info[0] < 3: + pythonflags = ' -tt' failing_test_template = """\ import sys @@ -104,7 +107,10 @@ class TestRuntest(TestCommon): if 'program' not in kw: kw['program'] = 'runtest.py' if 'interpreter' not in kw: - kw['interpreter'] = [python, '-tt'] + kw['interpreter'] = [python,] + if sys.version_info[0] < 3: + kw['interpreter'].append('-tt') + if 'match' not in kw: kw['match'] = match_exact if 'workdir' not in kw: diff --git a/testing/framework/TestSCons.py b/testing/framework/TestSCons.py index 7fe48e8..57b300d 100644 --- a/testing/framework/TestSCons.py +++ b/testing/framework/TestSCons.py @@ -247,7 +247,9 @@ class TestSCons(TestCommon): elif not self.external and not os.path.isabs(kw['program']): kw['program'] = os.path.join(self.orig_cwd, kw['program']) if 'interpreter' not in kw and not os.environ.get('SCONS_EXEC'): - kw['interpreter'] = [python, '-tt'] + kw['interpreter'] = [python,] + if sys.version_info[0] < 3: + kw['interpreter'].append('-tt') if 'match' not in kw: kw['match'] = match_exact if 'workdir' not in kw: diff --git a/testing/framework/TestSCons_time.py b/testing/framework/TestSCons_time.py index 6299f51..8260bef 100644 --- a/testing/framework/TestSCons_time.py +++ b/testing/framework/TestSCons_time.py @@ -186,7 +186,9 @@ class TestSCons_time(TestCommon): kw['program'] = p if 'interpreter' not in kw: - kw['interpreter'] = [python, '-tt'] + kw['interpreter'] = [python,] + if sys.version_info[0] < 3: + kw['interpreter'].append('-tt') if 'match' not in kw: kw['match'] = match_exact -- cgit v0.12 From 7ec2458832f757d138a396c0bb1412df5f391c9e Mon Sep 17 00:00:00 2001 From: William Deegan Date: Fri, 1 Mar 2019 12:26:21 -0800 Subject: Added logic to shortcut comparing prev_ni if there is no dependency map from previous build. This should speed up md5-timestamp builds for clean builds. Also added debug logic to dump and check aagainst previous implementation at top of FS.PY MD5_TIMESTAMP_DEBUG flag. currently set to False --- src/engine/SCons/Node/FS.py | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/src/engine/SCons/Node/FS.py b/src/engine/SCons/Node/FS.py index f2ba7be..f520af1 100644 --- a/src/engine/SCons/Node/FS.py +++ b/src/engine/SCons/Node/FS.py @@ -61,6 +61,8 @@ from . import DeciderNeedsNode print_duplicate = 0 +MD5_TIMESTAMP_DEBUG = False + def sconsign_none(node): raise NotImplementedError @@ -3335,9 +3337,16 @@ class File(Base): List of csigs for provided list of children """ prev = [] + # MD5_TIMESTAMP_DEBUG = False + + if len(dmap) == 0: + if MD5_TIMESTAMP_DEBUG: print("Nothing dmap shortcutting") + return None + if MD5_TIMESTAMP_DEBUG: print("len(dmap):%d"%len(dmap)) # First try the simple name for node c_str = str(self) + if MD5_TIMESTAMP_DEBUG: print("Checking :%s"%c_str) df = dmap.get(c_str, None) if df: return df @@ -3345,6 +3354,7 @@ class File(Base): if os.altsep: c_str = c_str.replace(os.sep, os.altsep) df = dmap.get(c_str, None) + if MD5_TIMESTAMP_DEBUG: print("-->%s"%df) if df: return df @@ -3353,12 +3363,14 @@ class File(Base): # this should yield a path which matches what's in the sconsign c_str = self.get_path() df = dmap.get(c_str, None) + if MD5_TIMESTAMP_DEBUG: print("-->%s"%df) if df: return df if os.altsep: c_str = c_str.replace(os.sep, os.altsep) df = dmap.get(c_str, None) + if MD5_TIMESTAMP_DEBUG: print("-->%s"%df) if df: return df @@ -3400,13 +3412,21 @@ class File(Base): dependency_map = self._build_dependency_map(bi) rebuilt = True + if len(dependency_map) == 0: + # If there's no dependency map, there's no need to find the + # prev_ni as there aren't any + # shortcut the rest of the logic + if MD5_TIMESTAMP_DEBUG: print("Skipping checks len(dmap)=0") + return True new_prev_ni = self._get_previous_signatures(dependency_map) new = self.changed_timestamp_match(target, new_prev_ni) - old = self.changed_timestamp_match(target, prev_ni) - if old != new: - print("Mismatch self.changed_timestamp_match(%s, prev_ni) old:%s new:%s"%(str(target), old, new)) - new_prev_ni = self._get_previous_signatures(dependency_map) + if MD5_TIMESTAMP_DEBUG: + old = self.changed_timestamp_match(target, prev_ni) + + if old != new: + print("Mismatch self.changed_timestamp_match(%s, prev_ni) old:%s new:%s"%(str(target), old, new)) + new_prev_ni = self._get_previous_signatures(dependency_map) if not new: -- cgit v0.12 From 4d40813e369694fbe3cfe5488178bbb722d67319 Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Sat, 2 Mar 2019 10:45:34 -0700 Subject: [PYPY3] [PY 3.8] CacheDir tests use context managers Python 3.8 complains about unclosed files on nearly all of the CacheDir tests. PyPy3 fails 8 of the 20 tests for the same reason, though since it's based on an earlier version of Python (3.5 at the moment) it does not display the resourcewarning messages. Update sequences of open().write() which are the primary problem area to use context managers for automatic closing, and for consistency, the rest of the open/read/write stuff as well. With this change, all these tests pass in PyPy3. Python 3.8 does not, as it is spewing other warning messages which also end up in the stderr, which is fatal to this set of tests, but it has quieted the warnings from the CacheDir tests themselves. Signed-off-by: Mats Wichmann --- test/CacheDir/CacheDir.py | 11 ++++++----- test/CacheDir/SideEffect.py | 7 ++++--- test/CacheDir/VariantDir.py | 11 ++++++----- test/CacheDir/debug.py | 11 ++++++----- test/CacheDir/environment.py | 11 ++++++----- test/CacheDir/multi-targets.py | 6 ++++-- test/CacheDir/multiple-targets.py | 6 ++++-- test/CacheDir/option--cd.py | 11 ++++++----- test/CacheDir/option--cf.py | 11 ++++++----- test/CacheDir/option--cr.py | 11 ++++++----- test/CacheDir/option--cs.py | 22 ++++++++++++---------- test/CacheDir/scanner-target.py | 5 ++--- test/CacheDir/source-scanner.py | 5 ++--- 13 files changed, 70 insertions(+), 58 deletions(-) diff --git a/test/CacheDir/CacheDir.py b/test/CacheDir/CacheDir.py index 3d2c3b5..3b3e72b 100644 --- a/test/CacheDir/CacheDir.py +++ b/test/CacheDir/CacheDir.py @@ -53,11 +53,12 @@ SConscript('SConscript') test.write(['src', 'SConscript'], """\ def cat(env, source, target): target = str(target[0]) - open('cat.out', 'a').write(target + "\\n") - f = open(target, "w") - for src in source: - f.write(open(str(src), "r").read()) - f.close() + with open('cat.out', 'a') as f: + f.write(target + "\\n") + with open(target, "w") as f: + for src in source: + with open(str(src), "r") as f2: + f.write(f2.read()) env = Environment(tools=[], BUILDERS={'Cat':Builder(action=cat)}) env.Cat('aaa.out', 'aaa.in') env.Cat('bbb.out', 'bbb.in') diff --git a/test/CacheDir/SideEffect.py b/test/CacheDir/SideEffect.py index 4eae4c3..3242e78 100644 --- a/test/CacheDir/SideEffect.py +++ b/test/CacheDir/SideEffect.py @@ -39,15 +39,16 @@ cache = test.workpath('cache') test.write(['work', 'SConstruct'], """\ DefaultEnvironment(tools=[]) def copy(source, target): - open(target, "w").write(open(source, "r").read()) + with open(target, "w") as f, open(source, "r") as f2: + f.write(f2.read()) def build(env, source, target): s = str(source[0]) t = str(target[0]) copy(s, t) if target[0].side_effects: - side_effect = open(str(target[0].side_effects[0]), "a") - side_effect.write(s + ' -> ' + t + '\\n') + with open(str(target[0].side_effects[0]), "a") as side_effect: + side_effect.write(s + ' -> ' + t + '\\n') CacheDir(r'%(cache)s') diff --git a/test/CacheDir/VariantDir.py b/test/CacheDir/VariantDir.py index 58918be..2c3d73f 100644 --- a/test/CacheDir/VariantDir.py +++ b/test/CacheDir/VariantDir.py @@ -42,11 +42,12 @@ cat_out = test.workpath('cat.out') test.write(['src', 'SConscript'], """\ def cat(env, source, target): target = str(target[0]) - open('cat.out', 'a').write(target + "\\n") - f = open(target, "w") - for src in source: - f.write(open(str(src), "r").read()) - f.close() + with open('cat.out', 'a') as f: + f.write(target + "\\n") + with open(target, "w") as f: + for src in source: + with open(str(src), "r") as f2: + f.write(f2.read()) env = Environment(tools=[], BUILDERS={'Cat':Builder(action=cat)}) env.Cat('aaa.out', 'aaa.in') env.Cat('bbb.out', 'bbb.in') diff --git a/test/CacheDir/debug.py b/test/CacheDir/debug.py index 7e08e0b..16f4702 100644 --- a/test/CacheDir/debug.py +++ b/test/CacheDir/debug.py @@ -53,11 +53,12 @@ SConscript('SConscript') test.write(['src', 'SConscript'], """\ def cat(env, source, target): target = str(target[0]) - open('cat.out', 'a').write(target + "\\n") - f = open(target, "w") - for src in source: - f.write(open(str(src), "r").read()) - f.close() + with open('cat.out', 'a') as f: + f.write(target + "\\n") + with open(target, "w") as f: + for src in source: + with open(str(src), "r") as f2: + f.write(f2.read()) env = Environment(tools=[], BUILDERS={'Cat':Builder(action=cat)}) env.Cat('aaa.out', 'aaa.in') env.Cat('bbb.out', 'bbb.in') diff --git a/test/CacheDir/environment.py b/test/CacheDir/environment.py index 5d8eb6c..1024ce0 100644 --- a/test/CacheDir/environment.py +++ b/test/CacheDir/environment.py @@ -54,11 +54,12 @@ SConscript('SConscript') test.write(['src', 'SConscript'], """\ def cat(env, source, target): target = str(target[0]) - open('cat.out', 'a').write(target + "\\n") - f = open(target, "w") - for src in source: - f.write(open(str(src), "r").read()) - f.close() + with open('cat.out', 'a') as f: + f.write(target + "\\n") + with open(target, "w") as f: + for src in source: + with open(str(src), "r") as f2: + f.write(f2.read()) env_cache = Environment(tools=[], BUILDERS={'Cat':Builder(action=cat)}) env_nocache = env_cache.Clone() env_nocache.CacheDir(None) diff --git a/test/CacheDir/multi-targets.py b/test/CacheDir/multi-targets.py index 7977ba0..fa6e8d1 100644 --- a/test/CacheDir/multi-targets.py +++ b/test/CacheDir/multi-targets.py @@ -42,8 +42,10 @@ multiple_foo = test.workpath('multiple', 'foo') test.write(['multiple', 'SConstruct'], """\ DefaultEnvironment(tools=[]) def touch(env, source, target): - open('foo', 'w').write("") - open('bar', 'w').write("") + with open('foo', 'w') as f: + f.write("") + with open('bar', 'w') as f: + f.write("") CacheDir(r'%(cache)s') env = Environment(tools=[]) env.Command(['foo', 'bar'], ['input'], touch) diff --git a/test/CacheDir/multiple-targets.py b/test/CacheDir/multiple-targets.py index 9f94e4c..99ab8da 100644 --- a/test/CacheDir/multiple-targets.py +++ b/test/CacheDir/multiple-targets.py @@ -40,8 +40,10 @@ test.subdir('cache') test.write('SConstruct', """\ DefaultEnvironment(tools=[]) def touch(env, source, target): - open('foo', 'w').write("") - open('bar', 'w').write("") + with open('foo', 'w') as f: + f.write("") + with open('bar', 'w') as f: + f.write("") CacheDir(r'%s') env = Environment(tools=[], ) env.Command(['foo', 'bar'], ['input'], touch) diff --git a/test/CacheDir/option--cd.py b/test/CacheDir/option--cd.py index 20d1184..1620858 100644 --- a/test/CacheDir/option--cd.py +++ b/test/CacheDir/option--cd.py @@ -42,11 +42,12 @@ test.write(['src', 'SConstruct'], """ DefaultEnvironment(tools=[]) def cat(env, source, target): target = str(target[0]) - open('cat.out', 'a').write(target + "\\n") - f = open(target, "w") - for src in source: - f.write(open(str(src), "r").read()) - f.close() + with open('cat.out', 'a') as f: + f.write(target + "\\n") + with open(target, "w") as f: + for src in source: + with open(str(src), "r") as f2: + f.write(f2.read()) env = Environment(tools=[], BUILDERS={'Cat':Builder(action=cat)}) env.Cat('aaa.out', 'aaa.in') env.Cat('bbb.out', 'bbb.in') diff --git a/test/CacheDir/option--cf.py b/test/CacheDir/option--cf.py index 5e823ae..2d51e03 100644 --- a/test/CacheDir/option--cf.py +++ b/test/CacheDir/option--cf.py @@ -41,11 +41,12 @@ test.write(['src', 'SConstruct'], """ DefaultEnvironment(tools=[]) def cat(env, source, target): target = str(target[0]) - open('cat.out', 'a').write(target + "\\n") - f = open(target, "w") - for src in source: - f.write(open(str(src), "r").read()) - f.close() + with open('cat.out', 'a') as f: + f.write(target + "\\n") + with open(target, "w") as f: + for src in source: + with open(str(src), "r") as f2: + f.write(f2.read()) env = Environment(tools=[], BUILDERS={'Cat':Builder(action=cat)}) env.Cat('aaa.out', 'aaa.in') env.Cat('bbb.out', 'bbb.in') diff --git a/test/CacheDir/option--cr.py b/test/CacheDir/option--cr.py index 4ed587c..b7696c5 100644 --- a/test/CacheDir/option--cr.py +++ b/test/CacheDir/option--cr.py @@ -42,11 +42,12 @@ test.write(['src', 'SConstruct'], """ DefaultEnvironment(tools=[]) def cat(env, source, target): target = str(target[0]) - open('cat.out', 'a').write(target + "\\n") - f = open(target, "w") - for src in source: - f.write(open(str(src), "r").read()) - f.close() + with open('cat.out', 'a') as f: + f.write(target + "\\n") + with open(target, "w") as f: + for src in source: + with open(str(src), "r") as f2: + f.write(f2.read()) env = Environment(tools=[], BUILDERS={'Cat':Builder(action=cat)}) env.Cat('aaa.out', 'aaa.in') env.Cat('bbb.out', 'bbb.in') diff --git a/test/CacheDir/option--cs.py b/test/CacheDir/option--cs.py index b73fb70..feb89bd 100644 --- a/test/CacheDir/option--cs.py +++ b/test/CacheDir/option--cs.py @@ -45,11 +45,12 @@ test.subdir('cache', 'src1', 'src2') test.write(['src1', 'build.py'], r""" import sys -open('cat.out', 'a').write(sys.argv[1] + "\n") -file = open(sys.argv[1], 'w') -for src in sys.argv[2:]: - file.write(open(src, 'r').read()) -file.close() +with open('cat.out', 'a') as f: + f.write(sys.argv[1] + "\n") +with open(sys.argv[1], 'w') as f: + for src in sys.argv[2:]: + with open(src, 'r') as f2: + f.write(f2.read()) """) cache = test.workpath('cache') @@ -58,11 +59,12 @@ test.write(['src1', 'SConstruct'], """ DefaultEnvironment(tools=[]) def cat(env, source, target): target = str(target[0]) - open('cat.out', 'a').write(target + "\\n") - f = open(target, "w") - for src in source: - f.write(open(str(src), "r").read()) - f.close() + with open('cat.out', 'a') as f: + f.write(target + "\\n") + with open(target, "w") as f: + for src in source: + with open(str(src), "r") as f2: + f.write(f2.read()) env = Environment(tools=[], BUILDERS={'Internal':Builder(action=cat), 'External':Builder(action=r'%(_python_)s build.py $TARGET $SOURCES')}) diff --git a/test/CacheDir/scanner-target.py b/test/CacheDir/scanner-target.py index 7df9792..249e587 100644 --- a/test/CacheDir/scanner-target.py +++ b/test/CacheDir/scanner-target.py @@ -48,9 +48,8 @@ CacheDir(r'%s') def docopy(target,source,env): data = source[0].get_contents() - f = open(target[0].rfile().get_abspath(), "wb") - f.write(data) - f.close() + with open(target[0].rfile().get_abspath(), "wb") as f: + f.write(data) def sillyScanner(node, env, dirs): print('This is never called (unless we build file.out)') diff --git a/test/CacheDir/source-scanner.py b/test/CacheDir/source-scanner.py index f00360d..1c56499 100644 --- a/test/CacheDir/source-scanner.py +++ b/test/CacheDir/source-scanner.py @@ -50,9 +50,8 @@ CacheDir(r'%(cache)s') def docopy(target,source,env): data = source[0].get_contents() - f = open(target[0].rfile().get_abspath(), "wb") - f.write(data) - f.close() + with open(target[0].rfile().get_abspath(), "wb") as f: + f.write(data) def sillyScanner(node, env, dirs): print('This is never called (unless we build file.out)') -- cgit v0.12 From bbb5d2ccc6a0b37611b4877d8bb1d6b969da7bf2 Mon Sep 17 00:00:00 2001 From: William Deegan Date: Sat, 2 Mar 2019 14:10:59 -0500 Subject: Forgot to add current file csig when shortcutting calling changed_content(). Directly calling get_csig() when there is no previous build history --- src/engine/SCons/Node/FS.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/engine/SCons/Node/FS.py b/src/engine/SCons/Node/FS.py index f520af1..61054f3 100644 --- a/src/engine/SCons/Node/FS.py +++ b/src/engine/SCons/Node/FS.py @@ -3417,7 +3417,12 @@ class File(Base): # prev_ni as there aren't any # shortcut the rest of the logic if MD5_TIMESTAMP_DEBUG: print("Skipping checks len(dmap)=0") + + # We still need to get the current file's csig + # This should be slightly faster than calling self.changed_content(target, new_prev_ni) + self.get_csig() return True + new_prev_ni = self._get_previous_signatures(dependency_map) new = self.changed_timestamp_match(target, new_prev_ni) -- cgit v0.12 From e6d14fd285273bfa952930ded2c20380f8eec8bc Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Sat, 2 Mar 2019 13:49:22 -0700 Subject: [PYPY] [PY 3.8] more context manager use in tests Similar to #3319, add additional use of context managers inside written tests. Fixes som PyPy3 fails and quiets matching warnings from Python 3.8. Signed-off-by: Mats Wichmann --- test/Actions/pre-post.py | 16 ++++++------- test/SideEffect/basic.py | 7 +++--- test/SideEffect/variant_dir.py | 7 +++--- test/VariantDir/errors.py | 51 ++++++++++++++++++++---------------------- 4 files changed, 40 insertions(+), 41 deletions(-) diff --git a/test/Actions/pre-post.py b/test/Actions/pre-post.py index a5acbfb..cd0bfb4 100644 --- a/test/Actions/pre-post.py +++ b/test/Actions/pre-post.py @@ -47,13 +47,11 @@ env = Environment(XXX='bar%(_exe)s') def before(env, target, source): a=str(target[0]) - f=open(a, "wb") - f.write(b"Foo\\n") - f.close() + with open(a, "wb") as f: + f.write(b"Foo\\n") os.chmod(a, os.stat(a)[stat.ST_MODE] | stat.S_IXUSR) - f=open("before.txt", "ab") - f.write((os.path.splitext(str(target[0]))[0] + "\\n").encode()) - f.close() + with open("before.txt", "ab") as f: + f.write((os.path.splitext(str(target[0]))[0] + "\\n").encode()) def after(env, target, source): t = str(target[0]) @@ -106,9 +104,11 @@ test.must_match(['work3', 'dir', 'file'], "build()\n") # work4 start test.write(['work4', 'SConstruct'], """\ def pre_action(target, source, env): - open(str(target[0]), 'ab').write(('pre %%s\\n' %% source[0]).encode()) + with open(str(target[0]), 'ab') as f: + f.write(('pre %%s\\n' %% source[0]).encode()) def post_action(target, source, env): - open(str(target[0]), 'ab').write(('post %%s\\n' %% source[0]).encode()) + with open(str(target[0]), 'ab') as f: + f.write(('post %%s\\n' %% source[0]).encode()) env = Environment() o = env.Command(['pre-post', 'file.out'], 'file.in', diff --git a/test/SideEffect/basic.py b/test/SideEffect/basic.py index af6c264..b5b6381 100644 --- a/test/SideEffect/basic.py +++ b/test/SideEffect/basic.py @@ -37,13 +37,14 @@ test = TestSCons.TestSCons() test.write('SConstruct', """\ def copy(source, target): - open(target, "wb").write(open(source, "rb").read()) + with open(target, "wb") as f, open(source, "rb") as f2: + f.write(f2.read()) def build(env, source, target): copy(str(source[0]), str(target[0])) if target[0].side_effects: - side_effect = open(str(target[0].side_effects[0]), "ab") - side_effect.write(('%%s -> %%s\\n'%%(str(source[0]), str(target[0]))).encode()) + with open(str(target[0].side_effects[0]), "ab") as side_effect: + side_effect.write(('%%s -> %%s\\n'%%(str(source[0]), str(target[0]))).encode()) Build = Builder(action=build) env = Environment(BUILDERS={'Build':Build}, SUBDIR='subdir') diff --git a/test/SideEffect/variant_dir.py b/test/SideEffect/variant_dir.py index 711e426..0e9ae53 100644 --- a/test/SideEffect/variant_dir.py +++ b/test/SideEffect/variant_dir.py @@ -38,13 +38,14 @@ test = TestSCons.TestSCons() test.write('SConstruct', """ def copy(source, target): - open(target, "wb").write(open(source, "rb").read()) + with open(target, "wb") as f, open(source, "rb") as f2: + f.write(f2.read()) def build(env, source, target): copy(str(source[0]), str(target[0])) if target[0].side_effects: - side_effect = open(str(target[0].side_effects[0]), "ab") - side_effect.write(('%s -> %s\\n'%(str(source[0]), str(target[0]))).encode()) + with open(str(target[0].side_effects[0]), "ab") as side_effect: + side_effect.write(('%s -> %s\\n'%(str(source[0]), str(target[0]))).encode()) Build = Builder(action=build) env = Environment(BUILDERS={'Build':Build}) diff --git a/test/VariantDir/errors.py b/test/VariantDir/errors.py index c74d103..d3ecd54 100644 --- a/test/VariantDir/errors.py +++ b/test/VariantDir/errors.py @@ -57,10 +57,10 @@ def fake_scan(node, env, target): def cat(env, source, target): target = str(target[0]) - f = open(target, "w") - for src in source: - f.write(open(str(src), "r").read()) - f.close() + with open(target, "w") as f: + for src in source: + with open(str(src), "r") as f2: + f.write(f2.read()) env = Environment(BUILDERS={'Build':Builder(action=cat)}, SCANNERS=[Scanner(fake_scan, skeys = ['.in'])]) @@ -101,16 +101,15 @@ test.subdir(dir) SConscript = test.workpath(dir, 'SConscript') test.write(SConscript, '') os.chmod(SConscript, os.stat(SConscript)[stat.ST_MODE] & ~stat.S_IWUSR) -f = open(SConscript, 'r') -os.chmod(dir, os.stat(dir)[stat.ST_MODE] & ~stat.S_IWUSR) +with open(SConscript, 'r'): + os.chmod(dir, os.stat(dir)[stat.ST_MODE] & ~stat.S_IWUSR) -test.run(chdir = 'ro-SConscript', - arguments = ".", - status = 2, - stderr = "scons: *** Cannot duplicate `%s' in `build': Permission denied. Stop.\n" % os.path.join('src', 'SConscript')) + test.run(chdir = 'ro-SConscript', + arguments = ".", + status = 2, + stderr = "scons: *** Cannot duplicate `%s' in `build': Permission denied. Stop.\n" % os.path.join('src', 'SConscript')) -os.chmod('ro-SConscript', os.stat('ro-SConscript')[stat.ST_MODE] | stat.S_IWUSR) -f.close() + os.chmod('ro-SConscript', os.stat('ro-SConscript')[stat.ST_MODE] | stat.S_IWUSR) test.run(chdir = 'ro-SConscript', arguments = ".", @@ -129,25 +128,23 @@ test.write([dir, 'SConscript'], '') file_in = test.workpath(dir, 'file.in') test.write(file_in, '') os.chmod(file_in, os.stat(file_in)[stat.ST_MODE] & ~stat.S_IWUSR) -f = open(file_in, 'r') -os.chmod(dir, os.stat(dir)[stat.ST_MODE] & ~stat.S_IWUSR) +with open(file_in, 'r'): + os.chmod(dir, os.stat(dir)[stat.ST_MODE] & ~stat.S_IWUSR) -test.run(chdir = 'ro-src', - arguments = ".", - status = 2, - stderr = """\ -scons: *** Cannot duplicate `%s' in `build': Permission denied. Stop. -""" % (os.path.join('src', 'file.in'))) + test.run(chdir = 'ro-src', + arguments = ".", + status = 2, + stderr = """\ + scons: *** Cannot duplicate `%s' in `build': Permission denied. Stop. + """ % (os.path.join('src', 'file.in'))) -test.run(chdir = 'ro-src', - arguments = "-k .", - status = 2, - stderr = """\ -scons: *** Cannot duplicate `%s' in `build': Permission denied. Stop. + test.run(chdir = 'ro-src', + arguments = "-k .", + status = 2, + stderr = """\ + scons: *** Cannot duplicate `%s' in `build': Permission denied. Stop. """ % (os.path.join('src', 'file.in'))) -f.close() - # ensure that specifying multiple source directories for one # build directory results in an error message, rather # than just silently failing. -- cgit v0.12 From e7e70407bd54811604f8e907819e36a6025f7915 Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Sat, 2 Mar 2019 15:35:59 -0700 Subject: For PR #3320 re-unindent expect strings in with block Previous change created a with: block but accidentally indented two literal strings used as the expected stderr, causing them to no longer match; these are restored to original state. Signed-off-by: Mats Wichmann --- test/VariantDir/errors.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/VariantDir/errors.py b/test/VariantDir/errors.py index d3ecd54..26ef4a2 100644 --- a/test/VariantDir/errors.py +++ b/test/VariantDir/errors.py @@ -135,14 +135,14 @@ with open(file_in, 'r'): arguments = ".", status = 2, stderr = """\ - scons: *** Cannot duplicate `%s' in `build': Permission denied. Stop. - """ % (os.path.join('src', 'file.in'))) +scons: *** Cannot duplicate `%s' in `build': Permission denied. Stop. +""" % (os.path.join('src', 'file.in'))) test.run(chdir = 'ro-src', arguments = "-k .", status = 2, stderr = """\ - scons: *** Cannot duplicate `%s' in `build': Permission denied. Stop. +scons: *** Cannot duplicate `%s' in `build': Permission denied. Stop. """ % (os.path.join('src', 'file.in'))) # ensure that specifying multiple source directories for one -- cgit v0.12 From 701ffd2746fbabe4d1908abbcb4a2d29eaf688f4 Mon Sep 17 00:00:00 2001 From: William Deegan Date: Sat, 2 Mar 2019 17:27:31 -0800 Subject: copy logic from lex to find win_bison if installed via chocolatey --- src/engine/SCons/Tool/yacc.py | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/src/engine/SCons/Tool/yacc.py b/src/engine/SCons/Tool/yacc.py index cd9b9a8..5db49d3 100644 --- a/src/engine/SCons/Tool/yacc.py +++ b/src/engine/SCons/Tool/yacc.py @@ -41,6 +41,7 @@ import SCons.Tool import SCons.Util from SCons.Platform.mingw import MINGW_DEFAULT_PATHS from SCons.Platform.cygwin import CYGWIN_DEFAULT_PATHS +from SCons.Platform.win32 import CHOCO_DEFAULT_PATH YaccAction = SCons.Action.Action("$YACCCOM", "$YACCCOMSTR") @@ -97,6 +98,28 @@ def ymEmitter(target, source, env): def yyEmitter(target, source, env): return _yaccEmitter(target, source, env, ['.yy'], '$YACCHXXFILESUFFIX') +def get_yacc_path(env, append_paths=False): + """ + Find the a path containing the lex or flex binaries. If a construction + environment is passed in then append the path to the ENV PATH. + """ + # save existing path to reset if we don't want to append any paths + envPath = env['ENV']['PATH'] + bins = ['bison', 'yacc', 'win_bison'] + + for prog in bins: + bin_path = SCons.Tool.find_program_path( + env, + prog, + default_paths=CHOCO_DEFAULT_PATH + MINGW_DEFAULT_PATHS + CYGWIN_DEFAULT_PATHS ) + if bin_path: + if not append_paths: + env['ENV']['PATH'] = envPath + else: + env.AppendENVPath('PATH', os.path.dirname(bin_path)) + return bin_path + SCons.Warnings.Warning('lex tool requested, but lex or flex binary not found in ENV PATH') + def generate(env): """Add Builders and construction variables for yacc to an Environment.""" c_file, cxx_file = SCons.Tool.createCFileBuilders(env) @@ -124,7 +147,12 @@ def generate(env): else: SCons.Warnings.Warning('yacc tool requested, but bison binary not found in ENV PATH') - env['YACC'] = env.Detect('bison') or 'yacc' + if sys.platform == 'win32': + get_yacc_path(env, append_paths=True) + env["YACC"] = env.Detect(['bison', 'yacc', 'win_bison']) + else: + env["YACC"] = env.Detect(["bison", "yacc"]) + env['YACCFLAGS'] = SCons.Util.CLVar('') env['YACCCOM'] = '$YACC $YACCFLAGS -o $TARGET $SOURCES' env['YACCHFILESUFFIX'] = '.h' -- cgit v0.12 From 08f5e913d3b70a07672873c4573e236c4ccc7ac1 Mon Sep 17 00:00:00 2001 From: William Deegan Date: Sat, 2 Mar 2019 20:52:32 -0500 Subject: Add support for usign chocolatey install winflexbison package with tools named win_bison --- src/CHANGES.txt | 3 ++- test/YACC/live-check-output-cleaned.py | 3 ++- test/YACC/live.py | 7 ++----- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index d4576a1..0a80095 100755 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -16,6 +16,7 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER leaving TypeError Nonetype exception in config.log - Fix Issue #3303 - Handle --config=force overwriting the Environment passed into Configure()'s Decider and not clearing it when the configure context is completed. + - Add default paths for yacc tool on windows to include cygwin, mingw, and chocolatey From Daniel Moody: - Change the default for AppendENVPath to delete_existing=0, so path @@ -23,7 +24,7 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER - Fixed bug which threw error when running SCons on windows system with no MSVC installed. - Update link tool to convert target to node before accessing node member - Update mingw tool to remove MSVC like nologo CCFLAG - - Add default paths for lex tool on windows + - Add default paths for lex tool on windows to include cygwin, mingw, and chocolatey - Add lex construction variable LEXUNISTD for turning off unix headers on windows - Update lex tool to use win_flex on windows if available diff --git a/test/YACC/live-check-output-cleaned.py b/test/YACC/live-check-output-cleaned.py index 8329b94..9adaaf0 100644 --- a/test/YACC/live-check-output-cleaned.py +++ b/test/YACC/live-check-output-cleaned.py @@ -34,12 +34,13 @@ _exe = TestSCons._exe test = TestSCons.TestSCons() -yacc = test.where_is('yacc') or test.where_is('bison') +yacc = test.where_is('yacc') or test.where_is('bison') or test.where_is('win_bison') if not yacc: test.skip_test('No yacc or bison found; skipping test.\n') test.write('SConstruct', """ +DefaultEnvironment(tools=[]) foo = Environment(YACCFLAGS='-v -d', tools = ['default', 'yacc']) foo.CFile(source = 'foo.y') """ % locals()) diff --git a/test/YACC/live.py b/test/YACC/live.py index a79d3db..4567dba 100644 --- a/test/YACC/live.py +++ b/test/YACC/live.py @@ -37,18 +37,15 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() -yacc = test.where_is('yacc') or test.where_is('bison') +yacc = test.where_is('yacc') or test.where_is('bison') or test.where_is('win_bison') if not yacc: test.skip_test('No yacc or bison found; skipping test.\n') -if sys.platform == 'win32': - if not test.where_is('gcc'): - test.skip_test('No gcc found on windows; skipping test.\n') - test.file_fixture('wrapper.py') test.write('SConstruct', """ +DefaultEnvironment(tools=[]) foo = Environment(YACCFLAGS='-d', tools = ['default', 'yacc']) yacc = foo.Dictionary('YACC') bar = Environment(YACC = r'%(_python_)s wrapper.py ' + yacc, tools = ['default', 'yacc']) -- cgit v0.12 From 9bbb976181f4cd5b6261993bae9fb5535bf07587 Mon Sep 17 00:00:00 2001 From: William Deegan Date: Tue, 26 Feb 2019 21:52:46 -0800 Subject: On windows first try with native file paths with \\ then swap path to normalized path string with / separators. On a fresh windows build the node string will have windows dirsep and not normalizd. This yielded broken builds for the Meta project' --- src/engine/SCons/Node/FS.py | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/src/engine/SCons/Node/FS.py b/src/engine/SCons/Node/FS.py index 77c340f..f2ba7be 100644 --- a/src/engine/SCons/Node/FS.py +++ b/src/engine/SCons/Node/FS.py @@ -3338,17 +3338,29 @@ class File(Base): # First try the simple name for node c_str = str(self) + df = dmap.get(c_str, None) + if df: + return df + if os.altsep: c_str = c_str.replace(os.sep, os.altsep) - df = dmap.get(c_str, None) + df = dmap.get(c_str, None) + if df: + return df + if not df: try: # this should yield a path which matches what's in the sconsign c_str = self.get_path() + df = dmap.get(c_str, None) + if df: + return df + if os.altsep: c_str = c_str.replace(os.sep, os.altsep) - - df = dmap.get(c_str, None) + df = dmap.get(c_str, None) + if df: + return df except AttributeError as e: raise FileBuildInfoFileToCsigMappingError("No mapping from file name to content signature for :%s"%c_str) @@ -3388,16 +3400,23 @@ class File(Base): dependency_map = self._build_dependency_map(bi) rebuilt = True - prev_ni = self._get_previous_signatures(dependency_map) + new_prev_ni = self._get_previous_signatures(dependency_map) + new = self.changed_timestamp_match(target, new_prev_ni) + old = self.changed_timestamp_match(target, prev_ni) + + if old != new: + print("Mismatch self.changed_timestamp_match(%s, prev_ni) old:%s new:%s"%(str(target), old, new)) + new_prev_ni = self._get_previous_signatures(dependency_map) + - if not self.changed_timestamp_match(target, prev_ni): + if not new: try: # NOTE: We're modifying the current node's csig in a query. - self.get_ninfo().csig = prev_ni.csig + self.get_ninfo().csig = new_prev_ni.csig except AttributeError: pass return False - return self.changed_content(target, prev_ni) + return self.changed_content(target, new_prev_ni) def changed_timestamp_newer(self, target, prev_ni): try: -- cgit v0.12 From 9c6608bc1069d8bfd199e30801b2d1118c0137af Mon Sep 17 00:00:00 2001 From: William Deegan Date: Fri, 1 Mar 2019 12:26:21 -0800 Subject: Added logic to shortcut comparing prev_ni if there is no dependency map from previous build. This should speed up md5-timestamp builds for clean builds. Also added debug logic to dump and check aagainst previous implementation at top of FS.PY MD5_TIMESTAMP_DEBUG flag. currently set to False --- src/engine/SCons/Node/FS.py | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/src/engine/SCons/Node/FS.py b/src/engine/SCons/Node/FS.py index f2ba7be..f520af1 100644 --- a/src/engine/SCons/Node/FS.py +++ b/src/engine/SCons/Node/FS.py @@ -61,6 +61,8 @@ from . import DeciderNeedsNode print_duplicate = 0 +MD5_TIMESTAMP_DEBUG = False + def sconsign_none(node): raise NotImplementedError @@ -3335,9 +3337,16 @@ class File(Base): List of csigs for provided list of children """ prev = [] + # MD5_TIMESTAMP_DEBUG = False + + if len(dmap) == 0: + if MD5_TIMESTAMP_DEBUG: print("Nothing dmap shortcutting") + return None + if MD5_TIMESTAMP_DEBUG: print("len(dmap):%d"%len(dmap)) # First try the simple name for node c_str = str(self) + if MD5_TIMESTAMP_DEBUG: print("Checking :%s"%c_str) df = dmap.get(c_str, None) if df: return df @@ -3345,6 +3354,7 @@ class File(Base): if os.altsep: c_str = c_str.replace(os.sep, os.altsep) df = dmap.get(c_str, None) + if MD5_TIMESTAMP_DEBUG: print("-->%s"%df) if df: return df @@ -3353,12 +3363,14 @@ class File(Base): # this should yield a path which matches what's in the sconsign c_str = self.get_path() df = dmap.get(c_str, None) + if MD5_TIMESTAMP_DEBUG: print("-->%s"%df) if df: return df if os.altsep: c_str = c_str.replace(os.sep, os.altsep) df = dmap.get(c_str, None) + if MD5_TIMESTAMP_DEBUG: print("-->%s"%df) if df: return df @@ -3400,13 +3412,21 @@ class File(Base): dependency_map = self._build_dependency_map(bi) rebuilt = True + if len(dependency_map) == 0: + # If there's no dependency map, there's no need to find the + # prev_ni as there aren't any + # shortcut the rest of the logic + if MD5_TIMESTAMP_DEBUG: print("Skipping checks len(dmap)=0") + return True new_prev_ni = self._get_previous_signatures(dependency_map) new = self.changed_timestamp_match(target, new_prev_ni) - old = self.changed_timestamp_match(target, prev_ni) - if old != new: - print("Mismatch self.changed_timestamp_match(%s, prev_ni) old:%s new:%s"%(str(target), old, new)) - new_prev_ni = self._get_previous_signatures(dependency_map) + if MD5_TIMESTAMP_DEBUG: + old = self.changed_timestamp_match(target, prev_ni) + + if old != new: + print("Mismatch self.changed_timestamp_match(%s, prev_ni) old:%s new:%s"%(str(target), old, new)) + new_prev_ni = self._get_previous_signatures(dependency_map) if not new: -- cgit v0.12 From 3a107dcd6c93520f41c54b25a322317bfd1b8460 Mon Sep 17 00:00:00 2001 From: William Deegan Date: Sat, 2 Mar 2019 21:56:53 -0500 Subject: Add test to cover this issue with MD5-timestamp decider breaking dependencies only on windows when one generated souce implicitly depends on another generated source. --- test/Decider/MD5-winonly-firstbuild.py | 60 +++++++++++++++++++++++++ test/Decider/MD5-winonly-fixture/SConstruct | 9 ++++ test/Decider/MD5-winonly-fixture/sconstest.skip | 0 test/Decider/MD5-winonly-fixture/test_lex.l | 10 +++++ test/Decider/MD5-winonly-fixture/test_parse.y | 43 ++++++++++++++++++ 5 files changed, 122 insertions(+) create mode 100644 test/Decider/MD5-winonly-firstbuild.py create mode 100644 test/Decider/MD5-winonly-fixture/SConstruct create mode 100644 test/Decider/MD5-winonly-fixture/sconstest.skip create mode 100644 test/Decider/MD5-winonly-fixture/test_lex.l create mode 100644 test/Decider/MD5-winonly-fixture/test_parse.y diff --git a/test/Decider/MD5-winonly-firstbuild.py b/test/Decider/MD5-winonly-firstbuild.py new file mode 100644 index 0000000..4047ea8 --- /dev/null +++ b/test/Decider/MD5-winonly-firstbuild.py @@ -0,0 +1,60 @@ +#!/usr/bin/env python +# +# __COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +""" +Test but which only shows on windows when one generated file depends on another generated file +In this case flex and yacc are an example. +""" + +import os +import stat + +import TestSCons +from TestCmd import IS_WINDOWS + + +test = TestSCons.TestSCons() + +if IS_WINDOWS: + yacc = test.where_is('yacc') or test.where_is('bison') or test.where_is('win_bison') + lex = test.where_is('flex') or test.where_is('lex') or test.where_is('win_flex') + # print("Lex:%s yacc:%s"%(lex,yacc)) + if not yacc or not lex: + test.skip("On windows but no flex/lex/win_flex and yacc/bison/win_bison required for test") +else: + test.skip("Windows only test") + + +test.dir_fixture('MD5-winonly-fixture') +test.run() + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/Decider/MD5-winonly-fixture/SConstruct b/test/Decider/MD5-winonly-fixture/SConstruct new file mode 100644 index 0000000..c194c47 --- /dev/null +++ b/test/Decider/MD5-winonly-fixture/SConstruct @@ -0,0 +1,9 @@ +DefaultEnvironment(tools=[]) +env=Environment() +env.Decider('MD5-timestamp') +env.AppendENVPath('PATH', r'd:\mesa\flexbison') +env.Tool('lex') +env.Tool('yacc') +env['YACCFLAGS'] = '-d' +env.Append(LEXFLAGS = ['--wincompat']) +env.SharedLibrary('dummy',['test_lex.l','test_parse.y']) diff --git a/test/Decider/MD5-winonly-fixture/sconstest.skip b/test/Decider/MD5-winonly-fixture/sconstest.skip new file mode 100644 index 0000000..e69de29 diff --git a/test/Decider/MD5-winonly-fixture/test_lex.l b/test/Decider/MD5-winonly-fixture/test_lex.l new file mode 100644 index 0000000..269b984 --- /dev/null +++ b/test/Decider/MD5-winonly-fixture/test_lex.l @@ -0,0 +1,10 @@ +%{ + +#include +#include "test_parse.h" +int c; +%} +%% + +%% + diff --git a/test/Decider/MD5-winonly-fixture/test_parse.y b/test/Decider/MD5-winonly-fixture/test_parse.y new file mode 100644 index 0000000..3ead9d2 --- /dev/null +++ b/test/Decider/MD5-winonly-fixture/test_parse.y @@ -0,0 +1,43 @@ +%{ +#include + +int regs[26]; +int base; + +%} + +%start digit + +%union { int a; } + + +%token DIGIT LETTER + +%left '|' +%left '&' +%left '+' '-' +%left '*' '/' '%' +%left UMINUS /*supplies precedence for unary minus */ + +%% /* beginning of rules section */ + +digit: DIGIT; + + +%% +main() +{ + return(yyparse()); +} + +yyerror(s) +char *s; +{ + fprintf(stderr, "%s\n",s); + return(0); +} + +yywrap() +{ + return(1); +} \ No newline at end of file -- cgit v0.12 From a6849f5629cbcc5a1c8693f398b9641cbc92208f Mon Sep 17 00:00:00 2001 From: William Deegan Date: Sun, 3 Mar 2019 10:29:52 -0500 Subject: fix typo in skip_test --- test/Decider/MD5-winonly-firstbuild.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/Decider/MD5-winonly-firstbuild.py b/test/Decider/MD5-winonly-firstbuild.py index 4047ea8..1e1b51e 100644 --- a/test/Decider/MD5-winonly-firstbuild.py +++ b/test/Decider/MD5-winonly-firstbuild.py @@ -43,9 +43,9 @@ if IS_WINDOWS: lex = test.where_is('flex') or test.where_is('lex') or test.where_is('win_flex') # print("Lex:%s yacc:%s"%(lex,yacc)) if not yacc or not lex: - test.skip("On windows but no flex/lex/win_flex and yacc/bison/win_bison required for test") + test.skip_test("On windows but no flex/lex/win_flex and yacc/bison/win_bison required for test") else: - test.skip("Windows only test") + test.skip_test("Windows only test") test.dir_fixture('MD5-winonly-fixture') -- cgit v0.12 From 9fe21847c4c987792326d515a851b673d96af930 Mon Sep 17 00:00:00 2001 From: William Deegan Date: Sun, 3 Mar 2019 12:56:55 -0500 Subject: Fix logic in test to only use --wincompat if win_flex. Improve test skip messaging --- test/Decider/MD5-winonly-firstbuild.py | 4 ++-- test/Decider/MD5-winonly-fixture/SConstruct | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/test/Decider/MD5-winonly-firstbuild.py b/test/Decider/MD5-winonly-firstbuild.py index 1e1b51e..87f7999 100644 --- a/test/Decider/MD5-winonly-firstbuild.py +++ b/test/Decider/MD5-winonly-firstbuild.py @@ -43,9 +43,9 @@ if IS_WINDOWS: lex = test.where_is('flex') or test.where_is('lex') or test.where_is('win_flex') # print("Lex:%s yacc:%s"%(lex,yacc)) if not yacc or not lex: - test.skip_test("On windows but no flex/lex/win_flex and yacc/bison/win_bison required for test") + test.skip_test("On windows but no flex/lex/win_flex and yacc/bison/win_bison required for test\n") else: - test.skip_test("Windows only test") + test.skip_test("Windows only test\n") test.dir_fixture('MD5-winonly-fixture') diff --git a/test/Decider/MD5-winonly-fixture/SConstruct b/test/Decider/MD5-winonly-fixture/SConstruct index c194c47..9775a43 100644 --- a/test/Decider/MD5-winonly-fixture/SConstruct +++ b/test/Decider/MD5-winonly-fixture/SConstruct @@ -5,5 +5,6 @@ env.AppendENVPath('PATH', r'd:\mesa\flexbison') env.Tool('lex') env.Tool('yacc') env['YACCFLAGS'] = '-d' -env.Append(LEXFLAGS = ['--wincompat']) +if env['YACC'] == 'win_flex': + env.Append(LEXFLAGS = ['--wincompat']) env.SharedLibrary('dummy',['test_lex.l','test_parse.y']) -- cgit v0.12 From 1ce50b75d38f696a2ae46f994c5e3d4f93136042 Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Sun, 3 Mar 2019 11:33:28 -0700 Subject: [PYPY] fix way exit status is retrieved in main MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When scons exits, it wants to take the opportunity to print any diagnostics and statistics that may have been requested, so the main routine traps the various ways it can quit. If code somewhere calls sys.exit(), that generates a SystemExit exception. The handling of that has not been quite correct - it simply takes the exception instance, saves it, and later quits with sys.exit(saved). This seemingly works fine for all other tested versions of Python, but has interesting side effects with PyPy3. Per the Python documentation: If the value is an integer, it specifies the system exit status (passed to C’s exit() function); if it is None, the exit status is zero; if it has another type (such as a string), the object’s value is printed and the exit status is one. And in fact, PyPy3 does this: if the original call to sys.exit took a value of 2, then the SystemExit exception triggers with a class instance which does have an exit code of 2, which turns up if you take the string repr of the instance, but when passed to the final sys.exit, as it's not an integer it *prints* the 2, and returns with an exit code of 1, just as in the documentation snip. Not really sure if PyPy3 is wrong here, or the other Pythons are letting something slide, but it's an easy fix: save off the code stored in the exception instance for later use as the exit code, instead of using the instance itself for that. Signed-off-by: Mats Wichmann --- src/CHANGES.txt | 1 + src/engine/SCons/Script/Main.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 0a80095..4d24611 100755 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -33,6 +33,7 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER not using a context manager around Popen.stdout - Add the textfile tool to the default tool list - Fix syntax on is/is not clauses: should not use with a literal + - Properly retrieve exit code when catching SystemExit From Bernhard M. Wiedemann: - Do not store build host+user name if reproducible builds are wanted diff --git a/src/engine/SCons/Script/Main.py b/src/engine/SCons/Script/Main.py index 2c59808..f3475f2 100644 --- a/src/engine/SCons/Script/Main.py +++ b/src/engine/SCons/Script/Main.py @@ -1376,7 +1376,7 @@ def main(): revert_io() except SystemExit as s: if s: - exit_status = s + exit_status = s.code except KeyboardInterrupt: print("scons: Build interrupted.") sys.exit(2) -- cgit v0.12 From 846971e251c8bc9d662c60a49465bfe972f730a3 Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Fri, 1 Mar 2019 13:01:17 -0700 Subject: [PYPY support] adjust two expect strings for PyPy msgs To help support pypy, two test expect-strings are adjusted to accept either the error message from CPython ("Syntax error: invalid syntax") and from PyPy ("Syntax error: Unknown character"). Signed-off-by: Mats Wichmann --- test/Errors/SyntaxError.py | 2 +- test/Subst/SyntaxError.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/Errors/SyntaxError.py b/test/Errors/SyntaxError.py index 1b7f650..e6b8e4d 100644 --- a/test/Errors/SyntaxError.py +++ b/test/Errors/SyntaxError.py @@ -44,7 +44,7 @@ test.run(stdout = "scons: Reading SConscript files ...\n", \^ -SyntaxError: invalid syntax +SyntaxError: (invalid syntax|Unknown character) """, status=2) diff --git a/test/Subst/SyntaxError.py b/test/Subst/SyntaxError.py index 94be468..21d0d0b 100644 --- a/test/Subst/SyntaxError.py +++ b/test/Subst/SyntaxError.py @@ -34,7 +34,7 @@ import TestSCons test = TestSCons.TestSCons(match = TestSCons.match_re_dotall) -expect_build = r"""scons: \*\*\*%s SyntaxError `invalid syntax( \((, )?line 1\))?' trying to evaluate `%s' +expect_build = r"""scons: \*\*\*%s SyntaxError `(invalid syntax|Unknown character)( \((, )?line 1\))?' trying to evaluate `%s' """ expect_read = "\n" + expect_build + TestSCons.file_expr -- cgit v0.12 From 3f3edd29e1f69b5b50c27439cf59286887a9178f Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Sun, 3 Mar 2019 12:17:48 -0700 Subject: [WIP] add pypy3 to the Travis CI setup Signed-off-by: Mats Wichmann --- .travis.yml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3ab601a..6bc50c3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,7 +18,7 @@ install: # allow coverage to fail, so we can still do testing for all platforms matrix: allow_failures: - - python: pypy + - python: pypy2, pypy3 - stage: Coverage # run coverage first as its still useful to collect @@ -62,12 +62,19 @@ jobs: dist: xenial # required for Python 3.7 (travis-ci/travis-ci#9069) - <<: *test_job - python: pypy + python: pypy2 env: - PYVER=pypy - PYTHON=pypy sudo: required + - <<: *test_job + python: pypy3 + env: + - PYVER=pypy3 + - PYTHON=pypy3 + sudo: required + - &coverage_jobs stage: Coverage -- cgit v0.12 From 9e857aa8197bc12b7309527e10b2a31bd9601f59 Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Mon, 4 Mar 2019 09:52:54 -0700 Subject: [PYPY] travis run pypy jobs with -j 3 The pypy test runs are markedly slower; try multi-job runs to see if they speed up enough to not time out our overall build. Signed-off-by: Mats Wichmann --- .travis.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6bc50c3..2609069 100644 --- a/.travis.yml +++ b/.travis.yml @@ -30,7 +30,7 @@ jobs: include: - &test_job stage: Test - script: python runtest.py -a || if [[ $? == 2 ]]; then true; else false; fi + script: python runtest.py -a -t || if [[ $? == 2 ]]; then true; else false; fi before_script: skip after_success: skip python: 2.7 @@ -61,14 +61,18 @@ jobs: sudo: required dist: xenial # required for Python 3.7 (travis-ci/travis-ci#9069) - - <<: *test_job + - &slow_test_job + stage: Test + script: python runtest.py -a -j 3 -t || if [[ $? == 2 ]]; then true; else false; fi + before_script: skip + after_success: skip python: pypy2 env: - PYVER=pypy - PYTHON=pypy sudo: required - - <<: *test_job + - <<: *slow_test_job python: pypy3 env: - PYVER=pypy3 -- cgit v0.12 From 0c02062ec5ca6f972838637e2ffb9a0132d5e1af Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Mon, 4 Mar 2019 11:41:04 -0700 Subject: [PYPY] further adjust travis-ci pypy3 build Signed-off-by: Mats Wichmann --- .travis.yml | 5 +++-- .travis/install.sh | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2609069..967e0d9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -63,10 +63,10 @@ jobs: - &slow_test_job stage: Test - script: python runtest.py -a -j 3 -t || if [[ $? == 2 ]]; then true; else false; fi + script: python runtest.py -a -j 4 -t || if [[ $? == 2 ]]; then true; else false; fi before_script: skip after_success: skip - python: pypy2 + python: pypy env: - PYVER=pypy - PYTHON=pypy @@ -78,6 +78,7 @@ jobs: - PYVER=pypy3 - PYTHON=pypy3 sudo: required + dist: xenial - &coverage_jobs diff --git a/.travis/install.sh b/.travis/install.sh index 6510f17..feb3dd4 100755 --- a/.travis/install.sh +++ b/.travis/install.sh @@ -23,8 +23,8 @@ else sudo apt-get -y install gdc # dependencies for docbook tests sudo apt-get -y install docbook-xml xsltproc libxml2-dev libxslt-dev fop docbook-xsl-doc-pdf - # dependencies for latex tests - sudo apt-get -y install texlive texlive-latex3 biber texmaker ghostscript + # dependencies for latex tests (try to skip the huge doc pkgs) + sudo apt-get -y --no-install-recommends install texlive texlive-latex3 biber texmaker ghostscript # need some things for building dependencies for other tests sudo apt-get -y install python-pip python-dev build-essential libpcre3-dev autoconf automake libtool bison subversion git # dependencies for docbook tests continued -- cgit v0.12 From 311c0b107aa468af800b4d06f43316a7412d52a2 Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Mon, 4 Mar 2019 12:46:00 -0700 Subject: [PYPY] don't specify xenial for pypy3 Signed-off-by: Mats Wichmann --- .travis.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 967e0d9..9df50d2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,7 +18,7 @@ install: # allow coverage to fail, so we can still do testing for all platforms matrix: allow_failures: - - python: pypy2, pypy3 + - python: pypy, pypy3 - stage: Coverage # run coverage first as its still useful to collect @@ -78,7 +78,6 @@ jobs: - PYVER=pypy3 - PYTHON=pypy3 sudo: required - dist: xenial - &coverage_jobs -- cgit v0.12 From 96380855bb73cd6b061d067b0059fbbb6573e020 Mon Sep 17 00:00:00 2001 From: William Deegan Date: Mon, 4 Mar 2019 18:53:40 -0500 Subject: Try another syntax to allow pypy3 failure in addtion to pypy --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 9df50d2..a8cb940 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,7 +18,8 @@ install: # allow coverage to fail, so we can still do testing for all platforms matrix: allow_failures: - - python: pypy, pypy3 + - python: pypy + - python: pypy3 - stage: Coverage # run coverage first as its still useful to collect -- cgit v0.12 From 674ebaca7eef1706549e2d3ddbe563cb2f3864c6 Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Tue, 5 Mar 2019 07:30:30 -0700 Subject: [PYPY] [PY 3.8] add context mgr use in scons-time To fix some test problems for pypy, which seem more prone to problems of lost data if files are written and not explicitly closed, add context managers on file opens in scons-time. Also quiets warnings which are emitted by the much noisier Python 3.8. Changes are to the scons-time script and to the framework. After visual inspection of outputs while debugging, switched the framework's created tools in the scons-time area to use os.linesep instead of explicit '\\n' strings, tools should operate in a native way. Signed-off-by: Mats Wichmann --- src/CHANGES.txt | 1 + src/script/scons-time.py | 16 ++++++++++++---- testing/framework/TestSCons_time.py | 29 ++++++++++++++++------------- 3 files changed, 29 insertions(+), 17 deletions(-) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 4d24611..205dcb2 100755 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -34,6 +34,7 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER - Add the textfile tool to the default tool list - Fix syntax on is/is not clauses: should not use with a literal - Properly retrieve exit code when catching SystemExit + - scons-time now uses context managers around file opens From Bernhard M. Wiedemann: - Do not store build host+user name if reproducible builds are wanted diff --git a/src/script/scons-time.py b/src/script/scons-time.py index d114f9a..5d0a042 100644 --- a/src/script/scons-time.py +++ b/src/script/scons-time.py @@ -814,7 +814,9 @@ class SConsTimer(object): self.title = a if self.config_file: - exec(open(self.config_file, 'r').read(), self.__dict__) + with open(self.config_file, 'r') as f: + config = f.read() + exec(config, self.__dict__) if self.chdir: os.chdir(self.chdir) @@ -933,7 +935,9 @@ class SConsTimer(object): self.title = a if self.config_file: - HACK_for_exec(open(self.config_file, 'r').read(), self.__dict__) + with open(self.config_file, 'r') as f: + config = f.read() + HACK_for_exec(config, self.__dict__) if self.chdir: os.chdir(self.chdir) @@ -1053,7 +1057,9 @@ class SConsTimer(object): object_name = args.pop(0) if self.config_file: - HACK_for_exec(open(self.config_file, 'r').read(), self.__dict__) + with open(self.config_file, 'r') as f: + config = f.read() + HACK_for_exec(config, self.__dict__) if self.chdir: os.chdir(self.chdir) @@ -1191,7 +1197,9 @@ class SConsTimer(object): sys.exit(1) if self.config_file: - exec(open(self.config_file, 'r').read(), self.__dict__) + with open(self.config_file, 'r') as f: + config = f.read() + exec(config, self.__dict__) if args: self.archive_list = args diff --git a/testing/framework/TestSCons_time.py b/testing/framework/TestSCons_time.py index 8260bef..e37d269 100644 --- a/testing/framework/TestSCons_time.py +++ b/testing/framework/TestSCons_time.py @@ -38,18 +38,18 @@ import os import sys def write_args(fp, args): - fp.write(args[0] + '\\n') + fp.write(args[0] + os.linesep) for arg in args[1:]: - fp.write(' ' + arg + '\\n') + fp.write(' ' + arg + os.linesep) write_args(sys.stdout, sys.argv) for arg in sys.argv[1:]: if arg[:10] == '--profile=': with open(arg[10:], 'w') as profile: - profile.write('--profile\\n') + profile.write('--profile' + os.linesep) write_args(profile, sys.argv) break -sys.stdout.write('SCONS_LIB_DIR = ' + os.environ['SCONS_LIB_DIR'] + '\\n') +sys.stdout.write('SCONS_LIB_DIR = ' + os.environ['SCONS_LIB_DIR'] + os.linesep) with open('SConstruct', 'r') as f: script = f.read() exec(script) @@ -63,8 +63,8 @@ import sys script_dir = 'src/script' if not os.path.exists(script_dir): os.makedirs(script_dir) -open(script_dir + '/scons.py', 'w').write( -r'''%s''') +with open(script_dir + '/scons.py', 'w') as f: + f.write(r'''%s''') """ % scons_py @@ -76,8 +76,8 @@ import sys dir = sys.argv[-1] script_dir = dir + '/src/script' os.makedirs(script_dir) -open(script_dir + '/scons.py', 'w').write( -r'''%s''') +with open(script_dir + '/scons.py', 'w') as f: + f.write(r'''%s''') """ % scons_py @@ -89,8 +89,8 @@ import sys dir = sys.argv[-1] script_dir = dir + '/src/script' os.makedirs(script_dir) -open(script_dir + '/scons.py', 'w').write( -r'''%s''') +with open(script_dir + '/scons.py', 'w') as f: + f.write(r'''%s''') """ % scons_py @@ -297,13 +297,15 @@ class TestSCons_time(TestCommon): tar = tarfile.open(archive, mode[suffix]) for name, content in files: path = os.path.join(dir, name) - open(path, 'wb').write(bytearray(content,'utf-8')) + with open(path, 'wb') as f: + f.write(bytearray(content,'utf-8')) tarinfo = tar.gettarinfo(path, path) tarinfo.uid = 111 tarinfo.gid = 111 tarinfo.uname = 'fake_user' tarinfo.gname = 'fake_group' - tar.addfile(tarinfo, open(path, 'rb')) + with open(path, 'rb') as f: + tar.addfile(tarinfo, f) tar.close() shutil.rmtree(dir) return self.workpath(archive) @@ -322,7 +324,8 @@ class TestSCons_time(TestCommon): zip = zipfile.ZipFile(archive, 'w') for name, content in files: path = os.path.join(dir, name) - open(path, 'w').write(content) + with open(path, 'w') as f: + f.write(content) zip.write(path) zip.close() shutil.rmtree(dir) -- cgit v0.12 From f0f48202c59f8d00f47aaec25986d343e3c72ca4 Mon Sep 17 00:00:00 2001 From: William Deegan Date: Tue, 5 Mar 2019 10:57:53 -0500 Subject: [skip ci] reset to develop mode --- README.rst | 14 +++++++------- SConstruct | 4 ++-- src/Announce.txt | 2 +- src/CHANGES.txt | 2 +- testing/framework/TestSCons.py | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/README.rst b/README.rst index ce6f68c..386bd65 100755 --- a/README.rst +++ b/README.rst @@ -499,13 +499,13 @@ about `Executing SCons Without Installing`_):: Depending on the utilities installed on your system, any or all of the following packages will be built:: - build/dist/scons-3.0.4.tar.gz - build/dist/scons-3.0.4.zip - build/dist/scons-doc-3.0.4.tar.gz - build/dist/scons-local-3.0.4.tar.gz - build/dist/scons-local-3.0.4.zip - build/dist/scons-src-3.0.4.tar.gz - build/dist/scons-src-3.0.4.zip + build/dist/scons-3.0.5.alpha.yyyymmdd.tar.gz + build/dist/scons-3.0.5.alpha.yyyymmdd.zip + build/dist/scons-doc-3.0.5.alpha.yyyymmdd.tar.gz + build/dist/scons-local-3.0.5.alpha.yyyymmdd.tar.gz + build/dist/scons-local-3.0.5.alpha.yyyymmdd.zip + build/dist/scons-src-3.0.5.alpha.yyyymmdd.tar.gz + build/dist/scons-src-3.0.5.alpha.yyyymmdd.zip The SConstruct file is supposed to be smart enough to avoid trying to build packages for which you don't have the proper utilities installed. For diff --git a/SConstruct b/SConstruct index 5ac5692..a832cdc 100644 --- a/SConstruct +++ b/SConstruct @@ -8,7 +8,7 @@ from __future__ import print_function copyright_years = '2001 - 2019' # This gets inserted into the man pages to reflect the month of release. -month_year = 'January 2019' +month_year = 'MONTH YEAR' # # __COPYRIGHT__ @@ -49,7 +49,7 @@ import textwrap import bootstrap project = 'scons' -default_version = '3.0.4' +default_version = '3.0.5.alpha.yyyymmdd' copyright = "Copyright (c) %s The SCons Foundation" % copyright_years SConsignFile() diff --git a/src/Announce.txt b/src/Announce.txt index 7eb57ae..d181de5 100755 --- a/src/Announce.txt +++ b/src/Announce.txt @@ -18,7 +18,7 @@ So that everyone using SCons can help each other learn how to use it more effectively, please go to http://scons.org/lists.html#users to sign up for the scons-users mailing list. -RELEASE VERSION/DATE TO BE FILLED IN LATER +RELEASE 3.0.5.alpha.yyyymmdd - NEW DATE WILL BE INSERTED HERE Please consult the RELEASE.txt file for a summary of changes since the last release and consult the CHANGES.txt file for complete a list of changes diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 4d24611..7d8e8d4 100755 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -5,7 +5,7 @@ Change Log -RELEASE VERSION/DATE TO BE FILLED IN LATER +RELEASE 3.0.5.alpha.yyyymmdd - NEW DATE WILL BE INSERTED HERE From William Deegan: diff --git a/testing/framework/TestSCons.py b/testing/framework/TestSCons.py index 57b300d..ad197d7 100644 --- a/testing/framework/TestSCons.py +++ b/testing/framework/TestSCons.py @@ -35,7 +35,7 @@ from TestCmd import PIPE # here provides some independent verification that what we packaged # conforms to what we expect. -default_version = '3.0.4' +default_version = '3.0.5.alpha.yyyymmdd' python_version_unsupported = (2, 6, 0) python_version_deprecated = (2, 7, 0) -- cgit v0.12 From 9e72358f7fe8d93d22221c9bec62fb1203d0a5b7 Mon Sep 17 00:00:00 2001 From: Maciej Kumorek Date: Wed, 6 Mar 2019 17:29:45 -0800 Subject: Add /nologo flag to RCFLAGS --- src/engine/SCons/Tool/msvc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/engine/SCons/Tool/msvc.py b/src/engine/SCons/Tool/msvc.py index 2352088..6cfa245 100644 --- a/src/engine/SCons/Tool/msvc.py +++ b/src/engine/SCons/Tool/msvc.py @@ -262,7 +262,7 @@ def generate(env): env['STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME'] = 1 env['RC'] = 'rc' - env['RCFLAGS'] = SCons.Util.CLVar('') + env['RCFLAGS'] = SCons.Util.CLVar('/nologo') env['RCSUFFIXES']=['.rc','.rc2'] env['RCCOM'] = '$RC $_CPPDEFFLAGS $_CPPINCFLAGS $RCFLAGS /fo$TARGET $SOURCES' env['BUILDERS']['RES'] = res_builder -- cgit v0.12 From 0868f0e7541e39237ef91a5382945679076c1b5d Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Wed, 6 Mar 2019 13:31:57 -0700 Subject: scons-time needed to revert some changes were breaking Windows tests. Signed-off-by: Mats Wichmann --- testing/framework/TestSCons_time.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/testing/framework/TestSCons_time.py b/testing/framework/TestSCons_time.py index e37d269..55248a4 100644 --- a/testing/framework/TestSCons_time.py +++ b/testing/framework/TestSCons_time.py @@ -38,18 +38,18 @@ import os import sys def write_args(fp, args): - fp.write(args[0] + os.linesep) + fp.write(args[0] + '\\n') for arg in args[1:]: - fp.write(' ' + arg + os.linesep) + fp.write(' ' + arg + '\\n') write_args(sys.stdout, sys.argv) for arg in sys.argv[1:]: if arg[:10] == '--profile=': with open(arg[10:], 'w') as profile: - profile.write('--profile' + os.linesep) + profile.write('--profile\\n') write_args(profile, sys.argv) break -sys.stdout.write('SCONS_LIB_DIR = ' + os.environ['SCONS_LIB_DIR'] + os.linesep) +sys.stdout.write('SCONS_LIB_DIR = ' + os.environ['SCONS_LIB_DIR'] + '\\n') with open('SConstruct', 'r') as f: script = f.read() exec(script) -- cgit v0.12 From 3047ca665429fdfdb5342493843443b5ce224d46 Mon Sep 17 00:00:00 2001 From: Maciej Kumorek Date: Thu, 7 Mar 2019 10:32:36 -0800 Subject: Add the changelog entry Add the changelog entry about the addition of nologo to RCFLAGS in MSVC tool. --- src/CHANGES.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 7d8e8d4..6d8125f 100755 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -37,7 +37,9 @@ RELEASE 3.0.5.alpha.yyyymmdd - NEW DATE WILL BE INSERTED HERE From Bernhard M. Wiedemann: - Do not store build host+user name if reproducible builds are wanted - + + From Maciej Kumorek: + - Update the MSVC tool to include the nologo flag by default in RCFLAGS RELEASE 3.0.4 - Mon, 20 Jan 2019 22:49:27 +0000 -- cgit v0.12 From 59622eef74a5a1c698ec71cbf2d48a308c07c1fa Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Wed, 6 Mar 2019 14:00:01 -0700 Subject: Clean up some file opens, regex strings Most recent Python (3.8 alpha) spews warnings aplenty about two subjects: unclosed files and strings which look like they have embedded escapes that Python does not recognize. The latter are usually regexes, and it provides a reminder that regular expressions should normally be specified as raw strings, so Python does not attempt to interpret them. Irritating is that even docstrings are flagged, it's not obvious what the right answer is for a docstring which contains, say, a Windows-style path with backslashes. This converts a bunch of opens that are not closed into context manager usage and regex patterns into raw strings. This eliminate about 4000 warnings spewed by Py3.8 (9200 remain). Signed-off-by: Mats Wichmann --- bin/update-release-info.py | 29 +++++++++++++++++------------ runtest.py | 20 +++++++++++++------- src/CHANGES.txt | 1 + src/engine/SCons/BuilderTests.py | 4 +++- src/engine/SCons/Defaults.py | 4 ++-- src/engine/SCons/Environment.py | 4 ++-- src/engine/SCons/Node/NodeTests.py | 4 ++-- src/engine/SCons/SConsign.py | 3 ++- src/engine/SCons/Scanner/LaTeXTests.py | 6 +++--- src/engine/SCons/Scanner/ScannerTests.py | 6 +++--- src/engine/SCons/Script/SConscript.py | 11 ++++++----- src/engine/SCons/Tool/JavaCommon.py | 4 +++- src/engine/SCons/Tool/msvs.py | 4 ++-- src/engine/SCons/Tool/msvsTests.py | 4 ++-- src/engine/SCons/Tool/swig.py | 6 ++++-- src/engine/SCons/Tool/tex.py | 26 ++++++++++++++++---------- src/engine/SCons/cpp.py | 28 ++++++++++++++-------------- src/engine/SCons/dblite.py | 7 +++++-- 18 files changed, 100 insertions(+), 71 deletions(-) diff --git a/bin/update-release-info.py b/bin/update-release-info.py index 5b871cb..fe5bbcf 100644 --- a/bin/update-release-info.py +++ b/bin/update-release-info.py @@ -81,7 +81,10 @@ else: # Get configuration information config = dict() -exec(open('ReleaseConfig').read(), globals(), config) +with open('ReleaseConfig') as f: + releaseconfig = f.read() +exec(releaseconfig, globals(), config) + try: version_tuple = config['version_tuple'] @@ -152,7 +155,8 @@ class UpdateFile(object): ''' if orig is None: orig = file try: - self.content = open(orig, 'r').read() + with open(orig, 'r') as f: + self.content = f.read() except IOError: # Couldn't open file; don't try to write anything in __del__ self.file = None @@ -180,8 +184,8 @@ class UpdateFile(object): # Determine the pattern to match a version - _rel_types = '(alpha|beta|candidate|final)' - match_pat = '\d+\.\d+\.\d+\.' + _rel_types + '\.(\d+|yyyymmdd)' + _rel_types = r'(alpha|beta|candidate|final)' + match_pat = r'\d+\.\d+\.\d+\.' + _rel_types + r'\.(\d+|yyyymmdd)' match_rel = re.compile(match_pat) def replace_version(self, replacement = version_string, count = 1): @@ -198,14 +202,14 @@ class UpdateFile(object): new_date = 'NEW DATE WILL BE INSERTED HERE' else: min = (time.daylight and time.altzone or time.timezone)//60 - hr = min//60 - min = -(min%60 + hr*100) + hr = min // 60 + min = -(min % 60 + hr * 100) new_date = (time.strftime('%a, %d %b %Y %X', release_date + (0,0,0)) + ' %+.4d' % min) - _days = '(Sun|Mon|Tue|Wed|Thu|Fri|Sat)' - _months = '(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oce|Nov|Dec)' - match_date = _days+', \d\d '+_months+' \d\d\d\d \d\d:\d\d:\d\d [+-]\d\d\d\d' + _days = r'(Sun|Mon|Tue|Wed|Thu|Fri|Sat)' + _months = r'(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oce|Nov|Dec)' + match_date = r''.join([_days, r', \d\d ', _months, r' \d\d\d\d \d\d:\d\d:\d\d [+-]\d\d\d\d']) match_date = re.compile(match_date) def replace_date(self, replacement = new_date, count = 1): @@ -220,7 +224,8 @@ class UpdateFile(object): ''' if self.file is not None and self.content != self.orig: print('Updating ' + self.file + '...') - open(self.file, 'w').write(self.content) + with open(self.file, 'w') as f: + f.write(self.content) if mode == 'post': # Set up for the next release series. @@ -309,9 +314,9 @@ t.replace_assign('default_version', repr(version_string)) t = UpdateFile('README.rst') if DEBUG: t.file = '/tmp/README.rst' -t.sub('-' + t.match_pat + '\.', '-' + version_string + '.', count = 0) +t.sub('-' + t.match_pat + r'\.', '-' + version_string + '.', count = 0) for suf in ['tar', 'win32', 'zip', 'rpm', 'exe', 'deb']: - t.sub('-(\d+\.\d+\.\d+)\.%s' % suf, + t.sub(r'-(\d+\.\d+\.\d+)\.%s' % suf, '-%s.%s' % (version_string, suf), count = 0) diff --git a/runtest.py b/runtest.py index ccc170a..2ea1a34 100755 --- a/runtest.py +++ b/runtest.py @@ -345,7 +345,7 @@ sp.append(builddir) sp.append(cwd) # -_ws = re.compile('\s') +_ws = re.compile(r'\s') def escape(s): @@ -672,12 +672,10 @@ def find_py(directory): if 'sconstest.skip' in filenames: continue try: - exclude_fp = open(os.path.join(dirpath, ".exclude_tests")) + with open(os.path.join(dirpath, ".exclude_tests")) as f: + excludes = [e.split("#", 1)[0].strip() for e in f.readlines()] except EnvironmentError: excludes = [] - else: - excludes = [ e.split('#', 1)[0].strip() - for e in exclude_fp.readlines() ] for fname in filenames: if fname.endswith(".py") and fname not in excludes: result.append(os.path.join(dirpath, fname)) @@ -685,7 +683,8 @@ def find_py(directory): if testlistfile: - tests = open(testlistfile, 'r').readlines() + with open(testlistfile, 'r') as f: + tests = f.readlines() tests = [x for x in tests if x[0] != '#'] tests = [x[:-1] for x in tests] tests = [x.strip() for x in tests] @@ -747,7 +746,8 @@ runtest.py: No tests were found. sys.exit(1) if excludelistfile: - excludetests = open(excludelistfile, 'r').readlines() + with open(excludelistfile, 'r') as f: + excludetests = f.readlines() excludetests = [x for x in excludetests if x[0] != '#'] excludetests = [x[:-1] for x in excludetests] excludetests = [x.strip() for x in excludetests] @@ -928,6 +928,12 @@ if options.xml: if options.xml != '-': f.close() +if options.output: + if isinstance(sys.stdout, Tee): + sys.stdout.file.close() + if isinstance(sys.stderr, Tee): + sys.stderr.file.close() + if len(fail): sys.exit(1) elif len(no_result): diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 7d8e8d4..a736ff0 100755 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -34,6 +34,7 @@ RELEASE 3.0.5.alpha.yyyymmdd - NEW DATE WILL BE INSERTED HERE - Add the textfile tool to the default tool list - Fix syntax on is/is not clauses: should not use with a literal - Properly retrieve exit code when catching SystemExit + - Fix regex patterns that were not specified as raw strings From Bernhard M. Wiedemann: - Do not store build host+user name if reproducible builds are wanted diff --git a/src/engine/SCons/BuilderTests.py b/src/engine/SCons/BuilderTests.py index c9068ed..847e30a 100644 --- a/src/engine/SCons/BuilderTests.py +++ b/src/engine/SCons/BuilderTests.py @@ -680,7 +680,9 @@ class BuilderTestCase(unittest.TestCase): def test_single_source(self): """Test Builder with single_source flag set""" def func(target, source, env): - open(str(target[0]), "w") # TODO: this just a throwaway? + """create the file""" + with open(str(target[0]), "w"): + pass if (len(source) == 1 and len(target) == 1): env['CNT'][0] = env['CNT'][0] + 1 diff --git a/src/engine/SCons/Defaults.py b/src/engine/SCons/Defaults.py index 9ca9ccd..479ef7e 100644 --- a/src/engine/SCons/Defaults.py +++ b/src/engine/SCons/Defaults.py @@ -333,8 +333,8 @@ def touch_func(dest): if os.path.exists(file): atime = os.path.getatime(file) else: - open(file, 'w') - atime = mtime + with open(file, 'w'): + atime = mtime os.utime(file, (atime, mtime)) Touch = ActionFactory(touch_func, diff --git a/src/engine/SCons/Environment.py b/src/engine/SCons/Environment.py index eea8aed..88fbc3b 100644 --- a/src/engine/SCons/Environment.py +++ b/src/engine/SCons/Environment.py @@ -1568,12 +1568,12 @@ class Base(SubstitutionEnvironment): """ filename = self.subst(filename) try: - fp = open(filename, 'r') + with open(filename, 'r') as fp: + lines = SCons.Util.LogicalLines(fp).readlines() except IOError: if must_exist: raise return - lines = SCons.Util.LogicalLines(fp).readlines() lines = [l for l in lines if l[0] != '#'] tdlist = [] for line in lines: diff --git a/src/engine/SCons/Node/NodeTests.py b/src/engine/SCons/Node/NodeTests.py index 7dc5f5d..7d347ac 100644 --- a/src/engine/SCons/Node/NodeTests.py +++ b/src/engine/SCons/Node/NodeTests.py @@ -1335,9 +1335,9 @@ class NodeListTestCase(unittest.TestCase): assert s == "['n3', 'n2', 'n1']", s r = repr(nl) - r = re.sub('at (0[xX])?[0-9a-fA-F]+', 'at 0x', r) + r = re.sub(r'at (0[xX])?[0-9a-fA-F]+', 'at 0x', r) # Don't care about ancestry: just leaf value of MyNode - r = re.sub('<.*?\.MyNode', '= 3: - v_revision = int(re.match('\d+', version[2]).group()) + v_revision = int(re.match(r'\d+', version[2]).group()) else: v_revision = 0 return v_major, v_minor, v_revision diff --git a/src/engine/SCons/Tool/JavaCommon.py b/src/engine/SCons/Tool/JavaCommon.py index 0d4c95a..853f7f2 100644 --- a/src/engine/SCons/Tool/JavaCommon.py +++ b/src/engine/SCons/Tool/JavaCommon.py @@ -358,7 +358,9 @@ if java_parsing: return self.outer_state def parse_java_file(fn, version=default_java_version): - return parse_java(open(fn, 'r').read(), version) + with open(fn, 'r') as f: + data = f.read() + return parse_java(data, version) def parse_java(contents, version=default_java_version, trace=None): """Parse a .java file and return a double of package directory, diff --git a/src/engine/SCons/Tool/msvs.py b/src/engine/SCons/Tool/msvs.py index 60ba278..f4439ba 100644 --- a/src/engine/SCons/Tool/msvs.py +++ b/src/engine/SCons/Tool/msvs.py @@ -520,7 +520,7 @@ class _DSPGenerator(object): config.cmdargs = cmdargs config.runfile = runfile - match = re.match('(.*)\|(.*)', variant) + match = re.match(r'(.*)\|(.*)', variant) if match: config.variant = match.group(1) config.platform = match.group(2) @@ -1428,7 +1428,7 @@ class _GenerateV7DSW(_DSWGenerator): def AddConfig(self, variant, dswfile=dswfile): config = Config() - match = re.match('(.*)\|(.*)', variant) + match = re.match(r'(.*)\|(.*)', variant) if match: config.variant = match.group(1) config.platform = match.group(2) diff --git a/src/engine/SCons/Tool/msvsTests.py b/src/engine/SCons/Tool/msvsTests.py index 6adc598..477694a 100644 --- a/src/engine/SCons/Tool/msvsTests.py +++ b/src/engine/SCons/Tool/msvsTests.py @@ -482,8 +482,8 @@ class DummyRegistry(object): def parse(self, data): parents = [None, None] parents[0] = self.root - keymatch = re.compile('^\[(.*)\]$') - valmatch = re.compile('^(?:"(.*)"|[@])="(.*)"$') + keymatch = re.compile(r'^\[(.*)\]$') + valmatch = re.compile(r'^(?:"(.*)"|[@])="(.*)"$') for line in data: m1 = keymatch.match(line) if m1: diff --git a/src/engine/SCons/Tool/swig.py b/src/engine/SCons/Tool/swig.py index 77cfe1d..c6abefb 100644 --- a/src/engine/SCons/Tool/swig.py +++ b/src/engine/SCons/Tool/swig.py @@ -70,7 +70,9 @@ def _find_modules(src): directors = 0 mnames = [] try: - matches = _reModule.findall(open(src).read()) + with open(src) as f: + data = f.read() + matches = _reModule.findall(data) except IOError: # If the file's not yet generated, guess the module name from the file stem matches = [] @@ -150,7 +152,7 @@ def _get_swig_version(env, swig): with pipe.stdout: out = SCons.Util.to_str(pipe.stdout.read()) - match = re.search('SWIG Version\s+(\S+).*', out, re.MULTILINE) + match = re.search(r'SWIG Version\s+(\S+).*', out, re.MULTILINE) if match: version = match.group(1) if verbose: diff --git a/src/engine/SCons/Tool/tex.py b/src/engine/SCons/Tool/tex.py index 2dfa229..d361dac 100644 --- a/src/engine/SCons/Tool/tex.py +++ b/src/engine/SCons/Tool/tex.py @@ -74,15 +74,15 @@ openout_bcf_re = re.compile(r"OUTPUT *(.*\.bcf)") #printglossary_re = re.compile(r"^[^%]*\\printglossary", re.MULTILINE) # search to find rerun warnings -warning_rerun_str = '(^LaTeX Warning:.*Rerun)|(^Package \w+ Warning:.*Rerun)' +warning_rerun_str = r'(^LaTeX Warning:.*Rerun)|(^Package \w+ Warning:.*Rerun)' warning_rerun_re = re.compile(warning_rerun_str, re.MULTILINE) # search to find citation rerun warnings -rerun_citations_str = "^LaTeX Warning:.*\n.*Rerun to get citations correct" +rerun_citations_str = r"^LaTeX Warning:.*\n.*Rerun to get citations correct" rerun_citations_re = re.compile(rerun_citations_str, re.MULTILINE) # search to find undefined references or citations warnings -undefined_references_str = '(^LaTeX Warning:.*undefined references)|(^Package \w+ Warning:.*undefined citations)' +undefined_references_str = r'(^LaTeX Warning:.*undefined references)|(^Package \w+ Warning:.*undefined citations)' undefined_references_re = re.compile(undefined_references_str, re.MULTILINE) # used by the emitter @@ -297,7 +297,8 @@ def InternalLaTeXAuxAction(XXXLaTeXAction, target = None, source= None, env=None logfilename = targetbase + '.log' logContent = '' if os.path.isfile(logfilename): - logContent = open(logfilename, "r").read() + with open(logfilename, "r") as f: + logContent = f.read() # Read the fls file to find all .aux files @@ -305,7 +306,8 @@ def InternalLaTeXAuxAction(XXXLaTeXAction, target = None, source= None, env=None flsContent = '' auxfiles = [] if os.path.isfile(flsfilename): - flsContent = open(flsfilename, "r").read() + with open(flsfilename, "r") as f: + flsContent = f.read() auxfiles = openout_aux_re.findall(flsContent) # remove duplicates dups = {} @@ -315,7 +317,8 @@ def InternalLaTeXAuxAction(XXXLaTeXAction, target = None, source= None, env=None bcffiles = [] if os.path.isfile(flsfilename): - flsContent = open(flsfilename, "r").read() + with open(flsfilename, "r") as f: + flsContent = f.read() bcffiles = openout_bcf_re.findall(flsContent) # remove duplicates dups = {} @@ -338,7 +341,8 @@ def InternalLaTeXAuxAction(XXXLaTeXAction, target = None, source= None, env=None already_bibtexed.append(auxfilename) target_aux = os.path.join(targetdir, auxfilename) if os.path.isfile(target_aux): - content = open(target_aux, "r").read() + with open(target_aux, "r") as f: + content = f.read() if content.find("bibdata") != -1: if Verbose: print("Need to run bibtex on ",auxfilename) @@ -361,7 +365,8 @@ def InternalLaTeXAuxAction(XXXLaTeXAction, target = None, source= None, env=None already_bibtexed.append(bcffilename) target_bcf = os.path.join(targetdir, bcffilename) if os.path.isfile(target_bcf): - content = open(target_bcf, "r").read() + with open(target_bcf, "r") as f: + content = f.read() if content.find("bibdata") != -1: if Verbose: print("Need to run biber on ",bcffilename) @@ -647,7 +652,7 @@ def ScanFiles(theFile, target, paths, file_tests, file_tests_search, env, graphi if incResult: aux_files.append(os.path.join(targetdir, incResult.group(1))) if Verbose: - print("\include file names : ", aux_files) + print(r"\include file names : ", aux_files) # recursively call this on each of the included files inc_files = [ ] inc_files.extend( include_re.findall(content) ) @@ -813,7 +818,8 @@ def tex_emitter_core(target, source, env, graphics_extensions): # read fls file to get all other files that latex creates and will read on the next pass # remove files from list that we explicitly dealt with above if os.path.isfile(flsfilename): - content = open(flsfilename, "r").read() + with open(flsfilename, "r") as f: + content = f.read() out_files = openout_re.findall(content) myfiles = [auxfilename, logfilename, flsfilename, targetbase+'.dvi',targetbase+'.pdf'] for filename in out_files[:]: diff --git a/src/engine/SCons/cpp.py b/src/engine/SCons/cpp.py index cdd3923..a413690 100644 --- a/src/engine/SCons/cpp.py +++ b/src/engine/SCons/cpp.py @@ -45,16 +45,16 @@ import re cpp_lines_dict = { # Fetch the rest of a #if/#elif as one argument, # with white space optional. - ('if', 'elif') : '\s*(.+)', + ('if', 'elif') : r'\s*(.+)', # Fetch the rest of a #ifdef/#ifndef as one argument, # separated from the keyword by white space. - ('ifdef', 'ifndef',): '\s+(.+)', + ('ifdef', 'ifndef',): r'\s+(.+)', # Fetch the rest of a #import/#include/#include_next line as one # argument, with white space optional. ('import', 'include', 'include_next',) - : '\s*(.+)', + : r'\s*(.+)', # We don't care what comes after a #else or #endif line. ('else', 'endif',) : '', @@ -64,10 +64,10 @@ cpp_lines_dict = { # 2) The optional parentheses and arguments (if it's a function-like # macro, '' if it's not). # 3) The expansion value. - ('define',) : '\s+([_A-Za-z][_A-Za-z0-9_]*)(\([^)]*\))?\s*(.*)', + ('define',) : r'\s+([_A-Za-z][_A-Za-z0-9_]*)(\([^)]*\))?\s*(.*)', # Fetch the #undefed keyword from a #undef line. - ('undef',) : '\s+([_A-Za-z][A-Za-z0-9_]*)', + ('undef',) : r'\s+([_A-Za-z][A-Za-z0-9_]*)', } # Create a table that maps each individual C preprocessor directive to @@ -97,7 +97,7 @@ l = [override.get(x, x) for x in list(Table.keys())] # a list of tuples, one for each preprocessor line. The preprocessor # directive will be the first element in each tuple, and the rest of # the line will be the second element. -e = '^\s*#\s*(' + '|'.join(l) + ')(.*)$' +e = r'^\s*#\s*(' + '|'.join(l) + ')(.*)$' # And last but not least, compile the expression. CPP_Expression = re.compile(e, re.M) @@ -144,12 +144,12 @@ CPP_to_Python_Ops_Expression = re.compile(expr) # A separate list of expressions to be evaluated and substituted # sequentially, not all at once. CPP_to_Python_Eval_List = [ - ['defined\s+(\w+)', '"\\1" in __dict__'], - ['defined\s*\((\w+)\)', '"\\1" in __dict__'], - ['/\*.*\*/', ''], - ['/\*.*', ''], - ['//.*', ''], - ['(0x[0-9A-Fa-f]*)[UL]+', '\\1'], + [r'defined\s+(\w+)', '"\\1" in __dict__'], + [r'defined\s*\((\w+)\)', '"\\1" in __dict__'], + [r'/\*.*\*/', ''], + [r'/\*.*', ''], + [r'//.*', ''], + [r'(0x[0-9A-Fa-f]*)[UL]+', '\\1'], ] # Replace the string representations of the regular expressions in the @@ -225,11 +225,11 @@ line_continuations = re.compile('\\\\\r?\n') # Search for a "function call" macro on an expansion. Returns the # two-tuple of the "function" name itself, and a string containing the # arguments within the call parentheses. -function_name = re.compile('(\S+)\(([^)]*)\)') +function_name = re.compile(r'(\S+)\(([^)]*)\)') # Split a string containing comma-separated function call arguments into # the separate arguments. -function_arg_separator = re.compile(',\s*') +function_arg_separator = re.compile(r',\s*') diff --git a/src/engine/SCons/dblite.py b/src/engine/SCons/dblite.py index 628182b..14bd93d 100644 --- a/src/engine/SCons/dblite.py +++ b/src/engine/SCons/dblite.py @@ -108,16 +108,19 @@ class dblite(object): self._chgrp_to = -1 # don't chgrp if self._flag == "n": - self._open(self._file_name, "wb", self._mode) + with self._open(self._file_name, "wb", self._mode): + pass # just make sure it exists else: try: f = self._open(self._file_name, "rb") except IOError as e: if self._flag != "c": raise e - self._open(self._file_name, "wb", self._mode) + with self._open(self._file_name, "wb", self._mode): + pass # just make sure it exists else: p = f.read() + f.close() if len(p) > 0: try: if bytes is not str: -- cgit v0.12 From df613e42c8cdd9f257dfdce157be140a519f6bd1 Mon Sep 17 00:00:00 2001 From: William Deegan Date: Mon, 11 Mar 2019 15:54:16 -0400 Subject: Fix issue #2799 - Get mingw tool to respect SHCCCOMSTR, SHLINKCOMSTR and LDMODULECOMSTR --- src/engine/SCons/Tool/mingw.py | 5 +-- test/MinGW/bug_2799/SConstruct | 14 ++++++++ test/MinGW/bug_2799/module.c | 3 ++ test/MinGW/bug_2799/sconstest.skip | 0 test/MinGW/bug_2799/shlib.c | 4 +++ test/MinGW/mingw_uses_comstr_issue_2799.py | 55 ++++++++++++++++++++++++++++++ 6 files changed, 79 insertions(+), 2 deletions(-) create mode 100644 test/MinGW/bug_2799/SConstruct create mode 100644 test/MinGW/bug_2799/module.c create mode 100644 test/MinGW/bug_2799/sconstest.skip create mode 100644 test/MinGW/bug_2799/shlib.c create mode 100644 test/MinGW/mingw_uses_comstr_issue_2799.py diff --git a/src/engine/SCons/Tool/mingw.py b/src/engine/SCons/Tool/mingw.py index ce31f88..311a955 100644 --- a/src/engine/SCons/Tool/mingw.py +++ b/src/engine/SCons/Tool/mingw.py @@ -107,7 +107,8 @@ def shlib_emitter(target, source, env): return (target, source) -shlib_action = SCons.Action.Action(shlib_generator, generator=1) +shlib_action = SCons.Action.Action(shlib_generator, '$SHLINKCOMSTR', generator=1) +ldmodule_action = SCons.Action.Action(shlib_generator, '$LDMODULECOMSTR', generator=1) res_action = SCons.Action.Action('$RCCOM', '$RCCOMSTR') @@ -161,7 +162,7 @@ def generate(env): env['SHCXXFLAGS'] = SCons.Util.CLVar('$CXXFLAGS') env['SHLINKFLAGS'] = SCons.Util.CLVar('$LINKFLAGS -shared') env['SHLINKCOM'] = shlib_action - env['LDMODULECOM'] = shlib_action + env['LDMODULECOM'] = ldmodule_action env.Append(SHLIBEMITTER = [shlib_emitter]) env.Append(LDMODULEEMITTER = [shlib_emitter]) env['AS'] = 'as' diff --git a/test/MinGW/bug_2799/SConstruct b/test/MinGW/bug_2799/SConstruct new file mode 100644 index 0000000..a1832f1 --- /dev/null +++ b/test/MinGW/bug_2799/SConstruct @@ -0,0 +1,14 @@ +env = Environment( + tools = ['mingw'], + SHCCCOMSTR = 'SHCC $TARGET', + SHLINKCOMSTR = 'SHLINK $TARGET', + LDMODULECOMSTR = 'LDMODULE $TARGET', + SHOBSUFFIX='.o', + SHLIBSUFFIX='.so', + SHLIBPREFIX='lib', + LDMODULESUFFIX='.so', +) + +env.SharedLibrary('testlib', 'shlib.c') + +env.LoadableModule('testmodule', 'module.c') diff --git a/test/MinGW/bug_2799/module.c b/test/MinGW/bug_2799/module.c new file mode 100644 index 0000000..3cf5ace --- /dev/null +++ b/test/MinGW/bug_2799/module.c @@ -0,0 +1,3 @@ +extern void bar(void) +{ +} diff --git a/test/MinGW/bug_2799/sconstest.skip b/test/MinGW/bug_2799/sconstest.skip new file mode 100644 index 0000000..e69de29 diff --git a/test/MinGW/bug_2799/shlib.c b/test/MinGW/bug_2799/shlib.c new file mode 100644 index 0000000..efe6b3f --- /dev/null +++ b/test/MinGW/bug_2799/shlib.c @@ -0,0 +1,4 @@ +extern int foo(void) +{ + return 0; +} diff --git a/test/MinGW/mingw_uses_comstr_issue_2799.py b/test/MinGW/mingw_uses_comstr_issue_2799.py new file mode 100644 index 0000000..cc92446 --- /dev/null +++ b/test/MinGW/mingw_uses_comstr_issue_2799.py @@ -0,0 +1,55 @@ +#!/usr/bin/env python +# +# __COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +""" +Test that mingw respects SHLINKCOMSTR, SHCCCOMSTR, and LDMODULECOMSTR +""" + +import sys +import TestSCons + +_python_ = TestSCons._python_ + +test = TestSCons.TestSCons() + +test.dir_fixture('bug_2799') + +test.run('-n -Q') +test.must_contain_all_lines(test.stdout(), + [ + 'SHCC shlib.o', + 'SHLINK libtestlib.so', + 'SHCC module.o', + 'LDMODULE libtestmodule.so',''], + ) + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: -- cgit v0.12 From c9d50a23d164c7e1ca2addad5f7be33083620507 Mon Sep 17 00:00:00 2001 From: William Deegan Date: Mon, 11 Mar 2019 15:54:26 -0400 Subject: PEP8 --- src/engine/SCons/Tool/mingw.py | 59 +++++++++++++++++++++--------------------- 1 file changed, 30 insertions(+), 29 deletions(-) diff --git a/src/engine/SCons/Tool/mingw.py b/src/engine/SCons/Tool/mingw.py index 311a955..df88d79 100644 --- a/src/engine/SCons/Tool/mingw.py +++ b/src/engine/SCons/Tool/mingw.py @@ -43,7 +43,6 @@ import SCons.Defaults import SCons.Tool import SCons.Util - mingw_paths = [ r'c:\MinGW\bin', r'C:\cygwin64\bin', @@ -52,8 +51,9 @@ mingw_paths = [ r'C:\msys', ] + def shlib_generator(target, source, env, for_signature): - cmd = SCons.Util.CLVar(['$SHLINK', '$SHLINKFLAGS']) + cmd = SCons.Util.CLVar(['$SHLINK', '$SHLINKFLAGS']) dll = env.FindIxes(target, 'SHLIBPREFIX', 'SHLIBSUFFIX') if dll: cmd.extend(['-o', dll]) @@ -61,31 +61,32 @@ def shlib_generator(target, source, env, for_signature): cmd.extend(['$SOURCES', '$_LIBDIRFLAGS', '$_LIBFLAGS']) implib = env.FindIxes(target, 'LIBPREFIX', 'LIBSUFFIX') - if implib: cmd.append('-Wl,--out-implib,'+implib.get_string(for_signature)) + if implib: cmd.append('-Wl,--out-implib,' + implib.get_string(for_signature)) def_target = env.FindIxes(target, 'WINDOWSDEFPREFIX', 'WINDOWSDEFSUFFIX') insert_def = env.subst("$WINDOWS_INSERT_DEF") if not insert_def in ['', '0', 0] and def_target: \ - cmd.append('-Wl,--output-def,'+def_target.get_string(for_signature)) + cmd.append('-Wl,--output-def,' + def_target.get_string(for_signature)) return [cmd] + def shlib_emitter(target, source, env): dll = env.FindIxes(target, 'SHLIBPREFIX', 'SHLIBSUFFIX') no_import_lib = env.get('no_import_lib', 0) if not dll: - raise SCons.Errors.UserError("A shared library should have exactly one target with the suffix: %s Target(s) are:%s" % \ + raise SCons.Errors.UserError( + "A shared library should have exactly one target with the suffix: %s Target(s) are:%s" % \ (env.subst("$SHLIBSUFFIX"), ",".join([str(t) for t in target]))) - - if not no_import_lib and \ - not env.FindIxes(target, 'LIBPREFIX', 'LIBSUFFIX'): + if not no_import_lib and \ + not env.FindIxes(target, 'LIBPREFIX', 'LIBSUFFIX'): # Create list of target libraries as strings - targetStrings=env.ReplaceIxes(dll, - 'SHLIBPREFIX', 'SHLIBSUFFIX', - 'LIBPREFIX', 'LIBSUFFIX') - + targetStrings = env.ReplaceIxes(dll, + 'SHLIBPREFIX', 'SHLIBSUFFIX', + 'LIBPREFIX', 'LIBSUFFIX') + # Now add file nodes to target list target.append(env.fs.File(targetStrings)) @@ -97,15 +98,15 @@ def shlib_emitter(target, source, env): skip_def_insert = env.subst("$WINDOWS_INSERT_DEF") in ['', '0', 0] if not def_source and not def_target and not skip_def_insert: # Create list of target libraries and def files as strings - targetStrings=env.ReplaceIxes(dll, - 'SHLIBPREFIX', 'SHLIBSUFFIX', - 'WINDOWSDEFPREFIX', 'WINDOWSDEFSUFFIX') - + targetStrings = env.ReplaceIxes(dll, + 'SHLIBPREFIX', 'SHLIBSUFFIX', + 'WINDOWSDEFPREFIX', 'WINDOWSDEFSUFFIX') + # Now add file nodes to target list target.append(env.fs.File(targetStrings)) return (target, source) - + shlib_action = SCons.Action.Action(shlib_generator, '$SHLINKCOMSTR', generator=1) ldmodule_action = SCons.Action.Action(shlib_generator, '$LDMODULECOMSTR', generator=1) @@ -121,7 +122,6 @@ SCons.Tool.SourceFileScanner.add_scanner('.rc', SCons.Defaults.CScan) key_program = 'mingw32-make' - def find_version_specific_mingw_paths(): """ One example of default mingw install paths is: @@ -130,14 +130,14 @@ def find_version_specific_mingw_paths(): Use glob'ing to find such and add to mingw_paths """ new_paths = glob.glob(r"C:\mingw-w64\*\mingw64\bin") - + return new_paths def generate(env): global mingw_paths # Check for reasoanble mingw default paths - mingw_paths +=find_version_specific_mingw_paths() + mingw_paths += find_version_specific_mingw_paths() mingw = SCons.Tool.find_program_path(env, key_program, default_paths=mingw_paths) if mingw: @@ -149,7 +149,7 @@ def generate(env): for tool in gnu_tools: SCons.Tool.Tool(tool)(env) - #... but a few things differ: + # ... but a few things differ: env['CC'] = 'gcc' # make sure the msvc tool doesnt break us, it added a /flag if 'CCFLAGS' in env: @@ -161,16 +161,16 @@ def generate(env): env['CXX'] = 'g++' env['SHCXXFLAGS'] = SCons.Util.CLVar('$CXXFLAGS') env['SHLINKFLAGS'] = SCons.Util.CLVar('$LINKFLAGS -shared') - env['SHLINKCOM'] = shlib_action + env['SHLINKCOM'] = shlib_action env['LDMODULECOM'] = ldmodule_action - env.Append(SHLIBEMITTER = [shlib_emitter]) - env.Append(LDMODULEEMITTER = [shlib_emitter]) + env.Append(SHLIBEMITTER=[shlib_emitter]) + env.Append(LDMODULEEMITTER=[shlib_emitter]) env['AS'] = 'as' - env['WIN32DEFPREFIX'] = '' - env['WIN32DEFSUFFIX'] = '.def' - env['WINDOWSDEFPREFIX'] = '${WIN32DEFPREFIX}' - env['WINDOWSDEFSUFFIX'] = '${WIN32DEFSUFFIX}' + env['WIN32DEFPREFIX'] = '' + env['WIN32DEFSUFFIX'] = '.def' + env['WINDOWSDEFPREFIX'] = '${WIN32DEFPREFIX}' + env['WINDOWSDEFSUFFIX'] = '${WIN32DEFSUFFIX}' env['SHOBJSUFFIX'] = '.o' env['STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME'] = 1 @@ -181,13 +181,14 @@ def generate(env): env['RCINCSUFFIX'] = '' env['RCCOM'] = '$RC $_CPPDEFFLAGS $RCINCFLAGS ${RCINCPREFIX} ${SOURCE.dir} $RCFLAGS -i $SOURCE -o $TARGET' env['BUILDERS']['RES'] = res_builder - + # Some setting from the platform also have to be overridden: env['OBJSUFFIX'] = '.o' env['LIBPREFIX'] = 'lib' env['LIBSUFFIX'] = '.a' env['PROGSUFFIX'] = '.exe' + def exists(env): mingw = SCons.Tool.find_program_path(env, key_program, default_paths=mingw_paths) if mingw: -- cgit v0.12 From ac3962931843e52e59c93ce19b4d2b320b1f4e9f Mon Sep 17 00:00:00 2001 From: William Deegan Date: Mon, 11 Mar 2019 23:35:46 -0400 Subject: [skip ci] Add info to CHANGES.txt --- src/CHANGES.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 6d8125f..3c19dd6 100755 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -17,6 +17,7 @@ RELEASE 3.0.5.alpha.yyyymmdd - NEW DATE WILL BE INSERTED HERE - Fix Issue #3303 - Handle --config=force overwriting the Environment passed into Configure()'s Decider and not clearing it when the configure context is completed. - Add default paths for yacc tool on windows to include cygwin, mingw, and chocolatey + - Fix issue #2799 - Fix mingw tool to respect SHCCCOMSTR, SHLINKCOMSTR and LDMODULECOMSTR From Daniel Moody: - Change the default for AppendENVPath to delete_existing=0, so path -- cgit v0.12