diff --git a/Makefile b/Makefile index 224b837c..884e306a 100644 --- a/Makefile +++ b/Makefile @@ -65,7 +65,7 @@ python/dist/*: $(BUILD_DIR)/python $(wildcard python/**/*.py) python/jsbeautifie rm -f python/dist/* @cd python && \ $(PYTHON) setup.py sdist - ./build/python-rel/bin/pip install -U python/dist/* + $(SCRIPT_DIR)/python-rel pip install -U python/dist/* # Test generation $(BUILD_DIR)/generate: $(BUILD_DIR)/node test/generate-tests.js $(wildcard test/data/**/*) @@ -92,8 +92,7 @@ $(BUILD_DIR)/node: package.json package-lock.json | $(BUILD_DIR) $(BUILD_DIR)/python: python/setup.py | $(BUILD_DIR) $(BUILD_DIR)/virtualenv @$(PYTHON) --version - ls -alR ./build - ./build/python-dev/bin/pip install -e ./python + $(SCRIPT_DIR)/python-dev pip install -e ./python @touch $(BUILD_DIR)/python $(BUILD_DIR)/virtualenv: | $(BUILD_DIR) diff --git a/python/jsbeautifier/tests/shell-smoke-test.sh b/python/jsbeautifier/tests/shell-smoke-test.sh index 1edb1344..5ff31b59 100755 --- a/python/jsbeautifier/tests/shell-smoke-test.sh +++ b/python/jsbeautifier/tests/shell-smoke-test.sh @@ -310,7 +310,7 @@ test_smoke_js_beautify() { echo ---------------------------------------- echo Testing beautify functionality... - $SCRIPT_DIR/../../js-beautify-test.py || exit 1 + $SCRIPT_DIR/../../../tools/python-dev python $SCRIPT_DIR/../../js-beautify-test.py || exit 1 } test_perf_js_beautify() @@ -318,7 +318,7 @@ test_perf_js_beautify() echo ---------------------------------------- echo Testing beautify performance... # PYTHON=python $SCRIPT_DIR/../../js-beautify-profile || exit 1 - $SCRIPT_DIR/../../test-perf-jsbeautifier.py || exit 1 + $SCRIPT_DIR/../../../tools/python-dev python $SCRIPT_DIR/../../test-perf-jsbeautifier.py || exit 1 } main() { @@ -326,11 +326,11 @@ main() { #test_cli_common css-beautify #test_cli_common html-beautify - test_cli_common js-beautify $SCRIPT_DIR/../../../build/python-dev/bin/js-beautify - test_cli_common js-beautify $SCRIPT_DIR/../../../build/python-rel/bin/js-beautify + test_cli_common js-beautify "$SCRIPT_DIR/../../../tools/python-dev js-beautify" + test_cli_common js-beautify "$SCRIPT_DIR/../../../tools/python-rel js-beautify" - test_cli_js_beautify $SCRIPT_DIR/../../../build/python-dev/bin/js-beautify + test_cli_js_beautify "$SCRIPT_DIR/../../../tools/python-dev js-beautify" test_perf_js_beautify echo ---------------------------------------- diff --git a/tools/python-dev b/tools/python-dev new file mode 100755 index 00000000..570efb29 --- /dev/null +++ b/tools/python-dev @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +REL_SCRIPT_DIR="`dirname \"$0\"`" +SCRIPT_DIR="`( cd \"$REL_SCRIPT_DIR\" && pwd )`" +PROJECT_DIR="`( cd \"$SCRIPT_DIR/..\" && pwd )`" +PYTHON_ENV=python-dev + +if [ -d "$PROJECT_DIR/build/$PYTHON_ENV/Scripts" ]; then + RUN_FILE="$PROJECT_DIR/build/$PYTHON_ENV/Scripts/$1" +else + RUN_FILE="$PROJECT_DIR/build/$PYTHON_ENV/bin/$1" +fi + +shift + +$RUN_FILE $@ diff --git a/tools/python-rel b/tools/python-rel new file mode 100755 index 00000000..93bc6fb3 --- /dev/null +++ b/tools/python-rel @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +REL_SCRIPT_DIR="`dirname \"$0\"`" +SCRIPT_DIR="`( cd \"$REL_SCRIPT_DIR\" && pwd )`" +PROJECT_DIR="`( cd \"$SCRIPT_DIR/..\" && pwd )`" +PYTHON_ENV=python-rel + +if [ -d "$PROJECT_DIR/build/$PYTHON_ENV/Scripts" ]; then + RUN_FILE="$PROJECT_DIR/build/$PYTHON_ENV/Scripts/$1" +else + RUN_FILE="$PROJECT_DIR/build/$PYTHON_ENV/bin/$1" +fi + +shift + +$RUN_FILE $@