Skip to content

Commit

Permalink
Merge from aws/aws-sam-cli/develop
Browse files Browse the repository at this point in the history
  • Loading branch information
aws-sam-cli-bot authored Apr 11, 2024
2 parents 7782205 + f7bf36f commit 666b712
Show file tree
Hide file tree
Showing 25 changed files with 379 additions and 173 deletions.
61 changes: 51 additions & 10 deletions installer/pyinstaller/build-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,23 @@ python_library_zip_filename=$2
build_binary_name=$3
build_folder=$4
python_version=$5
openssl_version=$6
zlib_version=$7

if [ "$python_library_zip_filename" = "" ]; then
python_library_zip_filename="python-libraries.zip";
fi

if [ "$python_version" = "" ]; then
python_version="3.11.3";
python_version="3.11.8";
fi

if [ "$openssl_version" = "" ]; then
openssl_version="1.1.1w";
fi

if [ "$zlib_version" = "" ]; then
zlib_version="1.3.1";
fi

if [ "$CI_OVERRIDE" = "1" ]; then
Expand All @@ -28,7 +38,7 @@ fi

set -eux

yum install -y zlib-devel libffi-devel bzip2-devel
yum install -y libffi-devel

echo "Making Folders"
mkdir -p .build/src
Expand All @@ -38,17 +48,45 @@ mkdir -p .build/output/pyinstaller-output
mkdir -p .build/output/openssl
cd .build/output/openssl

curl "https://www.openssl.org/source/openssl-1.1.1w.tar.gz" --output openssl-1.1.1.tar.gz
tar xzf openssl-1.1.1.tar.gz
cd openssl-1.1.1w
./config --prefix=/opt/openssl && make && make install
cd ../../..
echo "Building OpenSSL"
curl "https://www.openssl.org/source/openssl-${openssl_version}.tar.gz" --output openssl.tar.gz
tar xzf openssl.tar.gz
cd openssl-${openssl_version}
# install_sw installs OpenSSL without manual pages
./config --prefix=/opt/openssl && make -j8 && make -j8 install_sw
cd ../../

echo "Building zlib"
curl https://www.zlib.net/zlib-${zlib_version}.tar.gz --output zlib.tar.gz
tar xvf zlib.tar.gz
cd zlib-${zlib_version}
./configure && make -j8 && make -j8 install
cd ../

echo "Building bzip2"
mkdir bzip2 && cd bzip2
git init
git remote add origin https://gitlab.com/bzip2/bzip2.git
# this is the 1.0.8 release
# https://gitlab.com/bzip2/bzip2/-/tags
# fetch specific commit as to not grab the entire git history
git fetch origin 6a8690fc8d26c815e798c588f796eabe9d684cf0
git reset --hard FETCH_HEAD
make -j8 -f Makefile-libbz2_so
cp libbz2.so.1.0.8 /usr/local/lib
ln -s /usr/local/lib/libbz2.so.1.0.8 /usr/local/lib/libbz2.so.1.0
ln -s /usr/local/lib/libbz2.so.1.0 /usr/local/lib/libbz2.so.1
make -j8 install
cd ../

# Return to `.build/` folder
cd ../

echo "Copying Source"
cp -r ../[!.]* ./src
cp -r ./src/* ./output/aws-sam-cli-src

echo "Removing CI Scripts and other files/direcories not needed"
echo "Removing CI Scripts and other files/directories not needed"
rm -vf ./output/aws-sam-cli-src/appveyor*.yml
rm -rf ./output/aws-sam-cli-src/tests
rm -rf ./output/aws-sam-cli-src/designs
Expand All @@ -68,9 +106,12 @@ echo "Installing Python"
curl "https://www.python.org/ftp/python/${python_version}/Python-${python_version}.tgz" --output python.tgz
tar -xzf python.tgz
cd Python-$python_version
./configure --enable-shared --with-openssl=/opt/openssl --with-openssl-rpath=auto
./configure \
--enable-shared \
--with-openssl=/opt/openssl \
--with-openssl-rpath=auto
make -j8
make install
make -j8 install
ldconfig
cd ..

Expand Down
7 changes: 4 additions & 3 deletions installer/pyinstaller/build-mac.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,9 @@ cd openssl-"$openssl_version"
# Openssl configure https://wiki.openssl.org/index.php/Compilation_and_Installation
./Configure --prefix=/usr/local --openssldir=/usr/local/openssl no-ssl3 no-ssl3-method no-zlib ${openssl_config_arch} enable-ec_nistp_64_gcc_128

make
sudo make install
make -j8
# install_sw installs OpenSSL without manual pages
sudo make -j8 install_sw
cd ..

# Copying aws-sam-cli source code
Expand Down Expand Up @@ -93,7 +94,7 @@ tar -xzf python.tgz
cd Python-"$python_version"
./configure --enable-shared
make -j8
sudo make install
sudo make -j8 install
cd ..

echo "Installing Python Libraries"
Expand Down
56 changes: 31 additions & 25 deletions installer/pyinstaller/samcli-mac.spec
Original file line number Diff line number Diff line change
@@ -1,29 +1,35 @@
# -*- mode: python -*-
block_cipher = None
exe_name = 'sam'
analysis = Analysis(['../../samcli/__main__.py'],
binaries=[],
datas=[],
hiddenimports=[],
hookspath=['./installer/pyinstaller'],
runtime_hooks=[],
excludes=[],
cipher=block_cipher)
analysis = Analysis(
['../../samcli/__main__.py'],
binaries=[],
datas=[],
hiddenimports=[],
hookspath=['./installer/pyinstaller'],
runtime_hooks=[],
excludes=[],
cipher=block_cipher
)
pyz = PYZ(analysis.pure, analysis.zipped_data, cipher=block_cipher)
exe = EXE(pyz,
analysis.scripts,
[],
exclude_binaries=True,
name=exe_name,
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
console=True )
coll = COLLECT(exe,
analysis.binaries,
analysis.zipfiles,
analysis.datas,
strip=False,
upx=True,
name='sam')
exe = EXE(
pyz,
analysis.scripts,
[],
exclude_binaries=True,
name=exe_name,
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
console=True
)
coll = COLLECT(
exe,
analysis.binaries,
analysis.zipfiles,
analysis.datas,
strip=False,
upx=True,
name='sam'
)
56 changes: 31 additions & 25 deletions installer/pyinstaller/samcli.spec
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,35 @@
import sys ; sys.setrecursionlimit(sys.getrecursionlimit() * 5)
block_cipher = None
exe_name = 'sam'
analysis = Analysis(['../../samcli/__main__.py'],
binaries=[('/usr/local/lib/libcrypt.so.2', '.')],
datas=[],
hiddenimports=[],
hookspath=['./installer/pyinstaller'],
runtime_hooks=[],
excludes=[],
cipher=block_cipher)
analysis = Analysis(
['../../samcli/__main__.py'],
binaries=[],
datas=[],
hiddenimports=[],
hookspath=['./installer/pyinstaller'],
runtime_hooks=[],
excludes=[],
cipher=block_cipher
)
pyz = PYZ(analysis.pure, analysis.zipped_data, cipher=block_cipher)
exe = EXE(pyz,
analysis.scripts,
[],
exclude_binaries=True,
name=exe_name,
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
console=True )
coll = COLLECT(exe,
analysis.binaries,
analysis.zipfiles,
analysis.datas,
strip=False,
upx=True,
name='sam')
exe = EXE(
pyz,
analysis.scripts,
[],
exclude_binaries=True,
name=exe_name,
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
console=True
)
coll = COLLECT(
exe,
analysis.binaries,
analysis.zipfiles,
analysis.datas,
strip=False,
upx=True,
name='sam'
)
6 changes: 3 additions & 3 deletions requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jmespath~=1.0.1
ruamel_yaml~=0.18.6
PyYAML~=6.0,>=6.0.1
cookiecutter~=2.6.0
aws-sam-translator==1.86.0
aws-sam-translator==1.87.0
#docker minor version updates can include breaking changes. Auto update micro version only.
docker~=7.0.0
dateparser~=1.2
Expand All @@ -28,7 +28,7 @@ regex!=2021.10.8
tzlocal==5.2

#Adding cfn-lint dependency for SAM validate
cfn-lint~=0.86.1
cfn-lint~=0.86.2

# Type checking boto3 objects
boto3-stubs[apigateway,cloudformation,ecr,iam,lambda,s3,schemas,secretsmanager,signer,stepfunctions,sts,xray,sqs,kinesis]==1.34.74
boto3-stubs[apigateway,cloudformation,ecr,iam,lambda,s3,schemas,secretsmanager,signer,stepfunctions,sts,xray,sqs,kinesis]==1.34.82
6 changes: 3 additions & 3 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ pytest-cov==5.0.0
# mypy adds new rules in new minor versions, which could cause our PR check to fail
# here we fix its version and upgrade it manually in the future
mypy==1.9.0
types-pywin32==306.0.0.20240331
types-pywin32==306.0.0.20240408
types-PyYAML==6.0.12.20240311
types-chevron==0.14.2.20240310
types-psutil==5.9.5.20240316
types-setuptools==69.2.0.20240317
types-Pygments==2.17.0.20240310
types-colorama==0.4.15.20240311
types-dateparser==1.1.4.20240331
types-docutils==0.20.0.20240331
types-docutils==0.20.0.20240406
types-jsonschema==4.21.0.20240331
types-pyOpenSSL==24.0.0.20240311
# as of types-requests>=2.31.0.7, this now requires `urllib3>2`, pin we are able to upgrade
Expand All @@ -34,7 +34,7 @@ pytest-rerunfailures==14.0
pytest-metadata==3.1.1
# NOTE (lucashuy): `pytest-json-report` was updated to `pytest-json-report-wip` as the original repository does not seem to be maintained anymore, if `-wip` is updated, validate the changes
pytest-json-report-wip==1.5.1
filelock==3.13.3
filelock==3.13.4

# formatter
black==24.3.0
Expand Down
2 changes: 1 addition & 1 deletion requirements/pre-dev.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ruff==0.3.4
ruff==0.3.5
Loading

0 comments on commit 666b712

Please sign in to comment.