Skip to content

Commit

Permalink
2025-01-10T15:36:21Z
Browse files Browse the repository at this point in the history
  • Loading branch information
wrmsr committed Jan 10, 2025
1 parent ef7e3b3 commit 1f98492
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 5 deletions.
6 changes: 5 additions & 1 deletion om
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#!/bin/sh
set -e

exec ./python -m omdev.cli "$@"
SCRIPT_PATH=$(cd -- "$(dirname -- "$0")" && pwd)
SCRIPT_PATH="$SCRIPT_PATH/$(basename -- "$0")"
SCRIPT_DIR=$(dirname "$SCRIPT_PATH")

exec "$SCRIPT_DIR/python" -m omdev.cli --cli-pkg-root "$SCRIPT_DIR" "$@"
7 changes: 5 additions & 2 deletions omdev/pyproject/resources/python.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ if [ -z "${VENV}" ] ; then
fi
fi

SCRIPT_DIR=$(dirname "$0")
SCRIPT_PATH=$(cd -- "$(dirname -- "$0")" && pwd)
SCRIPT_PATH="$SCRIPT_PATH/$(basename -- "$0")"
SCRIPT_DIR=$(dirname "$SCRIPT_PATH")

VENV_PYTHON_PATH="$SCRIPT_DIR/.venvs/$VENV/bin/python"
if [ -f "$VENV_PYTHON_PATH" ] ; then
PYTHON="$VENV_PYTHON_PATH"
Expand All @@ -19,7 +22,7 @@ else
PYTHON=python
fi

export PYTHONPATH="$PYTHONPATH:."
export PYTHONPATH="$PYTHONPATH:$SCRIPT_DIR:."

if [ $# -eq 0 ] && "$PYTHON" -c "import IPython" 2> /dev/null ; then
exec "$PYTHON" -m IPython
Expand Down
6 changes: 6 additions & 0 deletions omdev/tools/cc.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,12 @@ def run(self) -> int:

return proc.returncode

@ap.cmd(
ap.arg('src-file', nargs='+'),
)
def add_shebang(self) -> None:
print(self.args.src_file)


def _main() -> None:
Cli().cli_run_and_exit()
Expand Down
1 change: 1 addition & 0 deletions ominfra/pyremote.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,7 @@ def __init__(
self._payload_z = zlib.compress(self._prepared_payload_src.encode('utf-8'))

self._options_json = json.dumps(dc.asdict(options), indent=None, separators=(',', ':')).encode('utf-8') # noqa

#

@classmethod
Expand Down
8 changes: 6 additions & 2 deletions python
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ if [ -z "${VENV}" ] ; then
fi
fi

SCRIPT_DIR=$(dirname "$0")
SCRIPT_PATH=$(cd -- "$(dirname -- "$0")" && pwd)
SCRIPT_PATH="$SCRIPT_PATH/$(basename -- "$0")"
SCRIPT_DIR=$(dirname "$SCRIPT_PATH")
echo "SCRIPT_DIR=$SCRIPT_DIR"

VENV_PYTHON_PATH="$SCRIPT_DIR/.venvs/$VENV/bin/python"
if [ -f "$VENV_PYTHON_PATH" ] ; then
PYTHON="$VENV_PYTHON_PATH"
Expand All @@ -19,7 +23,7 @@ else
PYTHON=python
fi

export PYTHONPATH="$PYTHONPATH:."
export PYTHONPATH="$PYTHONPATH:$SCRIPT_DIR:."

if [ $# -eq 0 ] && "$PYTHON" -c "import IPython" 2> /dev/null ; then
exec "$PYTHON" -m IPython
Expand Down

0 comments on commit 1f98492

Please sign in to comment.