diff --git a/test/DynamicVersion/test_archive.sh b/test/DynamicVersion/test_archive.sh index c5d53fe..74f0feb 100755 --- a/test/DynamicVersion/test_archive.sh +++ b/test/DynamicVersion/test_archive.sh @@ -11,6 +11,7 @@ rlJournalStart [[ -n "$CMakeExtraUtils_ROOT" ]] && rlRun "base_configure_args=\"\${base_configure_args} -DCMakeExtraUtils_ROOT=\${CMakeExtraUtils_ROOT}\"" 0 "Add CMakeExtraUtils_ROOT" rlRun "echo '.git_archival.txt export-subst' > .gitattributes" 0 "Configure .gitattributes" rlRun "set -o pipefail" + rlIsCentOS && rlRun "export PYTHONWARNINGS=\"ignore::RuntimeWarning\" && hatch_args=\"2>&1\"" 0 "Workaround for hatch/setuptools_scm issue" rlPhaseEnd for mode in DEV POST; do @@ -58,7 +59,8 @@ rlJournalStart rlRun "distance=0 && echo \${distance}" 0 "Extract git distance" rlRun "git archive HEAD --prefix=${archive_name}/ -o ${archive_name}.tar.gz" 0 "Git archive" rlRun "tar -xf ${archive_name}.tar.gz" 0 "Extract archive" - rlRun "version_full=\$(cd ${archive_name} && hatch version) && echo \${version_full}" 0 "Get setuptools_scm version" + rlIsCentOS && rlRun "echo \$(cd ${archive_name} && hatch version)" 0 "Setup hatch environment" + rlRun "version_full=\$(cd ${archive_name} && hatch version ${hatch_args:-""}) && echo \${version_full}" 0 "Get setuptools_scm version" rlRun -s "cmake -S ${archive_name} ${configure_args}" 0 "CMake configure" rlAssertGrep "^\[TestProject\] version: ${tag_version}\$" $rlRun_LOG rlAssertGrep "^\[TestProject\] version-full: ${version_full}\$" $rlRun_LOG @@ -93,7 +95,8 @@ rlJournalStart rlRun "distance=\$(echo \${describe} | sed -E 's/.*-([0-9]+)-.*/\1/') && echo \${distance}" 0 "Extract git distance" rlRun "git archive HEAD --prefix=${archive_name}/ -o ${archive_name}.tar.gz" 0 "Git archive" rlRun "tar -xf ${archive_name}.tar.gz" 0 "Extract archive" - rlRun "version_full=\$(cd ${archive_name} && hatch version) && echo \${version_full}" 0 "Get setuptools_scm version" + rlIsCentOS && rlRun "echo \$(cd ${archive_name} && hatch version)" 0 "Setup hatch environment" + rlRun "version_full=\$(cd ${archive_name} && hatch version ${hatch_args:-""}) && echo \${version_full}" 0 "Get setuptools_scm version" rlRun "version=\$(echo \${version_full} | sed -E 's/([0-9\.]*)\.[a-z].*/\1/') && echo \${version}" 0 "Strip version" rlRun -s "cmake -S ${archive_name} ${configure_args}" 0 "CMake configure" rlAssertGrep "^\[TestProject\] version: ${version}\$" $rlRun_LOG diff --git a/test/DynamicVersion/test_git.sh b/test/DynamicVersion/test_git.sh index a12547c..90e1341 100755 --- a/test/DynamicVersion/test_git.sh +++ b/test/DynamicVersion/test_git.sh @@ -13,6 +13,7 @@ rlJournalStart rlRun "configure_args=\"-B \${build_dir} \${base_configure_args}\" && echo \${configure_args}" 0 "Set temporary configure_args" rlRun "echo '.git_archival.txt export-subst' > .gitattributes" 0 "Configure .gitattributes" rlRun "set -o pipefail" + rlIsCentOS && rlRun "export PYTHONWARNINGS=\"ignore::RuntimeWarning\" && hatch_args=\"2>&1\" && hatch version || true" 0 "Workaround for hatch/setuptools_scm issue" rlPhaseEnd rlPhaseStartTest "Not a git repo not an archive: Should fail" @@ -59,7 +60,7 @@ rlJournalStart rlRun "short_hash=\$(git rev-parse --short HEAD) && echo \${short_hash}" 0 "Get git short-hash" rlRun "describe=\$(git describe --tags --long) && echo \${describe}" 0 "Get git describe" rlRun "distance=\$(echo \${describe} | sed -E 's/.*-([0-9]+)-.*/\1/') && echo \${distance}" 0 "Extract git distance" - rlRun "version_full=\$(hatch version) && echo \${version_full}" 0 "Get setuptools_scm version" + rlRun "version_full=\$(hatch version ${hatch_args:-""}) && echo \${version_full}" 0 "Get setuptools_scm version" rlRun -s "cmake ${configure_args}" 0 "CMake configure" rlAssertGrep "^\[TestProject\] version: ${tag_version}\$" $rlRun_LOG rlAssertGrep "^\[TestProject\] version-full: ${version_full}\$" $rlRun_LOG @@ -109,7 +110,7 @@ rlJournalStart rlRun "short_hash=\$(git rev-parse --short HEAD) && echo \${short_hash}" 0 "Get git short-hash" rlRun "describe=\$(git describe --tags --long) && echo \${describe}" 0 "Get git describe" rlRun "distance=\$(echo \${describe} | sed -E 's/.*-([0-9]+)-.*/\1/') && echo \${distance}" 0 "Extract git distance" - rlRun "version_full=\$(hatch version) && echo \${version_full}" 0 "Get setuptools_scm version" + rlRun "version_full=\$(hatch version ${hatch_args:-""}) && echo \${version_full}" 0 "Get setuptools_scm version" rlRun "version=\$(echo \${version_full} | sed -E 's/([0-9\.]*)\.[a-z].*/\1/') && echo \${version}" 0 "Strip version" # Check if it re-configured due to version change rlRun -s "cmake ${build_args} -t version" 0 "CMake build (version) 1st" @@ -163,7 +164,7 @@ rlJournalStart rlRun "git tag v\${tag_version}" 0 "Tag commit" rlRun "describe=\$(git describe --tags --long) && echo \${describe}" 0 "Get git describe" rlRun "distance=\$(echo \${describe} | sed -E 's/.*-([0-9]+)-.*/\1/') && echo \${distance}" 0 "Extract git distance" - rlRun "version_full=\$(hatch version) && echo \${version_full}" 0 "Get setuptools_scm version" + rlRun "version_full=\$(hatch version ${hatch_args:-""}) && echo \${version_full}" 0 "Get setuptools_scm version" # Commit did not change, it should not re-configure rlRun -s "cmake ${build_args} -t commit" 0 "CMake build (commit) 1st" rlAssertNotGrep "Re-running CMake" $rlRun_LOG diff --git a/test/DynamicVersion/test_sdist.sh b/test/DynamicVersion/test_sdist.sh index 2cd981a..2eaada6 100755 --- a/test/DynamicVersion/test_sdist.sh +++ b/test/DynamicVersion/test_sdist.sh @@ -11,6 +11,7 @@ rlJournalStart [[ -n "$CMakeExtraUtils_ROOT" ]] && rlRun "base_configure_args=\"\${base_configure_args} -DCMakeExtraUtils_ROOT=\${CMakeExtraUtils_ROOT}\"" 0 "Add CMakeExtraUtils_ROOT" rlRun "echo '.git_archival.txt export-subst' > .gitattributes" 0 "Configure .gitattributes" rlRun "set -o pipefail" + rlIsCentOS && rlRun "export PYTHONWARNINGS=\"ignore::RuntimeWarning\" && hatch_args=\"2>&1\" && hatch version || true" 0 "Workaround for hatch/setuptools_scm issue" rlPhaseEnd for mode in DEV POST; do @@ -41,7 +42,7 @@ rlJournalStart rlRun "rm -rf ${build_dir} dist testproject-*" 0 "Clean the build, dist, extracted directory" rlRun "tag_version=0.0.0" 0 "Set tag_version" rlRun "git tag v\${tag_version}" 0 "Tag git commit" - rlRun "version_full=\$(hatch version) && echo \${version_full}" 0 "Get setuptools_scm version" + rlRun "version_full=\$(hatch version ${hatch_args:-""}) && echo \${version_full}" 0 "Get setuptools_scm version" rlRun "commit=\$(git rev-parse HEAD) && echo \${commit}" 0 "Get git commit" rlRun "short_hash=\$(git rev-parse --short HEAD) && echo \${short_hash}" 0 "Get git short-hash" rlRun "describe=\$(git describe --tags) && echo \${describe}" 0 "Get git describe" @@ -76,7 +77,7 @@ rlJournalStart rlRun "touch ./random_file" 0 "Create a random file" rlRun "git add random_file" 0 "Git add the random file" rlRun "git commit -m 'Moved commit'" 0 "Git commit (off-tag)" - rlRun "version_full=\$(hatch version) && echo \${version_full}" 0 "Get setuptools_scm version" + rlRun "version_full=\$(hatch version ${hatch_args:-""}) && echo \${version_full}" 0 "Get setuptools_scm version" rlRun "version=\$(echo \${version_full} | sed -E 's/([0-9\.]*)\.[a-z].*/\1/') && echo \${version}" 0 "Strip version" rlRun "commit=\$(git rev-parse HEAD) && echo \${commit}" 0 "Get git commit" rlRun "short_hash=\$(git rev-parse --short HEAD) && echo \${short_hash}" 0 "Get git short-hash"