Handle windows python

This commit is contained in:
Liam Newman 2018-07-25 14:07:59 -07:00
parent bfcbb0c9a3
commit b10bfda78b
4 changed files with 39 additions and 8 deletions

View File

@ -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)

View File

@ -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 ----------------------------------------

16
tools/python-dev Executable file
View File

@ -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 $@

16
tools/python-rel Executable file
View File

@ -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 $@