From 2753b0de8c59241022112acf7ba48684e75fe553 Mon Sep 17 00:00:00 2001 From: Lucas <12496191+lucashuy@users.noreply.github.com> Date: Mon, 17 Jul 2023 14:41:17 -0700 Subject: [PATCH 1/5] Pin cython to a version less than 3.0.0 --- installer/pyinstaller/build-linux.sh | 8 ++++++++ installer/pyinstaller/build-mac.sh | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/installer/pyinstaller/build-linux.sh b/installer/pyinstaller/build-linux.sh index 2b728866da..74e5554e9b 100755 --- a/installer/pyinstaller/build-linux.sh +++ b/installer/pyinstaller/build-linux.sh @@ -73,11 +73,19 @@ make install ldconfig cd .. +# https://github.com/yaml/pyyaml/issues/724 +echo "Force cython package version to be lower than 3.x.x" +pip install cython<3.0.0 + echo "Installing Python Libraries" python3 -m venv venv ./venv/bin/pip install --upgrade pip ./venv/bin/pip install -r src/requirements/reproducible-linux.txt +# https://github.com/yaml/pyyaml/issues/724 +echo "Uninstall local cython package" +./venv/bin/pip uninstall cython --yes + echo "Copying All Python Libraries" cp -r ./venv/lib/python*/site-packages/* ./output/python-libraries diff --git a/installer/pyinstaller/build-mac.sh b/installer/pyinstaller/build-mac.sh index 7a69a6b0a4..baa08e072c 100644 --- a/installer/pyinstaller/build-mac.sh +++ b/installer/pyinstaller/build-mac.sh @@ -74,6 +74,10 @@ cp -r ./src/* ./output/aws-sam-cli-src echo "Removing CI Scripts" rm -vf ./output/aws-sam-cli-src/appveyor*.yml +# https://github.com/yaml/pyyaml/issues/724 +echo "Force cython package version to be lower than 3.x.x" +pip install cython<3.0.0 + echo "Installing Python" curl "https://www.python.org/ftp/python/${python_version}/Python-${python_version}.tgz" --output python.tgz tar -xzf python.tgz @@ -88,6 +92,10 @@ echo "Installing Python Libraries" ./venv/bin/pip install --upgrade pip ./venv/bin/pip install -r src/requirements/reproducible-mac.txt +# https://github.com/yaml/pyyaml/issues/724 +echo "Uninstall local cython package" +./venv/bin/pip uninstall cython --yes + echo "Copying All Python Libraries" cp -r ./venv/lib/python*/site-packages/* ./output/python-libraries From 203b45b5d8d7bb7d9e70722a20aed1cc4b5db5f0 Mon Sep 17 00:00:00 2001 From: Lucas <12496191+lucashuy@users.noreply.github.com> Date: Mon, 17 Jul 2023 15:00:22 -0700 Subject: [PATCH 2/5] Moved install location to be inside of virtual env --- installer/pyinstaller/build-linux.sh | 9 +++++---- installer/pyinstaller/build-mac.sh | 9 +++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/installer/pyinstaller/build-linux.sh b/installer/pyinstaller/build-linux.sh index 74e5554e9b..303b213bd3 100755 --- a/installer/pyinstaller/build-linux.sh +++ b/installer/pyinstaller/build-linux.sh @@ -73,13 +73,14 @@ make install ldconfig cd .. -# https://github.com/yaml/pyyaml/issues/724 -echo "Force cython package version to be lower than 3.x.x" -pip install cython<3.0.0 - echo "Installing Python Libraries" python3 -m venv venv ./venv/bin/pip install --upgrade pip + +# https://github.com/yaml/pyyaml/issues/724 +echo "Force cython package version to be lower than 3.x.x" +./venv/bin/pip install --no-build-isolation "cython<3.0.0" + ./venv/bin/pip install -r src/requirements/reproducible-linux.txt # https://github.com/yaml/pyyaml/issues/724 diff --git a/installer/pyinstaller/build-mac.sh b/installer/pyinstaller/build-mac.sh index baa08e072c..4afd34b9ad 100644 --- a/installer/pyinstaller/build-mac.sh +++ b/installer/pyinstaller/build-mac.sh @@ -74,10 +74,6 @@ cp -r ./src/* ./output/aws-sam-cli-src echo "Removing CI Scripts" rm -vf ./output/aws-sam-cli-src/appveyor*.yml -# https://github.com/yaml/pyyaml/issues/724 -echo "Force cython package version to be lower than 3.x.x" -pip install cython<3.0.0 - echo "Installing Python" curl "https://www.python.org/ftp/python/${python_version}/Python-${python_version}.tgz" --output python.tgz tar -xzf python.tgz @@ -90,6 +86,11 @@ cd .. echo "Installing Python Libraries" /usr/local/bin/python3.8 -m venv venv ./venv/bin/pip install --upgrade pip + +# https://github.com/yaml/pyyaml/issues/724 +echo "Force cython package version to be lower than 3.x.x" +./venv/bin/pip install --no-build-isolation "cython<3.0.0" + ./venv/bin/pip install -r src/requirements/reproducible-mac.txt # https://github.com/yaml/pyyaml/issues/724 From 737605fe069df6b58644ae1e7d12132256a7c7d5 Mon Sep 17 00:00:00 2001 From: Lucas <12496191+lucashuy@users.noreply.github.com> Date: Mon, 17 Jul 2023 15:19:32 -0700 Subject: [PATCH 3/5] Install cython and pyyaml together --- Makefile | 3 +++ installer/pyinstaller/build-linux.sh | 3 ++- installer/pyinstaller/build-mac.sh | 3 ++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index dd80957cae..2bf0a1b333 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,10 @@ SAM_CLI_TELEMETRY ?= 0 init: + pip install wheel + pip install "cython<3.0.0" pyyaml==5.4.1 --no-build-isolation SAM_CLI_DEV=1 pip install -e '.[dev]' + pip uninstall cython --yes test: # Run unit tests diff --git a/installer/pyinstaller/build-linux.sh b/installer/pyinstaller/build-linux.sh index 303b213bd3..968f7ce723 100755 --- a/installer/pyinstaller/build-linux.sh +++ b/installer/pyinstaller/build-linux.sh @@ -79,7 +79,8 @@ python3 -m venv venv # https://github.com/yaml/pyyaml/issues/724 echo "Force cython package version to be lower than 3.x.x" -./venv/bin/pip install --no-build-isolation "cython<3.0.0" +./venv/bin/pip install wheel +./venv/bin/pip install --no-build-isolation "cython<3.0.0" pyyaml==5.4.1 ./venv/bin/pip install -r src/requirements/reproducible-linux.txt diff --git a/installer/pyinstaller/build-mac.sh b/installer/pyinstaller/build-mac.sh index 4afd34b9ad..4c13e94182 100644 --- a/installer/pyinstaller/build-mac.sh +++ b/installer/pyinstaller/build-mac.sh @@ -89,7 +89,8 @@ echo "Installing Python Libraries" # https://github.com/yaml/pyyaml/issues/724 echo "Force cython package version to be lower than 3.x.x" -./venv/bin/pip install --no-build-isolation "cython<3.0.0" +./venv/bin/pip install wheel +./venv/bin/pip install --no-build-isolation "cython<3.0.0" pyyaml==5.4.1 ./venv/bin/pip install -r src/requirements/reproducible-mac.txt From 34c922335a6cdfe8e4a7e5c7d72181c9fe86ce35 Mon Sep 17 00:00:00 2001 From: Lucas <12496191+lucashuy@users.noreply.github.com> Date: Mon, 17 Jul 2023 15:37:55 -0700 Subject: [PATCH 4/5] Moved uninstall logic to after custom build --- Makefile | 2 +- installer/pyinstaller/build-linux.sh | 8 ++++---- installer/pyinstaller/build-mac.sh | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 2bf0a1b333..1f190db11c 100644 --- a/Makefile +++ b/Makefile @@ -5,8 +5,8 @@ SAM_CLI_TELEMETRY ?= 0 init: pip install wheel pip install "cython<3.0.0" pyyaml==5.4.1 --no-build-isolation + pip uninstall wheel cython SAM_CLI_DEV=1 pip install -e '.[dev]' - pip uninstall cython --yes test: # Run unit tests diff --git a/installer/pyinstaller/build-linux.sh b/installer/pyinstaller/build-linux.sh index 968f7ce723..0da95c0814 100755 --- a/installer/pyinstaller/build-linux.sh +++ b/installer/pyinstaller/build-linux.sh @@ -82,11 +82,11 @@ echo "Force cython package version to be lower than 3.x.x" ./venv/bin/pip install wheel ./venv/bin/pip install --no-build-isolation "cython<3.0.0" pyyaml==5.4.1 -./venv/bin/pip install -r src/requirements/reproducible-linux.txt - -# https://github.com/yaml/pyyaml/issues/724 echo "Uninstall local cython package" -./venv/bin/pip uninstall cython --yes +./venv/bin/pip uninstall wheel cython --yes +# end cython work around + +./venv/bin/pip install -r src/requirements/reproducible-linux.txt echo "Copying All Python Libraries" cp -r ./venv/lib/python*/site-packages/* ./output/python-libraries diff --git a/installer/pyinstaller/build-mac.sh b/installer/pyinstaller/build-mac.sh index 4c13e94182..0ecdfaef3e 100644 --- a/installer/pyinstaller/build-mac.sh +++ b/installer/pyinstaller/build-mac.sh @@ -92,11 +92,11 @@ echo "Force cython package version to be lower than 3.x.x" ./venv/bin/pip install wheel ./venv/bin/pip install --no-build-isolation "cython<3.0.0" pyyaml==5.4.1 -./venv/bin/pip install -r src/requirements/reproducible-mac.txt - -# https://github.com/yaml/pyyaml/issues/724 echo "Uninstall local cython package" -./venv/bin/pip uninstall cython --yes +./venv/bin/pip uninstall wheel cython --yes +# end cython work around + +./venv/bin/pip install -r src/requirements/reproducible-mac.txt echo "Copying All Python Libraries" cp -r ./venv/lib/python*/site-packages/* ./output/python-libraries From b9651601f5ed768f7008a45b5724d408b50ccf7c Mon Sep 17 00:00:00 2001 From: Lucas <12496191+lucashuy@users.noreply.github.com> Date: Mon, 17 Jul 2023 15:40:11 -0700 Subject: [PATCH 5/5] Add auto confirm to uninstall --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 1f190db11c..243d3de824 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ SAM_CLI_TELEMETRY ?= 0 init: pip install wheel pip install "cython<3.0.0" pyyaml==5.4.1 --no-build-isolation - pip uninstall wheel cython + pip uninstall wheel cython --yes SAM_CLI_DEV=1 pip install -e '.[dev]' test: