Skip to content

Commit

Permalink
add architecture to script
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitry-shibanov committed May 16, 2023
1 parent 256e6dd commit 404de1a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
1 change: 1 addition & 0 deletions builders/macos-python-builder.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ class macOSPythonBuilder : NixPythonBuilder {
$variablesToReplace = @{
"{{__VERSION_FULL__}}" = $this.Version;
"{{__PKG_NAME__}}" = $this.GetPkgName();
"{__ARCHITECTURE__}" = $this.Architecture;
}

$variablesToReplace.keys | ForEach-Object { $installationTemplateContent = $installationTemplateContent.Replace($_, $variablesToReplace[$_]) }
Expand Down
13 changes: 7 additions & 6 deletions installers/macos-pkg-setup-template.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ set -e

PYTHON_FULL_VERSION="{{__VERSION_FULL__}}"
PYTHON_PKG_NAME="{{__PKG_NAME__}}"
$ARCHITECTURE = "{{__ARCHITECTURE__}}"
MAJOR_VERSION=$(echo $PYTHON_FULL_VERSION | cut -d '.' -f 1)
MINOR_VERSION=$(echo $PYTHON_FULL_VERSION | cut -d '.' -f 2)

Expand All @@ -18,7 +19,7 @@ fi

PYTHON_TOOLCACHE_PATH=$TOOLCACHE_ROOT/Python
PYTHON_TOOLCACHE_VERSION_PATH=$PYTHON_TOOLCACHE_PATH/$PYTHON_FULL_VERSION
PYTHON_TOOLCACHE_VERSION_ARCH_PATH=$PYTHON_TOOLCACHE_VERSION_PATH/x64
PYTHON_TOOLCACHE_VERSION_ARCH_PATH=$PYTHON_TOOLCACHE_VERSION_PATH/$ARCHITECTURE
PYTHON_FRAMEWORK_PATH="/Library/Frameworks/Python.framework/Versions/${MAJOR_VERSION}.${MINOR_VERSION}"
PYTHON_APPLICATION_PATH="/Applications/Python ${MAJOR_VERSION}.${MINOR_VERSION}"

Expand All @@ -29,10 +30,10 @@ if [ ! -d $PYTHON_TOOLCACHE_PATH ]; then
else
# remove ALL other directories for same major.minor python versions
find $PYTHON_TOOLCACHE_PATH -name "${MAJOR_VERSION}.${MINOR_VERSION}.*"|while read python_version;do
python_version_x64="$python_version/x64"
if [ -e "$python_version_x64" ];then
echo "Deleting Python $python_version_x64"
rm -rf "$python_version_x64"
python_version_arch="$python_version/$ARCHITECTURE"
if [ -e "$python_version_arch" ];then
echo "Deleting Python $python_version_arch"
rm -rf "$python_version_arch"
fi
done
fi
Expand Down Expand Up @@ -75,4 +76,4 @@ echo "Install OpenSSL certificates"
sh -e "${PYTHON_APPLICATION_PATH}/Install Certificates.command"

echo "Create complete file"
touch $PYTHON_TOOLCACHE_VERSION_PATH/x64.complete
touch $PYTHON_TOOLCACHE_VERSION_PATH/$ARCHITECTURE.complete

0 comments on commit 404de1a

Please sign in to comment.