From 145e722b5e8ab03833853aa70182c61da223e08a Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Wed, 22 May 2024 16:09:05 -0500 Subject: [PATCH] feat: rm DETECTOR_VERSION from thisepic.sh; rm setup.sh (#733) This PR removed DETECTOR_VERSION from thisepic.sh, and it removes installation of the setup.sh script. ### What kind of change does this PR introduce? - [x] Bug fix (issue #__) - [ ] New feature (issue #__) - [ ] Documentation update - [ ] Other: __ ### Please check if this PR fulfills the following: - [ ] Tests for the changes have been added - [ ] Documentation has been added / updated - [ ] Changes have been communicated to collaborators ### Does this PR introduce breaking changes? What changes might users need to make to their code? No. ### Does this PR change default behavior? Yes, don't use `setup.sh` anymore. It's dead Jim. --------- Co-authored-by: Dmitry Kalinkin --- .github/labeler.yml | 2 +- .github/workflows/linux-eic-shell.yml | 36 +++++++++++------------ CMakeLists.txt | 12 ++++---- README.md | 2 +- templates/{setup.sh.in => thisepic.sh.in} | 7 ++++- 5 files changed, 32 insertions(+), 27 deletions(-) rename templates/{setup.sh.in => thisepic.sh.in} (56%) diff --git a/.github/labeler.yml b/.github/labeler.yml index 07b36d704..a6d3cc661 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -62,7 +62,7 @@ - "reports/**/*" - "requirements.txt" - "scripts/**/*" - - "templates/setup.sh.in" + - "templates/thisepic.sh.in" - "views/**/*" "topic: magnets": diff --git a/.github/workflows/linux-eic-shell.yml b/.github/workflows/linux-eic-shell.yml index f8635edf9..fdf0fb96f 100644 --- a/.github/workflows/linux-eic-shell.yml +++ b/.github/workflows/linux-eic-shell.yml @@ -97,7 +97,7 @@ jobs: path: install/ if-no-files-found: error - run: | - source install/setup.sh + source install/bin/thisepic.sh sed -i 's%\(\1%g; s%\(/fiber>\|/lens>\)%\1%g' \ ${DETECTOR_PATH}/compact/ecal/barrel_interlayers.xml \ ${DETECTOR_PATH}/compact/ecal/forward_scfi.xml \ @@ -161,7 +161,7 @@ jobs: with: platform-release: "jug_xl:nightly" network_types: "none" - setup: install/setup.sh + setup: install/bin/thisepic.sh run: | IFS=, read -a configs <<< "${{ needs.list-detector-configs.outputs.configs_csv }}" for config in ${configs[@]} ; do @@ -187,7 +187,7 @@ jobs: with: platform-release: "jug_xl:nightly" network_types: "none" - setup: install/setup.sh + setup: install/bin/thisepic.sh run: | root -b -q "scripts/test_ACTS.cxx+(\"${DETECTOR_PATH}/${{matrix.detector_config}}.xml\")" | tee check_tracking_geometry.out bin/acts_geo_check check_tracking_geometry.out @@ -207,7 +207,7 @@ jobs: - uses: eic/run-cvmfs-osg-eic-shell@main with: platform-release: "jug_xl:nightly" - setup: install/setup.sh + setup: install/bin/thisepic.sh run: | pushd scripts/material_map export DETECTOR_CONFIG=epic_craterlake_material_map @@ -239,7 +239,7 @@ jobs: with: platform-release: "jug_xl:nightly" network_types: "none" - setup: install/setup.sh + setup: install/bin/thisepic.sh run: | IFS=, read -a configs <<< "${{ needs.list-detector-configs.outputs.configs_csv }}" for config in ${configs[@]} ; do @@ -269,7 +269,7 @@ jobs: with: platform-release: "jug_xl:nightly" network_types: "none" - setup: install/setup.sh + setup: install/bin/thisepic.sh run: | IFS=, read -a configs <<< "${{ needs.list-detector-configs.outputs.configs_csv }}" for config in ${configs[@]} ; do @@ -301,7 +301,7 @@ jobs: with: platform-release: "jug_xl:nightly" network_types: "none" - setup: install/setup.sh + setup: install/bin/thisepic.sh run: | # For some reason npdet_to_step really wants a space in IFS IFS=$' \n\t' @@ -337,7 +337,7 @@ jobs: with: platform-release: "jug_xl:nightly" network_types: "none" - setup: install/setup.sh + setup: install/bin/thisepic.sh run: | mkdir -p doc npdet_info dump ${DETECTOR_PATH}/${{matrix.detector_config}}.xml | tee doc/${{matrix.detector_config}}_constants.out @@ -364,7 +364,7 @@ jobs: with: platform-release: "jug_xl:nightly" network_types: "none" - setup: install/setup.sh + setup: install/bin/thisepic.sh run: | mkdir -p doc npdet_info dump ${DETECTOR_PATH}/${{matrix.detector_config}}.xml | grep -v '^\s' | grep '=' | cut -d= -f1-2 | tee doc/${{matrix.detector_config}}_constants.toml @@ -432,7 +432,7 @@ jobs: with: platform-release: "jug_xl:nightly" network_types: "bridge" # this job must succeed even when new artifacts - setup: install/setup.sh + setup: install/bin/thisepic.sh run: | mkdir -p doc checkOverlaps --option ${{ matrix.option }} -c ${DETECTOR_PATH}/${{ matrix.detector_config }}.xml | tee doc/overlap_check_tgeo.out @@ -453,7 +453,7 @@ jobs: - uses: eic/run-cvmfs-osg-eic-shell@main with: platform-release: "jug_xl:nightly" - setup: install/setup.sh + setup: install/bin/thisepic.sh run: | mkdir -p doc checkGeometry -f true -c ${DETECTOR_PATH}/${DETECTOR_CONFIG}.xml | tee geometry_check_full.out @@ -485,7 +485,7 @@ jobs: with: platform-release: "jug_xl:nightly" network_types: "bridge" # this job must succeed even when new artifacts - setup: install/setup.sh + setup: install/bin/thisepic.sh run: | mkdir -p doc python scripts/checkOverlaps.py -c ${DETECTOR_PATH}/${{ matrix.detector_config }}.xml | tee doc/overlap_check_geant4.out @@ -510,7 +510,7 @@ jobs: with: platform-release: "jug_xl:nightly" network_types: "bridge" # this job must succeed even when new artifacts - setup: install/setup.sh + setup: install/bin/thisepic.sh run: | mkdir -p doc python scripts/checkOverlaps.py -c ${DETECTOR_PATH}/${{ matrix.detector_config }}.xml | tee doc/overlap_check_geant4.out @@ -569,7 +569,7 @@ jobs: with: platform-release: "jug_xl:nightly" network_types: "none" - setup: install/setup.sh + setup: install/bin/thisepic.sh run: | bin/generate_prim_file -c $DETECTOR_PATH/${{ matrix.detector_config }}.xml -o prim -D -t ${{ matrix.detector_config }} - uses: actions/upload-artifact@v4 @@ -672,7 +672,7 @@ jobs: uses: eic/run-cvmfs-osg-eic-shell@main with: platform-release: "jug_xl:nightly" - setup: install/setup.sh + setup: install/bin/thisepic.sh run: | npsim --compactFile ${DETECTOR_PATH}/${{ matrix.detector_config }}.xml -G --random.seed 1 --gun.particle "${{ matrix.particle }}-" --gun.momentumMin "1*GeV" --gun.momentumMax "20*GeV" --gun.distribution "uniform" -N 100 --outputFile sim_${{ matrix.particle }}_1GeV_20GeV_${{ matrix.detector_config }}.edm4hep.root -v WARNING - uses: actions/upload-artifact@v4 @@ -693,7 +693,7 @@ jobs: uses: eic/run-cvmfs-osg-eic-shell@main with: platform-release: "jug_xl:nightly" - setup: install/setup.sh + setup: install/bin/thisepic.sh run: | export PYTHONPATH=$HOME/.local/lib/python3.10/site-packages:$PYTHONPATH mkdir capybara-reports @@ -731,7 +731,7 @@ jobs: uses: eic/run-cvmfs-osg-eic-shell@main with: platform-release: "jug_xl:nightly" - setup: install/setup.sh + setup: install/bin/thisepic.sh run: | url=root://dtn-eic.jlab.org//work/eic2/EPIC/EVGEN/DIS/NC/${{matrix.beam}}/minQ2=${{matrix.minq2}}/pythia8NCDIS_${{matrix.beam}}_minQ2=${{matrix.minq2}}_beamEffects_xAngle=-0.025_hiDiv_1.hepmc3.tree.root npsim --compactFile ${DETECTOR_PATH}/${{ matrix.detector_config }}.xml -N 100 --inputFiles ${url} --random.seed 1 --outputFile sim_dis_${{matrix.beam}}_minQ2=${{matrix.minq2}}_${{ matrix.detector_config }}.edm4hep.root -v WARNING @@ -753,7 +753,7 @@ jobs: uses: eic/run-cvmfs-osg-eic-shell@main with: platform-release: "jug_xl:nightly" - setup: install/setup.sh + setup: install/bin/thisepic.sh run: | pip install 'pygithub>=2' 'bokeh>=3' export PYTHONPATH=$HOME/.local/lib/python3.10/site-packages:$PYTHONPATH diff --git a/CMakeLists.txt b/CMakeLists.txt index 0f8da16e4..fa06a7105 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -109,13 +109,13 @@ execute_process( OUTPUT_VARIABLE GIT_BRANCH OUTPUT_STRIP_TRAILING_WHITESPACE ) -configure_file(templates/setup.sh.in ${CMAKE_CURRENT_BINARY_DIR}/setup.sh @ONLY) -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/setup.sh - DESTINATION ${CMAKE_INSTALL_PREFIX} -) -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/setup.sh +configure_file(templates/thisepic.sh.in ${CMAKE_CURRENT_BINARY_DIR}/thisepic.sh @ONLY) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/thisepic.sh DESTINATION ${CMAKE_INSTALL_BINDIR} - RENAME this${PROJECT_NAME}.sh +) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/thisepic.sh + DESTINATION ${CMAKE_INSTALL_PREFIX} + RENAME setup.sh ) # install programs diff --git a/README.md b/README.md index b26cf36ff..aa19caebd 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ cmake --install build ``` To load the geometry, you can use the scripts in the `install` directory: ```bash -source install/setup.sh +source install/bin/thisepic.sh ``` ### Adding/changing detector geometry diff --git a/templates/setup.sh.in b/templates/thisepic.sh.in similarity index 56% rename from templates/setup.sh.in rename to templates/thisepic.sh.in index 9f1006ce8..464202c72 100644 --- a/templates/setup.sh.in +++ b/templates/thisepic.sh.in @@ -3,7 +3,12 @@ export DETECTOR=@PROJECT_NAME@ export DETECTOR_PATH=@CMAKE_INSTALL_FULL_DATADIR@/@PROJECT_NAME@ export DETECTOR_CONFIG=${1:-@PROJECT_NAME@} -export DETECTOR_VERSION=@GIT_BRANCH@ + +## Warn is not the right name (this script is sourced, hence $1) +if [[ "$(basename ${BASH_SOURCE[0]})" != "thisepic.sh" ]]; then + echo "Warning: This script will cease to exist at '$(realpath --no-symlinks ${BASH_SOURCE[0]})'." + echo " Please use the version at '$(realpath --no-symlinks $(dirname ${BASH_SOURCE[0]})/thisepic.sh)'." +fi ## Export detector libraries if [[ "$(uname -s)" = "Darwin" ]] || [[ "$OSTYPE" == "darwin"* ]]; then