Skip to content

Commit

Permalink
Merge pull request #2024 from RedBaron2/patch-27
Browse files Browse the repository at this point in the history
  • Loading branch information
AdmiringWorm committed Oct 25, 2022
2 parents b404f01 + ab1e682 commit 9710ee3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
2 changes: 1 addition & 1 deletion automatic/freecad/tools/chocolateyInstall.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ $packageArgs = @{
validExitCodes = @(0)
}

if ( $packageArgs.filetype -eq '7z' ) {
if (( $packageArgs.filetype -eq '7z' ) -or ( $packageArgs.filetype -eq 'zip' )) {
# Checking for Package Parameters
$pp = ( Get-UserPackageParams -scrawl )
if ($packageArgs.url64 -match "Conda") { $packageArgs.Remove("url"); $packageArgs.Remove("checksum"); $packageArgs.Remove("checksumType"); }
Expand Down
20 changes: 13 additions & 7 deletions automatic/freecad/update_helper.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

function Get-FreeCad {
param(
[string]$Title,
Expand All @@ -7,14 +6,17 @@ param(
[string]$uri = $releases,
[string]$ScriptLocation = $PSScriptRoot
)
$download_page = Invoke-WebRequest -Uri $uri -UseBasicParsing

# $download_page = Invoke-WebRequest -Uri $uri -UseBasicParsing

switch ($kind) {
'dev' {
$download_page = (Get-GitHubRelease -Owner "Freecad" -Name "Freecad-Bundle" -TagName "weekly-builds" -Verbose).assets
$mobile = "Windows"
$ext = "7z"
$re64 = "(FreeCAD_weekly-builds)?((\-\d{2,6})+)?(\-conda)?(\-${mobile})(\-|.)?(x\d{2}_\d{2}\-)?(py\d{2,5})?(\.$ext)$"
$url64 = ( $download_page.Links | ? href -match $re64 | Select-Object -First 1 -ExpandProperty 'href' )
# $url64 = ( $download_page.Links | ? href -match $re64 | Select-Object -First 1 -ExpandProperty 'href' )
$url64 = ( $download_page | ? Name -match $re64 | Select-Object -First 1 -ExpandProperty 'browser_download_url' )
"url64 -$url64-" | Write-Warning
$PackageName = "$Title"
$Title = "$Title"
Expand All @@ -27,20 +29,24 @@ param(
$vert = "${version}-${kind}"
}
'portable' {
$download_page = (Get-GitHubRelease -Owner "Freecad" -Name "Freecad" -Verbose).assets
$mobile = "portable"
$ext = "zip"
$re64 = "(FreeCAD\-)((\d+)?(\.))+?(\d)?(\-)(WIN)(\-)?(x\d{2})\-(${mobile})(\-|.)?(\d+)?(\.${ext})$"
$url64 = ( $download_page.Links | ? href -match $re64 | Sort-Object -Property 'href' -Descending | Select-Object -First 1 -ExpandProperty 'href' )
# $url64 = ( $download_page.Links | ? href -match $re64 | Sort-Object -Property 'href' -Descending | Select-Object -First 1 -ExpandProperty 'href' )
$url64 = ( $download_page | ? Name -match $re64 | Select-Object -First 1 -ExpandProperty 'browser_download_url' )
$vert = "$version"
$PackageName = "$Title.$kind"
$Title = "$Title (Portable)"
[version]$version = ( Get-Version (($url64.Split('\/'))[-1]) ).Version
}
'stable' {
$download_page = (Get-GitHubRelease -Owner "Freecad" -Name "Freecad" -Verbose).assets
$mobile = "installer"
$ext = "exe"
$re64 = "(FreeCAD\-)((\d+)?(\.))+?(\d)?(\-)(WIN)(\-)?(x\d{2})\-(${mobile})(\-|.)?(\d+)?(\.${ext})$"
$url64 = ( $download_page.Links | ? href -match $re64 | Sort-Object -Property 'href' -Descending | Select-Object -First 1 -ExpandProperty 'href' )
# $url64 = ( $download_page.Links | ? href -match $re64 | Sort-Object -Property 'href' -Descending | Select-Object -First 1 -ExpandProperty 'href' )
$url64 = ( $download_page | ? Name -match $re64 | Select-Object -First 1 -ExpandProperty 'browser_download_url' )
$vert = "$version"
$PackageName = "$Title"
$Title = "$Title"
Expand All @@ -66,11 +72,11 @@ param(
$package = @{
PackageName = ($PackageName).ToLower()
Title = $Title
URL64 = $PreUrl + $url64
URL64 = $url64
Version = $vert
fileType = ($url64.Split("/")[-1]).Split(".")[-1]
}
# Due to the dev package being pre-release software we are removing ReleaseNotes
# Due to the dev package being pre-release software we are removing ReleaseNotes
if ($kind -ne "dev") {
$package.Add( "ReleaseNotes", "https://www.freecadweb.org/wiki/Release_notes_$($version.Major).$($version.Minor)" )
}
Expand Down

0 comments on commit 9710ee3

Please sign in to comment.