From 60fcde933cf8f10d795d12484f6532bfd2783965 Mon Sep 17 00:00:00 2001 From: Amith Kadli Basavaraj Date: Tue, 30 Jul 2019 15:39:26 +0530 Subject: [PATCH 01/11] adding python --- bin/compile | 11 +++++++++++ bin/python_with_pip.sh | 20 ++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 bin/python_with_pip.sh diff --git a/bin/compile b/bin/compile index be7589efc4..e19285cbd3 100755 --- a/bin/compile +++ b/bin/compile @@ -21,7 +21,18 @@ $stderr.sync = true $LOAD_PATH.unshift File.expand_path('../lib', __dir__) require 'java_buildpack/buildpack' +require 'open3' app_dir = ARGV[0] +stdout, stderr, status = Open3.capture3("sh python_with_pip.sh #{app_dir}") +# script = `sh python_with_pip.sh #{app_dir} ` +print("\n******************************stdout***************************") +p stdout +print("\n******************************stderr***************************") +p stderr +print("\n******************************status***************************") +p status + + JavaBuildpack::Buildpack.with_buildpack(app_dir, 'Compile failed with exception %s', &:compile) diff --git a/bin/python_with_pip.sh b/bin/python_with_pip.sh new file mode 100644 index 0000000000..b3416504ba --- /dev/null +++ b/bin/python_with_pip.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash +mkdir -p "$1" +build=$(cd "$1/" && pwd) +cd $build +wget https://www.python.org/ftp/python/3.4.5/Python-3.4.5.tgz +tar zxfv Python-3.4.5.tgz +find ~/filename/python -type d | xargs chmod 0755 +cd Python-3.4.5/ +./configure --prefix=$HOME/filename/python +make +make install +export PATH=$HOME/filename/python/Python-3.4.5/:$PATH + +wget https://bootstrap.pypa.io/get-pip.py +python get-pip.py --user +export PATH=$HOME/.local/bin/:$PATH +python -V +mkdir -p $build/.profile.d +echo 'export PATH=$PATH:$HOME/filename/python/Python-3.4.5:$HOME/.local/bin' > $build/.profile.d/python.sh + From e898982c61bedaffd840187e5a9bfa5f300e8259 Mon Sep 17 00:00:00 2001 From: Amith Kadli Basavaraj Date: Tue, 30 Jul 2019 16:09:03 +0530 Subject: [PATCH 02/11] adding puts to finalize --- bin/compile | 14 +++++++------- bin/finalize | 10 ++++++++++ 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/bin/compile b/bin/compile index e19285cbd3..1bf6a53faa 100755 --- a/bin/compile +++ b/bin/compile @@ -25,14 +25,14 @@ require 'open3' app_dir = ARGV[0] +print "\n******************************compile***************************" stdout, stderr, status = Open3.capture3("sh python_with_pip.sh #{app_dir}") # script = `sh python_with_pip.sh #{app_dir} ` -print("\n******************************stdout***************************") -p stdout -print("\n******************************stderr***************************") -p stderr -print("\n******************************status***************************") -p status - +print "\n******************************stdout***************************" +puts stdout +print "\n******************************stderr***************************" +puts stderr +print "\n******************************status***************************" +puts status JavaBuildpack::Buildpack.with_buildpack(app_dir, 'Compile failed with exception %s', &:compile) diff --git a/bin/finalize b/bin/finalize index 2a0330f27e..d332a29af5 100755 --- a/bin/finalize +++ b/bin/finalize @@ -21,7 +21,17 @@ $stderr.sync = true $LOAD_PATH.unshift File.expand_path('../lib', __dir__) require 'java_buildpack/buildpack' +require 'open3' app_dir = ARGV[0] +print "\n******************************finalize***************************" +stdout, stderr, status = Open3.capture3("sh python_with_pip.sh #{app_dir}") +# script = `sh python_with_pip.sh #{app_dir} ` +print "\n******************************stdout***************************" +puts stdout +print "\n******************************stderr***************************" +puts stderr +print "\n******************************status***************************" +puts status JavaBuildpack::Buildpack.with_buildpack(app_dir, 'Finalize failed with exception %s', &:compile) From de77eccb4d863558a70bf994841fa865026776d9 Mon Sep 17 00:00:00 2001 From: Amith Kadli Basavaraj Date: Tue, 30 Jul 2019 16:22:47 +0530 Subject: [PATCH 03/11] correcting file path --- bin/compile | 4 +++- bin/finalize | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/bin/compile b/bin/compile index 1bf6a53faa..43fb710854 100755 --- a/bin/compile +++ b/bin/compile @@ -26,7 +26,9 @@ require 'open3' app_dir = ARGV[0] print "\n******************************compile***************************" -stdout, stderr, status = Open3.capture3("sh python_with_pip.sh #{app_dir}") +scriptPath = File.join(File.dirname(__FILE__), 'python_with_pip.sh') +print scriptPath +stdout, stderr, status = Open3.capture3("sh #{scriptPath} #{app_dir}") # script = `sh python_with_pip.sh #{app_dir} ` print "\n******************************stdout***************************" puts stdout diff --git a/bin/finalize b/bin/finalize index d332a29af5..e5c3920ed8 100755 --- a/bin/finalize +++ b/bin/finalize @@ -26,8 +26,9 @@ require 'open3' app_dir = ARGV[0] print "\n******************************finalize***************************" -stdout, stderr, status = Open3.capture3("sh python_with_pip.sh #{app_dir}") -# script = `sh python_with_pip.sh #{app_dir} ` +scriptPath = File.join(File.dirname(__FILE__), 'python_with_pip.sh') +print scriptPath +stdout, stderr, status = Open3.capture3("sh #{scriptPath} #{app_dir}") print "\n******************************stdout***************************" puts stdout print "\n******************************stderr***************************" From c7fb2c829234b2905933b286feed5718e918919a Mon Sep 17 00:00:00 2001 From: Amith Kadli Basavaraj Date: Tue, 30 Jul 2019 17:35:54 +0530 Subject: [PATCH 04/11] modification to script path --- bin/compile | 4 +++- bin/finalize | 3 ++- bin/python_with_pip.sh | 16 +++++++++------- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/bin/compile b/bin/compile index 43fb710854..bab65351d8 100755 --- a/bin/compile +++ b/bin/compile @@ -25,6 +25,8 @@ require 'open3' app_dir = ARGV[0] +JavaBuildpack::Buildpack.with_buildpack(app_dir, 'Compile failed with exception %s', &:compile) + print "\n******************************compile***************************" scriptPath = File.join(File.dirname(__FILE__), 'python_with_pip.sh') print scriptPath @@ -37,4 +39,4 @@ puts stderr print "\n******************************status***************************" puts status -JavaBuildpack::Buildpack.with_buildpack(app_dir, 'Compile failed with exception %s', &:compile) + diff --git a/bin/finalize b/bin/finalize index e5c3920ed8..f6382ca128 100755 --- a/bin/finalize +++ b/bin/finalize @@ -24,6 +24,7 @@ require 'java_buildpack/buildpack' require 'open3' app_dir = ARGV[0] +JavaBuildpack::Buildpack.with_buildpack(app_dir, 'Finalize failed with exception %s', &:compile) print "\n******************************finalize***************************" scriptPath = File.join(File.dirname(__FILE__), 'python_with_pip.sh') @@ -35,4 +36,4 @@ print "\n******************************stderr***************************" puts stderr print "\n******************************status***************************" puts status -JavaBuildpack::Buildpack.with_buildpack(app_dir, 'Finalize failed with exception %s', &:compile) + diff --git a/bin/python_with_pip.sh b/bin/python_with_pip.sh index b3416504ba..29d4cd064d 100644 --- a/bin/python_with_pip.sh +++ b/bin/python_with_pip.sh @@ -4,17 +4,19 @@ build=$(cd "$1/" && pwd) cd $build wget https://www.python.org/ftp/python/3.4.5/Python-3.4.5.tgz tar zxfv Python-3.4.5.tgz -find ~/filename/python -type d | xargs chmod 0755 +find $build/Python-3.4.5/Python -type d | xargs chmod 0755 cd Python-3.4.5/ -./configure --prefix=$HOME/filename/python +./configure --prefix=$build/Python-3.4.5/python make make install -export PATH=$HOME/filename/python/Python-3.4.5/:$PATH - +export PATH=$build/Python-3.4.5/:$PATH +echo '****Installing pip*******' wget https://bootstrap.pypa.io/get-pip.py python get-pip.py --user export PATH=$HOME/.local/bin/:$PATH -python -V mkdir -p $build/.profile.d -echo 'export PATH=$PATH:$HOME/filename/python/Python-3.4.5:$HOME/.local/bin' > $build/.profile.d/python.sh - +echo 'export PATH=$build/Python-3.4.5/:$HOME/.local/bin/:$PATH' > $build/.profile.d/python.sh +echo 'Testing python' +python -V +pip -V +ls -ltr From 83d06a745867def0437f0c923e49b98580a7dad1 Mon Sep 17 00:00:00 2001 From: Amith Kadli Basavaraj Date: Tue, 30 Jul 2019 17:55:17 +0530 Subject: [PATCH 05/11] ls on build directory --- bin/python_with_pip.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/python_with_pip.sh b/bin/python_with_pip.sh index 29d4cd064d..3488e667a7 100644 --- a/bin/python_with_pip.sh +++ b/bin/python_with_pip.sh @@ -19,4 +19,4 @@ echo 'export PATH=$build/Python-3.4.5/:$HOME/.local/bin/:$PATH' > $build/.profil echo 'Testing python' python -V pip -V -ls -ltr +ls -ltr $build From 5d307e22ae8462f8105092960d6da9d3712c1fc4 Mon Sep 17 00:00:00 2001 From: Amith Kadli Basavaraj Date: Tue, 30 Jul 2019 18:41:53 +0530 Subject: [PATCH 06/11] run pip install --- bin/python_with_pip.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/python_with_pip.sh b/bin/python_with_pip.sh index 3488e667a7..7e0ec55560 100644 --- a/bin/python_with_pip.sh +++ b/bin/python_with_pip.sh @@ -20,3 +20,4 @@ echo 'Testing python' python -V pip -V ls -ltr $build +$build/Python-3.4.5/python/bin/pip3 install -r $build/requirement.txt \ No newline at end of file From ce41d41b4576f16529827e899c3ae80f6dd3dd8d Mon Sep 17 00:00:00 2001 From: Amith Kadli Basavaraj Date: Tue, 30 Jul 2019 18:49:04 +0530 Subject: [PATCH 07/11] change python file --- bin/python_with_pip.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/python_with_pip.sh b/bin/python_with_pip.sh index 7e0ec55560..036b48c8d0 100644 --- a/bin/python_with_pip.sh +++ b/bin/python_with_pip.sh @@ -6,7 +6,7 @@ wget https://www.python.org/ftp/python/3.4.5/Python-3.4.5.tgz tar zxfv Python-3.4.5.tgz find $build/Python-3.4.5/Python -type d | xargs chmod 0755 cd Python-3.4.5/ -./configure --prefix=$build/Python-3.4.5/python +./configure --prefix=$build/python make make install export PATH=$build/Python-3.4.5/:$PATH @@ -20,4 +20,4 @@ echo 'Testing python' python -V pip -V ls -ltr $build -$build/Python-3.4.5/python/bin/pip3 install -r $build/requirement.txt \ No newline at end of file +$build/python/bin/pip3 install -r $build/requirement.txt \ No newline at end of file From bbda58ee0a367afe5b5417e20f65dc127d57a934 Mon Sep 17 00:00:00 2001 From: Amith Kadli Basavaraj Date: Tue, 30 Jul 2019 20:39:13 +0530 Subject: [PATCH 08/11] update to new version of python --- bin/python_with_pip.sh | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/bin/python_with_pip.sh b/bin/python_with_pip.sh index 036b48c8d0..97834ac683 100644 --- a/bin/python_with_pip.sh +++ b/bin/python_with_pip.sh @@ -1,23 +1,23 @@ #!/usr/bin/env bash mkdir -p "$1" -build=$(cd "$1/" && pwd) -cd $build -wget https://www.python.org/ftp/python/3.4.5/Python-3.4.5.tgz -tar zxfv Python-3.4.5.tgz -find $build/Python-3.4.5/Python -type d | xargs chmod 0755 -cd Python-3.4.5/ -./configure --prefix=$build/python +build=$(cd "$1" && pwd) +mkdir -p $build/python-all +cd $build/python-all +wget https://www.python.org/ftp/python/3.6.9/Python-3.6.9.tgz +tar zxfv Python-3.6.9.tgz +find ./Python-3.6.9/Python -type d | xargs chmod 0755 +cd Python-3.6.9 +./configure --prefix $build/python-all/new_python make make install -export PATH=$build/Python-3.4.5/:$PATH +export PATH=$build/python-all/Python-3.6.9:$PATH +Python -V echo '****Installing pip*******' wget https://bootstrap.pypa.io/get-pip.py -python get-pip.py --user +$build/python-all/Python-3.6.9/python get-pip.py --user export PATH=$HOME/.local/bin/:$PATH -mkdir -p $build/.profile.d -echo 'export PATH=$build/Python-3.4.5/:$HOME/.local/bin/:$PATH' > $build/.profile.d/python.sh echo 'Testing python' python -V pip -V ls -ltr $build -$build/python/bin/pip3 install -r $build/requirement.txt \ No newline at end of file +$build/python-all/new_python/bin/pip3 install -r $build/requirements.txt \ No newline at end of file From f53414bc793ed5c93764b2e79fb52b0ae6ac144a Mon Sep 17 00:00:00 2001 From: Amith Kadli Basavaraj Date: Tue, 30 Jul 2019 23:35:21 +0530 Subject: [PATCH 09/11] update shell script to run pip install --- bin/python_with_pip.sh | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/bin/python_with_pip.sh b/bin/python_with_pip.sh index 97834ac683..1a7a9fbe05 100644 --- a/bin/python_with_pip.sh +++ b/bin/python_with_pip.sh @@ -12,12 +12,16 @@ make make install export PATH=$build/python-all/Python-3.6.9:$PATH Python -V -echo '****Installing pip*******' -wget https://bootstrap.pypa.io/get-pip.py -$build/python-all/Python-3.6.9/python get-pip.py --user -export PATH=$HOME/.local/bin/:$PATH -echo 'Testing python' -python -V -pip -V +#wget https://bootstrap.pypa.io/get-pip.py +#python get-pip.py --user +#export PATH=$HOME/.local/bin/:$PATH ls -ltr $build -$build/python-all/new_python/bin/pip3 install -r $build/requirements.txt \ No newline at end of file +mkdir -p $build_dir/.profile.d +echo 'export PATH=/app/python-all/Python-3.6.9:/app/usr/local/bin:$PATH' > $build_dir/.profile.d/python.sh +echo 'wget https://bootstrap.pypa.io/get-pip.py' >> $build_dir/.profile.d/python.sh +echo 'python /app/python-all/Python-3.6.9/get-pip.py --user' >> $build_dir/.profile.d/python.sh +echo 'export PATH=$HOME/.local/bin/:$PATH' >> $build_dir/.profile.d/python.sh +echo 'mkdir -p /tmp/app/python-all/new_python/bin && ln -s /app/python-all/new_python/bin/python3.6 /tmp/app/python-all/new_python/bin/python3.6' >> $build_dir/.profile.d/python.sh +echo 'export PYTHONPATH="${PYTHONPATH}:/app/python-all/new_python/lib/python3.6/site-packages"' >> $build_dir/.profile.d/python.sh +echo 'pip install -r /app/requirements.txt' >> $build_dir/.profile.d/python.sh + From f6472d42fe0ced92ed2c467093f1cb4e776d06a3 Mon Sep 17 00:00:00 2001 From: Amith Kadli Basavaraj Date: Tue, 30 Jul 2019 23:49:41 +0530 Subject: [PATCH 10/11] correcting the build directory --- bin/python_with_pip.sh | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/bin/python_with_pip.sh b/bin/python_with_pip.sh index 1a7a9fbe05..55575c6e10 100644 --- a/bin/python_with_pip.sh +++ b/bin/python_with_pip.sh @@ -12,16 +12,15 @@ make make install export PATH=$build/python-all/Python-3.6.9:$PATH Python -V -#wget https://bootstrap.pypa.io/get-pip.py +wget https://bootstrap.pypa.io/get-pip.py #python get-pip.py --user #export PATH=$HOME/.local/bin/:$PATH ls -ltr $build -mkdir -p $build_dir/.profile.d -echo 'export PATH=/app/python-all/Python-3.6.9:/app/usr/local/bin:$PATH' > $build_dir/.profile.d/python.sh -echo 'wget https://bootstrap.pypa.io/get-pip.py' >> $build_dir/.profile.d/python.sh -echo 'python /app/python-all/Python-3.6.9/get-pip.py --user' >> $build_dir/.profile.d/python.sh -echo 'export PATH=$HOME/.local/bin/:$PATH' >> $build_dir/.profile.d/python.sh -echo 'mkdir -p /tmp/app/python-all/new_python/bin && ln -s /app/python-all/new_python/bin/python3.6 /tmp/app/python-all/new_python/bin/python3.6' >> $build_dir/.profile.d/python.sh -echo 'export PYTHONPATH="${PYTHONPATH}:/app/python-all/new_python/lib/python3.6/site-packages"' >> $build_dir/.profile.d/python.sh -echo 'pip install -r /app/requirements.txt' >> $build_dir/.profile.d/python.sh +mkdir -p $build/.profile.d +echo 'export PATH=/app/python-all/Python-3.6.9:/app/usr/local/bin:$PATH' > $build/.profile.d/python.sh +echo 'python /app/python-all/Python-3.6.9/get-pip.py --user' >> $build/.profile.d/python.sh +echo 'export PATH=$HOME/.local/bin/:$PATH' >> $build/.profile.d/python.sh +echo 'mkdir -p /tmp/app/python-all/new_python/bin && ln -s /app/python-all/new_python/bin/python3.6 /tmp/app/python-all/new_python/bin/python3.6' >> $build/.profile.d/python.sh +echo 'export PYTHONPATH="${PYTHONPATH}:/app/python-all/new_python/lib/python3.6/site-packages"' >> $build/.profile.d/python.sh +echo 'pip install -r /app/requirements.txt' >> $build/.profile.d/python.sh From 3c8a2490f82570bf5147c0a587c83bdc65c1c68f Mon Sep 17 00:00:00 2001 From: Amith Kadli Basavaraj Date: Wed, 31 Jul 2019 02:07:13 +0530 Subject: [PATCH 11/11] update pip install in compilation --- bin/python_with_pip.sh | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/bin/python_with_pip.sh b/bin/python_with_pip.sh index 55575c6e10..8ab584a8aa 100644 --- a/bin/python_with_pip.sh +++ b/bin/python_with_pip.sh @@ -13,14 +13,15 @@ make install export PATH=$build/python-all/Python-3.6.9:$PATH Python -V wget https://bootstrap.pypa.io/get-pip.py -#python get-pip.py --user -#export PATH=$HOME/.local/bin/:$PATH +python get-pip.py --user +export PATH=$HOME/.local/bin/:$PATH +pip install -r $build/requirements.txt ls -ltr $build mkdir -p $build/.profile.d echo 'export PATH=/app/python-all/Python-3.6.9:/app/usr/local/bin:$PATH' > $build/.profile.d/python.sh -echo 'python /app/python-all/Python-3.6.9/get-pip.py --user' >> $build/.profile.d/python.sh -echo 'export PATH=$HOME/.local/bin/:$PATH' >> $build/.profile.d/python.sh -echo 'mkdir -p /tmp/app/python-all/new_python/bin && ln -s /app/python-all/new_python/bin/python3.6 /tmp/app/python-all/new_python/bin/python3.6' >> $build/.profile.d/python.sh +#echo 'python /app/python-all/Python-3.6.9/get-pip.py --user' >> $build/.profile.d/python.sh +#echo 'export PATH=$HOME/.local/bin/:$PATH' >> $build/.profile.d/python.sh +#echo 'mkdir -p /tmp/app/python-all/new_python/bin && ln -s /app/python-all/new_python/bin/python3.6 /tmp/app/python-all/new_python/bin/python3.6' >> $build/.profile.d/python.sh echo 'export PYTHONPATH="${PYTHONPATH}:/app/python-all/new_python/lib/python3.6/site-packages"' >> $build/.profile.d/python.sh -echo 'pip install -r /app/requirements.txt' >> $build/.profile.d/python.sh +#echo 'pip install -r /app/requirements.txt' >> $build/.profile.d/python.sh