From 7e51947f475db6ac96d6a4f05559dcd785a8bc42 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Mon, 27 Jun 2016 23:54:37 +0100 Subject: Launch poezio as a module package. --- launch.sh | 12 ++++++------ poezio/__init__.py | 1 - poezio/__main__.py | 6 ++++++ poezio/poezio.py | 6 ------ 4 files changed, 12 insertions(+), 13 deletions(-) create mode 100644 poezio/__main__.py diff --git a/launch.sh b/launch.sh index 267c90f4..b4beb839 100755 --- a/launch.sh +++ b/launch.sh @@ -1,20 +1,20 @@ #!/bin/sh -poezio_dir=$(dirname "$0") +cd $(dirname "$0") if [ -z "$POEZIO_VENV" ] then POEZIO_VENV="poezio-venv" fi -if [ -d "$poezio_dir/.git" ] +if [ -d .git ] then - args=$(git --git-dir="$poezio_dir/.git" show --format='%h %ci' | head -n1) + args=$(git show --format='%h %ci' | head -n1) else args="0.9-dev" fi -if [ -e "$poezio_dir/$POEZIO_VENV" ] +if [ -e "$POEZIO_VENV" ] then - PYTHON3="$poezio_dir/$POEZIO_VENV/bin/python3" + PYTHON3="$POEZIO_VENV/bin/python3" else echo "" echo "WARNING: Not using the up-to-date launch format" @@ -25,5 +25,5 @@ else fi $PYTHON3 -c 'import sys;(print("Python 3.4 or newer is required") and exit(1)) if sys.version_info < (3, 4) else exit(0)' || exit 1 -exec "$PYTHON3" "$poezio_dir/poezio/poezio.py" -v "$args" "$@" +exec "$PYTHON3" -m poezio -v "$args" "$@" diff --git a/poezio/__init__.py b/poezio/__init__.py index 9fdbcc02..e69de29b 100644 --- a/poezio/__init__.py +++ b/poezio/__init__.py @@ -1 +0,0 @@ -from poezio.poezio import main diff --git a/poezio/__main__.py b/poezio/__main__.py new file mode 100644 index 00000000..5f34230b --- /dev/null +++ b/poezio/__main__.py @@ -0,0 +1,6 @@ +from poezio.poezio import test_curses, main + +if test_curses(): + main() +else: + sys.exit(1) diff --git a/poezio/poezio.py b/poezio/poezio.py index 9fb6fb73..361daa91 100644 --- a/poezio/poezio.py +++ b/poezio/poezio.py @@ -107,9 +107,3 @@ def main(): cocore.reset_curses() except: pass - -if __name__ == '__main__': - if test_curses(): - main() - else: - sys.exit(1) -- cgit v1.2.3