Skip to content

Commit

Permalink
fix python version dependency on bundle script
Browse files Browse the repository at this point in the history
  • Loading branch information
ankitkumarr authored and ahmelsayed committed Jan 22, 2019
1 parent 64ab331 commit 37c174f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/Azure.Functions.Cli/Common/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public static class ArmConstants

public static class DockerImages
{
public const string LinuxPythonImageAmd64 = "mcr.microsoft.com/azure-functions/python:2.0";
public const string LinuxPythonImageAmd64 = "mcr.microsoft.com/azure-functions/python:2.0.12275";
}

public static class StaticResourcesNames
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
from PyInstaller.__main__ import run
import os
import sys

from PyInstaller.__main__ import run
from distutils.sysconfig import get_python_lib


# Gets the list of all the possible modules from a directory
def get_possible_modules(location, parent = ''):
Expand Down Expand Up @@ -39,10 +41,10 @@ def is_python_file(a_file):
return a_file.endswith('.so') or a_file.endswith('.py') or a_file.endswith('.pyd') or a_file.endswith('.pyo') or a_file.endswith('.pyc')

def __main__():
if len(sys.argv) < 3:
print("Need more arguments: Usage: python_build_template.py [starter_script] [python_packages_path]")
if len(sys.argv) < 2:
print("Need more arguments: Usage: python_build_template.py [starter_script]")
return
packages_location = sys.argv[2]
packages_location = get_python_lib()
all_modules = get_possible_modules(packages_location)
entry_file = sys.argv[1]
# Creates a list of hidden imports arguments for pyinstaller in the format - "--hidden-import=<module>"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ python -m venv --copies worker_venv
worker_venv/bin/pip install -r requirements.txt

# Bundle using pyinstaller
pip install pyinstaller==3.4
worker_venv/bin/pip install pyinstaller==3.4

pyinstaller_success=false

# If pyinstaller succeeds, we deactivate and remove the venv
if python /python_bundle_script.py /azure-functions-host/workers/python/worker.py ./worker_venv/lib/python3.6/site-packages; then
if worker_venv/bin/python /python_bundle_script.py /azure-functions-host/workers/python/worker.py; then
pyinstaller_success=true
else
if [ -d ./worker-bundle ]; then
Expand Down

0 comments on commit 37c174f

Please sign in to comment.