Skip to content

Commit a4b7956

Browse files
Better project and target structure; bump version: 0.1.7
1 parent c39458a commit a4b7956

File tree

2 files changed

+32
-5
lines changed

2 files changed

+32
-5
lines changed

bin/ppmc

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,37 @@ done
4545
SCRIPT_DIR=$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )
4646
echo "Script directory: $SCRIPT_DIR"
4747

48-
# Check if the package is installed
49-
if python -c "import platform_problem_monitoring_core" &>/dev/null; then
48+
# Try to determine which Python executable to use
49+
PYTHON_CMD="python3"
50+
51+
# Check if Python 3 is available
52+
if ! command -v python3 &>/dev/null; then
53+
# Fall back to just 'python' if python3 is not available
54+
if command -v python &>/dev/null; then
55+
PYTHON_CMD="python"
56+
else
57+
echo "Error: Neither python3 nor python found in PATH"
58+
exit 1
59+
fi
60+
fi
61+
62+
echo "Using Python: $($PYTHON_CMD --version)"
63+
64+
# More robust check for installed package
65+
PACKAGE_INSTALLED=false
66+
if $PYTHON_CMD -c "import platform_problem_monitoring_core" &>/dev/null; then
67+
echo "Package found in primary Python installation"
68+
PACKAGE_INSTALLED=true
69+
# Try with pip list as a fallback check
70+
elif $PYTHON_CMD -m pip list | grep -i "platform-problem-monitoring-core" &>/dev/null; then
71+
echo "Package found in pip list"
72+
PACKAGE_INSTALLED=true
73+
fi
74+
75+
# Determine if we're running from source or an installed package
76+
if [ "$PACKAGE_INSTALLED" = true ]; then
5077
echo "Running from installed package"
51-
PYTHON_CMD="python"
78+
PYTHON_CMD=$PYTHON_CMD
5279
else
5380
# If running from source, detect package root and create/use virtual environment
5481
# When running from source, the script should be in bin/ which is at the root of the project
@@ -62,7 +89,7 @@ else
6289

6390
if [ ! -d "venv" ]; then
6491
echo "Creating virtual environment"
65-
python3 -m venv venv
92+
$PYTHON_CMD -m venv venv
6693
fi
6794

6895
source venv/bin/activate

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "platform_problem_monitoring_core"
7-
version = "0.1.6"
7+
version = "0.1.8"
88
description = "A tool for monitoring platform problems using Elasticsearch logs"
99
authors = [
1010
{name = "Platform Team"}

0 commit comments

Comments
 (0)