Skip to content

Commit

Permalink
adds ceur-ws script
Browse files Browse the repository at this point in the history
  • Loading branch information
WolfgangFahl committed Jul 30, 2024
1 parent 18a1d41 commit 18cf12d
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions scripts/ceur-ws
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/bin/bash
# WF 2024-01-30
# call ceur-ws from venv
root=$HOME/py-workspace
project=pyCEURmake
if [ ! -d $root/$project ]
then
cd $root
git clone https://github.com/WolfgangFahl/$project
fi

cd $root/$project
if [ ! -d "venv" ]; then
python3 -m venv venv
fi
source venv/bin/activate

#
# rebuild
#
rebuild() {
echo "Rebuilding ceur-ws from source..."
git pull
pip install --upgrade pip
pip install .
}

# Add logic for determining if a rebuild is necessary
# This is a simple check; adapt it to your specific needs
NEEDS_REBUILD=0
SOURCE_DIR="ceurws"

for file in $(find $SOURCE_DIR -name '*.py'); do
if [ $file -nt "venv/bin/ceur-ws" ]; then
NEEDS_REBUILD=1
break
fi
done

if [ $NEEDS_REBUILD -eq 1 ]; then
rebuild
fi

# Call the script directly if it's installed as an entry point
if [ -x "venv/bin/ceur-ws" ]; then
# Pass all script arguments to ceur-ws
venv/bin/ceur-ws "$@"
else
# If the script is not found, you can call it with Python, but this depends on your project structure
python -m ceurws.ceur_ws_cmd "$@"
fi

# Deactivate the virtual environment
deactivate

0 comments on commit 18cf12d

Please sign in to comment.