Browse Source

Custom pip and python in -update scripts

Lutz Roeder 7 years ago
parent
commit
5da12437ac
7 changed files with 34 additions and 16 deletions
  1. 6 6
      tools/caffe2-update
  2. 7 4
      tools/coreml-converter
  3. 5 2
      tools/keras-update
  4. 4 1
      tools/mxnet-update
  5. 5 2
      tools/onnx-update
  6. 4 1
      tools/tf-update
  7. 3 0
      tools/update

+ 6 - 6
tools/caffe2-update

@@ -9,6 +9,9 @@ src=${root}/src
 tools=${root}/tools
 third_party=${root}/third_party
 
+python=${python:-python}
+pip=${pip:-pip}
+
 identifier=pytorch
 repository=https://github.com/pytorch/pytorch.git
 
@@ -36,18 +39,15 @@ EOS
 export PYTHONUSERBASE=${build}/third_party/pypi/${identifier}
 export PATH=$PATH:${PYTHONUSERBASE}/bin
 
-pip install --user future leveldb numpy protobuf pydot python-gflags pyyaml scikit-image setuptools six
-pip3 install --user future leveldb numpy protobuf pydot python-gflags pyyaml scikit-image setuptools six
+${pip} install --user future leveldb numpy protobuf pydot python-gflags pyyaml scikit-image setuptools six
 
 echo "Build Caffe2"
 pushd "${third_party}/pytorch" > /dev/null
 git submodule update --init
-mkdir -p build && cd build
-cmake -DUSE_CUDA=OFF ..
-sudo make install
+${python} setup_caffe2.py develop --user
 popd > /dev/null
 
 echo "Generate '../src/caffe2-metadata.json'"
 pushd ${tools} > /dev/null
-python caffe2-metadata.py
+${python} caffe2-metadata.py
 popd > /dev/null

+ 7 - 4
tools/coreml-converter

@@ -7,6 +7,9 @@ build=${root}/build
 tools=${root}/tools
 third_party=${root}/third_party
 
+python=${python:-python}
+pip=${pip:-pip}
+
 identifier=coremltools
 repository=https://github.com/apple/${identifier}.git
 
@@ -23,8 +26,8 @@ fi
 export PYTHONUSERBASE=${build}/third_party/pypi/${identifier}
 export PATH=$PATH:${PYTHONUSERBASE}/bin
 
-pip install --quiet --user onnx
-pip install --quiet --user sklearn
-pip install --quiet --user ${third_party}/${identifier}
+${pip} install --quiet --user onnx
+${pip} install --quiet --user sklearn
+${pip} install --quiet --user ${third_party}/${identifier}
 
-python ${tools}/coreml-converter.py $@
+${python} ${tools}/coreml-converter.py $@

+ 5 - 2
tools/keras-update

@@ -7,6 +7,9 @@ build=${root}/build
 tools=${root}/tools
 third_party=${root}/third_party
 
+python=${python:-python}
+pip=${pip:-pip}
+
 identifier=keras
 repository=https://github.com/keras-team/${identifier}.git
 
@@ -23,10 +26,10 @@ fi
 export PYTHONUSERBASE=${build}/third_party/pypi/${identifier}
 
 pushd ${third_party}/${identifier} > /dev/null
-pip install --user .
+${pip} install --user .
 popd > /dev/null
 
 echo "Update '../src/keras-metadata.json'"
 pushd ${tools} > /dev/null
-python keras-metadata.py
+${python} keras-metadata.py
 popd > /dev/null

+ 4 - 1
tools/mxnet-update

@@ -7,6 +7,9 @@ src=${root}/src
 tools=${root}/tools
 third_party=${root}/third_party
 
+python=${python:-python}
+pip=${pip:-pip}
+
 identifier=mxnet
 repository=https://github.com/apache/incubator-${identifier}.git
 
@@ -21,4 +24,4 @@ else
 fi
 
 # echo "Update '../src/mxnet-metadata.json'"
-# python mxnet-metadata.py
+# ${python} mxnet-metadata.py

+ 5 - 2
tools/onnx-update

@@ -9,6 +9,9 @@ src=${root}/src
 third_party=${root}/third_party
 tools=${root}/tools
 
+python=${python:-python}
+pip=${pip:-pip}
+
 identifier=onnx
 repository=https://github.com/onnx/${identifier}.git
 
@@ -29,12 +32,12 @@ export ONNX_NAMESPACE=onnx
 
 echo "Build"
 pushd "${third_party}/${identifier}" > /dev/null
-pip install --user .
+${pip} install --user .
 popd > /dev/null
 
 echo "Generate '../src/onnx-metadata.json'"
 pushd ${tools} > /dev/null
-python onnx-metadata.py
+${python} onnx-metadata.py
 popd > /dev/null
 
 echo "Generate '../src/onnx.js'"

+ 4 - 1
tools/tf-update

@@ -8,6 +8,9 @@ src=${root}/src
 tools=${root}/tools
 third_party=${root}/third_party
 
+python=${python:-python}
+pip=${pip:-pip}
+
 identifier=tensorflow
 repository=https://github.com/tensorflow/${identifier}.git
 
@@ -49,6 +52,6 @@ touch ${tools}/tensorflow/__init__.py
 touch ${tools}/tensorflow/core/__init__.py
 touch ${tools}/tensorflow/core/framework/__init__.py
 pushd ${tools} > /dev/null
-python tf-metadata.py
+${python} tf-metadata.py
 popd > /dev/null
 rm -rf ${tools}/tensorflow

+ 3 - 0
tools/update

@@ -2,6 +2,9 @@
 
 set -e
 
+# export python=python3
+# export pip=pip3
+
 tools=$(dirname ${0})
 
 ${tools}/keras-update