Skip to content

Commit

Permalink
Merge branch 'master' into 3.x
Browse files Browse the repository at this point in the history
  • Loading branch information
AnyOldName3 committed Aug 14, 2020
2 parents dc587e5 + ba9d0d2 commit 21cdc25
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.vscode/InstallDestination.txt
.vscode/ReleaseDestination.txt
.vscode/launch.json
.vscode/settings.json
env
7 changes: 7 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
]
}
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand All @@ -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.
Expand Down
11 changes: 10 additions & 1 deletion install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
param (
[Parameter(Mandatory=$true)]
[string]
$InstallPath
$InstallPath,
[switch] $Release
)

python -m PyQt5.pylupdate_main OpenMWExport.py -ts OpenMWExport_en.ts
Expand All @@ -11,6 +12,14 @@ 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

if ($Release) {
Copy-Item LICENSE,README.md $InstallPath -ErrorAction Stop
}

Write-Output "Done."

0 comments on commit 21cdc25

Please sign in to comment.