Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

isolate python install #1212

Benjamin King9129dd55f388
diff --git a/package.json b/package.json
index 673720f83..69fc5d1d7 100644
--- a/package.json
+++ b/package.json
@@ -47,13 +47,9 @@
"lint:js": "eslint .",
"preinstall": "node tasks/checkNodeVersion.js",
"postinstall": "npm run python",
- "python": "npm run python:start",
- "python:start": "run-script-os",
- "python:start:darwin:linux": "python2 -m pip install virtualenv && python2 -m virtualenv .python && npm run python:end",
- "python::start:win32": "virtualenv .python && npm run python:end",
- "python:end": "run-script-os",
- "python:end:darwin:linux": "PATH=.python/bin:${PATH} pip install -r requirements.txt",
- "python:end:win32": "bash -c 'PATH=.python/Scripts:${PATH} pip install -r requirements.txt'",
+ "python": "run-script-os",
+ "python:darwin:linux": "bash -c 'tasks/pythonInstall.sh linux' ",
+ "python:win32": "bash -c 'tasks/pythonInstall.sh'",
"report": "node e2e/create-report.js",
"start": "node ./tasks/start.js",
"test": "npm run lint && run-p test:server test:run",
diff --git a/tasks/pythonInstall.sh b/tasks/pythonInstall.sh
new file mode 100755
index 000000000..e68353e4b
--- /dev/null
+++ b/tasks/pythonInstall.sh
@@ -0,0 +1,22 @@
+#!/bin/bash
+# Install python dependencies
+if [ $1 = "linux" ]; then
+ # If is a linux machine try to run python2
+ if command -v python2 &>/dev/null; then
+ echo "Installing virtualenv with python2"
+ python2 -m pip install virtualenv
+ python2 -m virtualenv .python
+ else
+ echo "Installing virtualenv with python"
+ python -m pip install virtualenv
+ python -m virtualenv .python
+ fi
+ PATH=.python/bin:${PATH} pip install -r requirements.txt
+else
+ # If is a window machine use virtualenv
+ virtualenv .python
+ PATH=.python/Scripts:${PATH} pip install -r requirements.txt
+fi
+
+
+