From c13f38861cfe5ece87f3a2725e90518a7779bb01 Mon Sep 17 00:00:00 2001 From: AnyOldName3 Date: Tue, 11 Aug 2020 23:12:28 +0100 Subject: [PATCH 1/2] Create install directory if it doesn't exist --- install.ps1 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/install.ps1 b/install.ps1 index aa18275..c25f31e 100644 --- a/install.ps1 +++ b/install.ps1 @@ -11,6 +11,10 @@ if (!$?) { Write-Error "pylupdate failed." -ErrorAction Stop } +if ( -Not (Test-Path -PathType Container $InstallPath)) { + New-Item -ItemType Directory $InstallPath -ErrorAction Stop +} + Copy-Item OpenMWExport.py,openmw.ico $InstallPath -ErrorAction Stop Write-Output "Done." \ No newline at end of file From ba9d0d286e077ebb5376ac05cc454e62f25e621e Mon Sep 17 00:00:00 2001 From: AnyOldName3 Date: Fri, 14 Aug 2020 23:20:47 +0100 Subject: [PATCH 2/2] Add release mode to install script --- .gitignore | 1 + .vscode/tasks.json | 7 +++++++ README.md | 2 ++ install.ps1 | 7 ++++++- 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 0ef3767..6ba6da0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .vscode/InstallDestination.txt +.vscode/ReleaseDestination.txt .vscode/launch.json .vscode/settings.json env diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 2f67990..a1e1b2a 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -12,6 +12,13 @@ "kind": "build", "isDefault": true } + }, + { + "label": "Release", + "type": "shell", + "command": "if (Test-Path env\\Scripts\\Activate.ps1) { .\\env\\Scripts\\activate } ; .\\install.ps1 $(Get-Content .vscode\\ReleaseDestination.txt) -Release", + "problemMatcher": [], + "group": "build" } ] } \ No newline at end of file diff --git a/README.md b/README.md index 834373b..62e5501 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,7 @@ Because of that, some automation is provided: `install.ps1` will regenerate the `.ts` file and copy the plugin files to the location specified by its first argument or given via stdin. +If the `-Release` flag is passed, it'll also copy the licence and readme, making it easier to do a release. To use it, you'll need a Python interpreter with some version of PyQt5's `PyQt5.pylupdate_main` package installed to be available in the current shell. If you've got a Mod Organizer 2 development environment on your machine, you can add its Python interpreter to the current shell's path, otherwise `pip install PyQt5` will get you what you need. @@ -61,6 +62,7 @@ Once this venv exists, editors like VS Code should pick it up and use it automat Also, a VS Code `tasks.json` file is provided that will call the install script as a build task. To specify the install destination, create a file in the `.vscode` directory called `InstallDestination.txt` containing the path to the MO2 plugins directory. +It also includes another build task for calling the release script which uses `.vscode/ReleaseDestination.txt`. Linting won't work with its default `pylint` linter as native packages with stubs are used, and in mid-2020, `pylint` doesn't support stubs. However, `mypy` works just fine once it's aware of the stubs. Battles were waged to try and make `mypy` see the stubs when they weren't in a venv and it was too complicated to document and reliably reproduce. diff --git a/install.ps1 b/install.ps1 index c25f31e..53f340b 100644 --- a/install.ps1 +++ b/install.ps1 @@ -2,7 +2,8 @@ param ( [Parameter(Mandatory=$true)] [string] - $InstallPath + $InstallPath, + [switch] $Release ) python -m PyQt5.pylupdate_main OpenMWExport.py -ts OpenMWExport_en.ts @@ -17,4 +18,8 @@ if ( -Not (Test-Path -PathType Container $InstallPath)) { Copy-Item OpenMWExport.py,openmw.ico $InstallPath -ErrorAction Stop +if ($Release) { + Copy-Item LICENSE,README.md $InstallPath -ErrorAction Stop +} + Write-Output "Done." \ No newline at end of file