From 8ca09c684d6fe427214ca4d22d0b2851f37b3d28 Mon Sep 17 00:00:00 2001 From: Elias Steurer Date: Sun, 7 Aug 2022 12:24:07 +0200 Subject: [PATCH] Add automatic build uploads to kelteseth.com Add choco build and docs for pushing --- .gitignore | 1 + Tools/Scoop/ScreenPlay.json | 15 +- Tools/build.py | 18 ++- Tools/build_and_publish.py | 45 +++--- Tools/chocolatey/ScreenPlay/ReadMe.md | 146 ++---------------- Tools/chocolatey/ScreenPlay/screenplay.nuspec | 30 +--- .../ScreenPlay/tools/chocolateyinstall.ps1 | 4 +- .../ScreenPlay/tools/chocolateyuninstall.ps1 | 58 +------ Tools/install_requirements.py | 4 +- Tools/requirements.txt | 3 +- 10 files changed, 82 insertions(+), 242 deletions(-) diff --git a/.gitignore b/.gitignore index cb979a69..8d14796b 100644 --- a/.gitignore +++ b/.gitignore @@ -251,3 +251,4 @@ cython_debug/ #.idea/ /aqtinstall.log /ThirdParty/** +*.nupkg diff --git a/Tools/Scoop/ScreenPlay.json b/Tools/Scoop/ScreenPlay.json index ebcaaad1..7a1456be 100644 --- a/Tools/Scoop/ScreenPlay.json +++ b/Tools/Scoop/ScreenPlay.json @@ -1,9 +1,18 @@ { - "version": "0.15.0", + "version": "0.15.0-RC2", "description": "ScreenPlay is an Open Source Live-Wallpaper app for Windows and OSX. ", "homepage": "https://screen-play.app/", - "url": "https://kelteseth.com/screenplay/ScreenPlay-0.15.0-RC1-x64-windows-release.zip", + "url": "https://kelteseth.com/releases/$version/ScreenPlay-$version-x64-windows-release.zip", + "hash": "37e36c9e1d3e0d4e95ea40a869f3e840787b6b5bb889a798b8e1aec5252e6ee5", "bin": "ScreenPlay.exe", "license": "AGPL-3.0", - "extract_dir": "bin" + "extract_dir": "bin", + "checkver": { + "url": "https://wallpaper.software/releases/releases.txt", + "checkver": "ScreenPlay ([\\d.]+)" + }, + "autoupdate": { + "url": "https://wallpaper.software/releases/$version/ScreenPlay-$version-x64-windows-release.zip", + "extract_dir": "bin" + } } \ No newline at end of file diff --git a/Tools/build.py b/Tools/build.py index e4dccfef..b626ac29 100755 --- a/Tools/build.py +++ b/Tools/build.py @@ -6,8 +6,8 @@ import platform import shutil import argparse import time -from typing import Tuple import zipfile +from typing import Tuple from shutil import copytree from pathlib import Path from datetime import datetime @@ -138,8 +138,9 @@ def execute( if platform.system() == "Darwin" and build_config.sign_build: sign(build_config) - # Create a zip file for scoop - build_result = zip(build_config, build_result) + # Create a zip file for scoop & chocolatey + if platform.system() == "Windows": + build_result = zip(build_config, build_result) print("Time taken: {}s".format(time.time() - start_time)) @@ -421,26 +422,27 @@ def sign(build_config: BuildConfig): def zip(build_config: BuildConfig, build_result: BuildResult) -> BuildResult: zipName = f"ScreenPlay-{build_config.screenplay_version}-{build_config.cmake_target_triplet}-{build_config.build_type}.zip" - build_result.build_zip = Path(build_config.bin_dir).joinpath(zipName) - print(f"Creating scoop zip file") + build_result.build_zip = Path(build_result.build).joinpath(zipName) + print(f"Creating bin folder zip file: {build_result.build_zip}") os.chdir(build_config.build_folder) with zipfile.ZipFile(zipName, 'w', zipfile.ZIP_DEFLATED) as zipf: zipdir(build_config.bin_dir, zipf) - # Create sha256 hash from zip file zip_file_path = os.path.join(build_result.build, zipName) build_hash = sha256(zip_file_path) build_result.build_hash = Path( build_result.build).joinpath(zipName + ".sha256.txt") + print(f"Create sha256 hash: {build_result.build_hash}") f = open(build_result.build_hash, "a") f.write(build_hash) f.close() # Some weird company firewalls do not allow direct .exe downloads # lets just zip the installer lol - installer_zip = build_result.installer.stem + ".zip" build_result.installer_zip = Path(build_result.build).joinpath(build_result.installer.stem + ".zip") - zipfile.ZipFile(installer_zip, mode='w').write(build_result.installer) + print(f"Create zip from installer: {build_result.installer_zip}") + zipfile.ZipFile(build_result.installer_zip, 'w').write(build_result.installer, build_result.build) + return build_result diff --git a/Tools/build_and_publish.py b/Tools/build_and_publish.py index e1216511..b309b9bc 100644 --- a/Tools/build_and_publish.py +++ b/Tools/build_and_publish.py @@ -5,13 +5,13 @@ import build from pathlib import Path from macos_lipo import run_lipo, check_fat_binary import platform -import ftplib - +import paramiko if __name__ == "__main__": parser = argparse.ArgumentParser(description='Build and Package ScreenPlay') - parser.add_argument('-steam_password', action="store", dest="steam_password", required=True, help="Steam password") - parser.add_argument('-hosting_password', action="store", dest="hosting_password", required=True, help="FTPS password") + parser.add_argument('-steam_password', '-sp', action="store", dest="steam_password", required=True, help="Steam password") + parser.add_argument('-hosting_username','-hu', action="store", dest="hosting_username", required=True, help="ssh username") + parser.add_argument('-hosting_password', '-hp', action="store", dest="hosting_password", required=True, help="ssh password") args = parser.parse_args() # Script needs to run in the tools folder @@ -23,7 +23,7 @@ if __name__ == "__main__": build_result = build.BuildResult() build_config = build.BuildConfig() - build_config.screenplay_version = "0.15.0-RC1" + build_config.screenplay_version = "0.15.0-RC2" build_config.qt_version = "6.3.1" build_config.qt_ifw_version = "4.4" build_config.build_steam = "ON" @@ -51,21 +51,28 @@ if __name__ == "__main__": run_lipo() check_fat_binary() else: - build_config.build_architecture = "x64" build_result = build.execute(build_config) + ssh = paramiko.SSHClient() + ssh.load_host_keys(os.path.expanduser(os.path.join("~", ".ssh", "known_hosts"))) + ssh.connect('kelteseth.com', username=args.hosting_username, password=args.hosting_password) + sftp = ssh.open_sftp() + release_folder = "/kelteseth_com/public/releases/" + build_config.screenplay_version + "/" + sftp.mkdir(release_folder) + print("Uploading files...") + + sftp.put(build_result.build_zip, release_folder + str(build_result.build_zip.name)) + sftp.put(build_result.installer, release_folder + str(build_result.installer.name)) + sftp.put(build_result.installer_zip,release_folder + str(build_result.installer_zip.name)) + sftp.put(build_result.build_hash, release_folder + str(build_result.build_hash.name)) + sftp.close() + ssh.close() + # Make sure to reset to tools path - #os.chdir(tools_path) - #steam_publish.publish( - # steam_username="tachiom", - # steam_password=args.steam_password, - # set_live_branch_name="internal" - #) - - #session = ftplib.FTP('wallpaper.software','screenplay_releases',args.hosting_password) - - #file = open('kitten.jpg','rb') # file to send - #session.storbinary('STOR kitten.jpg', file) # send the file - #file.close() # close file and FTP - #session.quit() + os.chdir(tools_path) + steam_publish.publish( + steam_username="tachiom", + steam_password=args.steam_password, + set_live_branch_name="internal" + ) diff --git a/Tools/chocolatey/ScreenPlay/ReadMe.md b/Tools/chocolatey/ScreenPlay/ReadMe.md index fc1c6d54..5b117428 100644 --- a/Tools/chocolatey/ScreenPlay/ReadMe.md +++ b/Tools/chocolatey/ScreenPlay/ReadMe.md @@ -1,133 +1,21 @@ -## Summary -How do I create packages? See https://docs.chocolatey.org/en-us/create/create-packages +# Choco -If you are submitting packages to the community feed (https://community.chocolatey.org) -always try to ensure you have read, understood and adhere to the create -packages wiki link above. +Build locally: +``` +choco pack +``` -## Automatic Packaging Updates? -Consider making this package an automatic package, for the best -maintainability over time. Read up at https://docs.chocolatey.org/en-us/create/automatic-packages +Install the generated nupkg: +``` +choco install screenplay.0.15.0-RC2.nupkg -dv -s . +``` -## Shim Generation -Any executables you include in the package or download (but don't call -install against using the built-in functions) will be automatically shimmed. - -This means those executables will automatically be included on the path. -Shim generation runs whether the package is self-contained or uses automation -scripts. - -By default, these are considered console applications. - -If the application is a GUI, you should create an empty file next to the exe -named 'name.exe.gui' e.g. 'bob.exe' would need a file named 'bob.exe.gui'. -See https://docs.chocolatey.org/en-us/create/create-packages#how-do-i-set-up-shims-for-applications-that-have-a-gui - -If you want to ignore the executable, create an empty file next to the exe -named 'name.exe.ignore' e.g. 'bob.exe' would need a file named -'bob.exe.ignore'. -See https://docs.chocolatey.org/en-us/create/create-packages#how-do-i-exclude-executables-from-getting-shims - -## Self-Contained? -If you have a self-contained package, you can remove the automation scripts -entirely and just include the executables, they will automatically get shimmed, -which puts them on the path. Ensure you have the legal right to distribute -the application though. See https://docs.chocolatey.org/en-us/information/legal. - -You should read up on the Shim Generation section to familiarize yourself -on what to do with GUI applications and/or ignoring shims. - -## Automation Scripts -You have a powerful use of Chocolatey, as you are using PowerShell. So you -can do just about anything you need. Choco has some very handy built-in -functions that you can use, these are sometimes called the helpers. - -### Built-In Functions -https://docs.chocolatey.org/en-us/create/functions - -A note about a couple: -* Get-ToolsLocation - used to get you the 'tools' root, which by default is set to 'c:\tools', not the chocolateyInstall bin folder - see https://docs.chocolatey.org/en-us/create/functions/get-toolslocation -* Install-BinFile - used for non-exe files - executables are automatically shimmed... - see https://docs.chocolatey.org/en-us/create/functions/install-binfile -* Uninstall-BinFile - used for non-exe files - executables are automatically shimmed - see https://docs.chocolatey.org/en-us/create/functions/uninstall-binfile - -### Getting package specific information -Use the package parameters pattern - see https://docs.chocolatey.org/en-us/guides/create/parse-packageparameters-argument - -### Need to mount an ISO? -https://docs.chocolatey.org/en-us/guides/create/mount-an-iso-in-chocolatey-package - -### Environment Variables -Chocolatey makes a number of environment variables available (You can access any of these with $env:TheVariableNameBelow): - - * TEMP/TMP - Overridden to the CacheLocation, but may be the same as the original TEMP folder - * ChocolateyInstall - Top level folder where Chocolatey is installed - * ChocolateyPackageName - The name of the package, equivalent to the `` field in the nuspec (0.9.9+) - * ChocolateyPackageTitle - The title of the package, equivalent to the `` field in the nuspec (0.10.1+) - * ChocolateyPackageVersion - The version of the package, equivalent to the `<version />` field in the nuspec (0.9.9+) - * ChocolateyPackageFolder - The top level location of the package folder - the folder where Chocolatey has downloaded and extracted the NuGet package, typically `C:\ProgramData\chocolatey\lib\packageName`. - -#### Advanced Environment Variables -The following are more advanced settings: - - * ChocolateyPackageParameters - Parameters to use with packaging, not the same as install arguments (which are passed directly to the native installer). Based on `--package-parameters`. (0.9.8.22+) - * CHOCOLATEY_VERSION - The version of Choco you normally see. Use if you are 'lighting' things up based on choco version. (0.9.9+) - Otherwise take a dependency on the specific version you need. - * ChocolateyForceX86 = If available and set to 'true', then user has requested 32bit version. (0.9.9+) - Automatically handled in built in Choco functions. - * OS_PLATFORM - Like Windows, OSX, Linux. (0.9.9+) - * OS_VERSION - The version of OS, like 6.1 something something for Windows. (0.9.9+) - * OS_NAME - The reported name of the OS. (0.9.9+) - * USER_NAME = The user name (0.10.6+) - * USER_DOMAIN = The user domain name (could also be local computer name) (0.10.6+) - * IS_PROCESSELEVATED = Is the process elevated? (0.9.9+) - * IS_SYSTEM = Is the user the system account? (0.10.6+) - * IS_REMOTEDESKTOP = Is the user in a terminal services session? (0.10.6+) - * ChocolateyToolsLocation - formerly 'ChocolateyBinRoot' ('ChocolateyBinRoot' will be removed with Chocolatey v2.0.0), this is where tools being installed outside of Chocolatey packaging will go. (0.9.10+) - -#### Set By Options and Configuration -Some environment variables are set based on options that are passed, configuration and/or features that are turned on: - - * ChocolateyEnvironmentDebug - Was `--debug` passed? If using the built-in PowerShell host, this is always true (but only logs debug messages to console if `--debug` was passed) (0.9.10+) - * ChocolateyEnvironmentVerbose - Was `--verbose` passed? If using the built-in PowerShell host, this is always true (but only logs verbose messages to console if `--verbose` was passed). (0.9.10+) - * ChocolateyExitOnRebootDetected - Are we exiting on a detected reboot? Set by ` --exit-when-reboot-detected` or the feature `exitOnRebootDetected` (0.11.0+) - * ChocolateyForce - Was `--force` passed? (0.9.10+) - * ChocolateyForceX86 - Was `-x86` passed? (CHECK) - * ChocolateyRequestTimeout - How long before a web request will time out. Set by config `webRequestTimeoutSeconds` (CHECK) - * ChocolateyResponseTimeout - How long to wait for a download to complete? Set by config `commandExecutionTimeoutSeconds` (CHECK) - * ChocolateyPowerShellHost - Are we using the built-in PowerShell host? Set by `--use-system-powershell` or the feature `powershellHost` (0.9.10+) - -#### Business Edition Variables - - * ChocolateyInstallArgumentsSensitive - Encrypted arguments passed from command line `--install-arguments-sensitive` that are not logged anywhere. (0.10.1+ and licensed editions 1.6.0+) - * ChocolateyPackageParametersSensitive - Package parameters passed from command line `--package-parameters-senstivite` that are not logged anywhere. (0.10.1+ and licensed editions 1.6.0+) - * ChocolateyLicensedVersion - What version is the licensed edition on? - * ChocolateyLicenseType - What edition / type of the licensed edition is installed? - * USER_CONTEXT - The original user context - different when self-service is used (Licensed v1.10.0+) - -#### Experimental Environment Variables -The following are experimental or use not recommended: - - * OS_IS64BIT = This may not return correctly - it may depend on the process the app is running under (0.9.9+) - * CHOCOLATEY_VERSION_PRODUCT = the version of Choco that may match CHOCOLATEY_VERSION but may be different (0.9.9+) - based on git describe - * IS_ADMIN = Is the user an administrator? But doesn't tell you if the process is elevated. (0.9.9+) - * IS_REMOTE = Is the user in a remote session? (0.10.6+) - -#### Not Useful Or Anti-Pattern If Used - - * ChocolateyInstallOverride = Not for use in package automation scripts. Based on `--override-arguments` being passed. (0.9.9+) - * ChocolateyInstallArguments = The installer arguments meant for the native installer. You should use chocolateyPackageParameters instead. Based on `--install-arguments` being passed. (0.9.9+) - * ChocolateyIgnoreChecksums - Was `--ignore-checksums` passed or the feature `checksumFiles` turned off? (0.9.9.9+) - * ChocolateyAllowEmptyChecksums - Was `--allow-empty-checksums` passed or the feature `allowEmptyChecksums` turned on? (0.10.0+) - * ChocolateyAllowEmptyChecksumsSecure - Was `--allow-empty-checksums-secure` passed or the feature `allowEmptyChecksumsSecure` turned on? (0.10.0+) - * ChocolateyChecksum32 - Was `--download-checksum` passed? (0.10.0+) - * ChocolateyChecksumType32 - Was `--download-checksum-type` passed? (0.10.0+) - * ChocolateyChecksum64 - Was `--download-checksum-x64` passed? (0.10.0)+ - * ChocolateyChecksumType64 - Was `--download-checksum-type-x64` passed? (0.10.0)+ - * ChocolateyPackageExitCode - The exit code of the script that just ran - usually set by `Set-PowerShellExitCode` (CHECK) - * ChocolateyLastPathUpdate - Set by Chocolatey as part of install, but not used for anything in particular in packaging. - * ChocolateyProxyLocation - The explicit proxy location as set in the configuration `proxy` (0.9.9.9+) - * ChocolateyDownloadCache - Use available download cache? Set by `--skip-download-cache`, `--use-download-cache`, or feature `downloadCache` (0.9.10+ and licensed editions 1.1.0+) - * ChocolateyProxyBypassList - Explicitly set locations to ignore in configuration `proxyBypassList` (0.10.4+) - * ChocolateyProxyBypassOnLocal - Should the proxy bypass on local connections? Set based on configuration `proxyBypassOnLocal` (0.10.4+) - * http_proxy - Set by original `http_proxy` passthrough, or same as `ChocolateyProxyLocation` if explicitly set. (0.10.4+) - * https_proxy - Set by original `https_proxy` passthrough, or same as `ChocolateyProxyLocation` if explicitly set. (0.10.4+) - * no_proxy- Set by original `no_proxy` passthrough, or same as `ChocolateyProxyBypassList` if explicitly set. (0.10.4+) +Set api key from [https://community.chocolatey.org/account](https://community.chocolatey.org/account): +``` +choco apikey --key AAAAAAAA-AAAA-AAAA-AAAA-AAAAAAAA --source https://push.chocolatey.org/ +``` +Psuh: +``` +choco push screenplay.0.15.0-RC2.nupkg --source https://push.chocolatey.org/ +``` \ No newline at end of file diff --git a/Tools/chocolatey/ScreenPlay/screenplay.nuspec b/Tools/chocolatey/ScreenPlay/screenplay.nuspec index bee126cf..2ddd3b06 100644 --- a/Tools/chocolatey/ScreenPlay/screenplay.nuspec +++ b/Tools/chocolatey/ScreenPlay/screenplay.nuspec @@ -26,10 +26,10 @@ This is a nuspec. It mostly adheres to https://docs.nuget.org/create/Nuspec-Refe <!-- version should MATCH as closely as possible with the underlying software --> <!-- Is the version a prerelease of a version? https://docs.nuget.org/create/versioning#creating-prerelease-packages --> <!-- Note that unstable versions like 0.0.1 can be considered a released version, but it's possible that one can release a 0.0.1-beta before you release a 0.0.1 version. If the version number is final, that is considered a released version and not a prerelease. --> - <version>0.15.0-RC1</version> - <!-- <packageSourceUrl>Where is this Chocolatey package located (think GitHub)? packageSourceUrl is highly recommended for the community feed</packageSourceUrl>--> + <version>0.15.0-RC2</version> + <packageSourceUrl>https://gitlab.com/kelteseth/ScreenPlay/-/tree/master/Tools/chocolatey/ScreenPlay</packageSourceUrl> <!-- owners is a poor name for maintainers of the package. It sticks around by this name for compatibility reasons. It basically means you. --> - <!--<owners>__REPLACE_YOUR_NAME__</owners>--> + <owners>Elias Steurer</owners> <!-- ============================== --> <!-- == SOFTWARE SPECIFIC SECTION == --> @@ -39,8 +39,7 @@ This is a nuspec. It mostly adheres to https://docs.nuget.org/create/Nuspec-Refe <!-- projectUrl is required for the community feed --> <projectUrl>https://gitlab.com/kelteseth/ScreenPlay</projectUrl> <iconUrl>https://gitlab.com/kelteseth/ScreenPlay/-/blob/master/ScreenPlay/assets/icons/app.ico</iconUrl> - <!-- <copyright>Year Software Vendor</copyright> --> - <!-- If there is a license Url available, it is required for the community feed --> + <copyright>Elias Steurer 2022</copyright> <licenseUrl>https://gitlab.com/kelteseth/ScreenPlay/-/blob/master/Docs/Legal/ScreenPlay%20License.md</licenseUrl> <requireLicenseAcceptance>true</requireLicenseAcceptance> <projectSourceUrl>https://gitlab.com/kelteseth/ScreenPlay/</projectSourceUrl> @@ -52,27 +51,6 @@ This is a nuspec. It mostly adheres to https://docs.nuget.org/create/Nuspec-Refe <description> ScreenPlay is an Open Source cross-platform app for displaying Video Wallpaper and Widgets. </description> - <!-- <releaseNotes>__REPLACE_OR_REMOVE__MarkDown_Okay</releaseNotes> --> - <!-- =============================== --> - - <!-- Specifying dependencies and version ranges? https://docs.nuget.org/create/versioning#specifying-version-ranges-in-.nuspec-files --> - <!--<dependencies> - <dependency id="" version="__MINIMUM_VERSION__" /> - <dependency id="" version="[__EXACT_VERSION__]" /> - <dependency id="" version="[_MIN_VERSION_INCLUSIVE, MAX_VERSION_INCLUSIVE]" /> - <dependency id="" version="[_MIN_VERSION_INCLUSIVE, MAX_VERSION_EXCLUSIVE)" /> - <dependency id="" /> - <dependency id="chocolatey-core.extension" version="1.1.0" /> - </dependencies>--> - <!-- chocolatey-core.extension - https://chocolatey.org/packages/chocolatey-core.extension - - You want to use Get-UninstallRegistryKey on less than 0.9.10 (in chocolateyUninstall.ps1) - - You want to use Get-PackageParameters and on less than 0.11.0 - - You want to take advantage of other functions in the core community maintainer's team extension package - --> - - <!--<provides>NOT YET IMPLEMENTED</provides>--> - <!--<conflicts>NOT YET IMPLEMENTED</conflicts>--> - <!--<replaces>NOT YET IMPLEMENTED</replaces>--> </metadata> <files> <!-- this section controls what actually gets packaged into the Chocolatey package --> diff --git a/Tools/chocolatey/ScreenPlay/tools/chocolateyinstall.ps1 b/Tools/chocolatey/ScreenPlay/tools/chocolateyinstall.ps1 index 5eee87cf..750e01b0 100644 --- a/Tools/chocolatey/ScreenPlay/tools/chocolateyinstall.ps1 +++ b/Tools/chocolatey/ScreenPlay/tools/chocolateyinstall.ps1 @@ -2,7 +2,7 @@ $ErrorActionPreference = 'Stop'; $toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)" $url = '' -$url64 = 'https://kelteseth.com/screenplay/ScreenPlay-0.15.0-RC1-x64-windows-release.zip' +$url64 = 'https://kelteseth.com/releases/0.15.0-RC2/ScreenPlay-0.15.0-RC2-x64-windows-release.zip' $packageArgs = @{ packageName = $env:ChocolateyPackageName @@ -14,7 +14,7 @@ $packageArgs = @{ softwareName = 'ScreenPlay*' checksum = '' checksumType = 'sha256' - checksum64 = '' + checksum64 = 'e7dc40f99d681db2146a5f48e6bb1c0d8b46af40c9dde896975117b82c7e535f' checksumType64= 'sha256' } diff --git a/Tools/chocolatey/ScreenPlay/tools/chocolateyuninstall.ps1 b/Tools/chocolatey/ScreenPlay/tools/chocolateyuninstall.ps1 index 49c316de..e2077df0 100644 --- a/Tools/chocolatey/ScreenPlay/tools/chocolateyuninstall.ps1 +++ b/Tools/chocolatey/ScreenPlay/tools/chocolateyuninstall.ps1 @@ -1,66 +1,24 @@ -# IMPORTANT: Before releasing this package, copy/paste the next 2 lines into PowerShell to remove all comments from this file: -# $f='c:\path\to\thisFile.ps1' -# gc $f | ? {$_ -notmatch "^\s*#"} | % {$_ -replace '(^.*?)\s*?[^``]#.*','$1'} | Out-File $f+".~" -en utf8; mv -fo $f+".~" $f -## NOTE: In 80-90% of the cases (95% with licensed versions due to Package Synchronizer and other enhancements), -## AutoUninstaller should be able to detect and handle registry uninstalls without a chocolateyUninstall.ps1. -## See https://docs.chocolatey.org/en-us/choco/commands/uninstall -## and https://docs.chocolatey.org/en-us/create/functions/uninstall-chocolateypackage - -## If this is an MSI, ensure 'softwareName' is appropriate, then clean up comments and you are done. -## If this is an exe, change fileType, silentArgs, and validExitCodes - -$ErrorActionPreference = 'Stop'; # stop on all errors +$ErrorActionPreference = 'Stop'; $packageArgs = @{ packageName = $env:ChocolateyPackageName - softwareName = 'ScreenPlay*' #part or all of the Display Name as you see it in Programs and Features. It should be enough to be unique - fileType = 'EXE_MSI_OR_MSU' #only one of these: MSI or EXE (ignore MSU for now) - # MSI + softwareName = 'ScreenPlay*' + fileType = 'EXE_MSI_OR_MSU' silentArgs = "/qn /norestart" - validExitCodes= @(0, 3010, 1605, 1614, 1641) # https://msdn.microsoft.com/en-us/library/aa376931(v=vs.85).aspx - # OTHERS - # Uncomment matching EXE type (sorted by most to least common) - #silentArgs = '/S' # NSIS - #silentArgs = '/VERYSILENT /SUPPRESSMSGBOXES /NORESTART /SP-' # Inno Setup - #silentArgs = '/s' # InstallShield - #silentArgs = '/s /v"/qn"' # InstallShield with MSI - #silentArgs = '/s' # Wise InstallMaster - #silentArgs = '-s' # Squirrel - #silentArgs = '-q' # Install4j - #silentArgs = '-s -u' # Ghost - # Note that some installers, in addition to the silentArgs above, may also need assistance of AHK to achieve silence. - #silentArgs = '' # none; make silent with input macro script like AutoHotKey (AHK) - # https://community.chocolatey.org/packages/autohotkey.portable - #validExitCodes= @(0) #please insert other valid exit codes here + validExitCodes= @(0, 3010, 1605, 1614, 1641) } -# Get-UninstallRegistryKey is new to 0.9.10, if supporting 0.9.9.x and below, -# take a dependency on "chocolatey-core.extension" in your nuspec file. -# This is only a fuzzy search if $softwareName includes '*'. Otherwise it is -# exact. In the case of versions in key names, we recommend removing the version -# and using '*'. [array]$key = Get-UninstallRegistryKey -SoftwareName $packageArgs['softwareName'] if ($key.Count -eq 1) { $key | % { - $packageArgs['file'] = "$($_.UninstallString)" #NOTE: You may need to split this if it contains spaces, see below + $packageArgs['file'] = "$($_.UninstallString)" if ($packageArgs['fileType'] -eq 'MSI') { - # The Product Code GUID is all that should be passed for MSI, and very - # FIRST, because it comes directly after /x, which is already set in the - # Uninstall-ChocolateyPackage msiargs (facepalm). $packageArgs['silentArgs'] = "$($_.PSChildName) $($packageArgs['silentArgs'])" - # Don't pass anything for file, it is ignored for msi (facepalm number 2) - # Alternatively if you need to pass a path to an msi, determine that and - # use it instead of the above in silentArgs, still very first $packageArgs['file'] = '' } else { - # NOTES: - # - You probably will need to sanitize $packageArgs['file'] as it comes from the registry and could be in a variety of fun but unusable formats - # - Split args from exe in $packageArgs['file'] and pass those args through $packageArgs['silentArgs'] or ignore them - # - Ensure you don't pass double quotes in $file (aka $packageArgs['file']) - otherwise you will get "Illegal characters in path when you attempt to run this" - # - Review the code for auto-uninstaller for all of the fun things it does in sanitizing - https://github.com/chocolatey/choco/blob/bfe351b7d10c798014efe4bfbb100b171db25099/src/chocolatey/infrastructure.app/services/AutomaticUninstallerService.cs#L142-L192 } Uninstall-ChocolateyPackage @packageArgs @@ -74,10 +32,4 @@ if ($key.Count -eq 1) { $key | % {Write-Warning "- $($_.DisplayName)"} } -## OTHER POWERSHELL FUNCTIONS -## https://docs.chocolatey.org/en-us/create/functions -#Uninstall-ChocolateyZipPackage $packageName # Only necessary if you did not unpack to package directory - see https://docs.chocolatey.org/en-us/create/functions/uninstall-chocolateyzippackage -#Uninstall-ChocolateyEnvironmentVariable # 0.9.10+ - https://docs.chocolatey.org/en-us/create/functions/uninstall-chocolateyenvironmentvariable -#Uninstall-BinFile # Only needed if you used Install-BinFile - see https://docs.chocolatey.org/en-us/create/functions/uninstall-binfile -## Remove any shortcuts you added in the install script. diff --git a/Tools/install_requirements.py b/Tools/install_requirements.py index c5478677..489a6f22 100644 --- a/Tools/install_requirements.py +++ b/Tools/install_requirements.py @@ -3,8 +3,10 @@ import os import sys import subprocess - def install_requirements(): print("Set up required python modules") script_path = os.path.dirname(os.path.realpath(__file__)) subprocess.check_call([sys.executable, "-m", "pip", "install", "-r", script_path + "/requirements.txt"]) + +if __name__ == "__main__": + install_requirements() diff --git a/Tools/requirements.txt b/Tools/requirements.txt index d02517e7..eab86076 100644 --- a/Tools/requirements.txt +++ b/Tools/requirements.txt @@ -1,3 +1,4 @@ pyunpack py7zr -cmake-format \ No newline at end of file +cmake-format +paramiko \ No newline at end of file