-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: switch to bootstrap for windows
- Loading branch information
Showing
7 changed files
with
259 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,162 @@ | ||
# What: Python: byte-compiled / optimized / DLL files | ||
# Why: automatically created by Python during script execution | ||
# Output directory of tests | ||
/out | ||
|
||
# Any log directory | ||
**/[Ll][Oo][Gg]/* | ||
|
||
# Any backup file of text editors | ||
*.bak | ||
|
||
# Backup files of KConfig | ||
*.old | ||
|
||
# Generated IDEA project files | ||
.idea | ||
|
||
# bootstrap files are downloaded during installation | ||
/.bootstrap | ||
|
||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
/.pytest_cache | ||
*.py[cod] | ||
*$py.class | ||
|
||
# What: CMake build output folder | ||
# Why: automatically created by CMake | ||
/build | ||
/dist | ||
/*.egg-info/ | ||
/.eggs/ | ||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.Python | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
wheels/ | ||
share/python-wheels/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
MANIFEST | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.nox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*.cover | ||
*.py,cover | ||
.hypothesis/ | ||
.pytest_cache/ | ||
cover/ | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Django stuff: | ||
*.log | ||
local_settings.py | ||
db.sqlite3 | ||
db.sqlite3-journal | ||
|
||
# Flask stuff: | ||
instance/ | ||
.webassets-cache | ||
|
||
# Scrapy stuff: | ||
.scrapy | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
# Images generated by sphinx-traceability-extension (e.g. pie-charts) | ||
docs/_images | ||
|
||
# PyBuilder | ||
.pybuilder/ | ||
target/ | ||
|
||
# Jupyter Notebook | ||
.ipynb_checkpoints | ||
|
||
# IPython | ||
profile_default/ | ||
ipython_config.py | ||
|
||
# pyenv | ||
# For a library or package, you might want to ignore these files since the code is | ||
# intended to run in multiple environments; otherwise, check them in: | ||
# .python-version | ||
|
||
# pipenv | ||
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. | ||
# However, in case of collaboration, if having platform-specific dependencies or dependencies | ||
# having no cross-platform support, pipenv may install dependencies that don't work, or not | ||
# install all needed dependencies. | ||
#Pipfile.lock | ||
|
||
# PEP 582; used by e.g. github.com/David-OConnor/pyflow | ||
__pypackages__/ | ||
|
||
# Celery stuff | ||
celerybeat-schedule | ||
celerybeat.pid | ||
|
||
# SageMath parsed files | ||
*.sage.py | ||
|
||
# Environments | ||
.env | ||
.venv | ||
env/ | ||
venv/ | ||
ENV/ | ||
env.bak/ | ||
venv.bak/ | ||
|
||
# Spyder {{package_name}} settings | ||
.spyderproject | ||
.spyproject | ||
|
||
# Rope {{package_name}} settings | ||
.ropeproject | ||
|
||
# mkdocs documentation | ||
/site | ||
|
||
# mypy | ||
.mypy_cache/ | ||
.dmypy.json | ||
dmypy.json | ||
|
||
# Pyre type checker | ||
.pyre/ | ||
|
||
# pytype static type analyzer | ||
.pytype/ | ||
|
||
# Cython debug symbols | ||
cython_debug/ | ||
|
||
# PyCharm generated project folder | ||
.idea | ||
# Draw.io backup files | ||
*.drawio.bkp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
{ | ||
"files.insertFinalNewline": true, | ||
"python.testing.pytestArgs": [ | ||
"tests", | ||
"--capture=tee-sys" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
powershell -ExecutionPolicy Bypass -File %~dp0build.ps1 %* || exit /b 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,93 +1,99 @@ | ||
<# | ||
.DESCRIPTION | ||
Wrapper for installing dependencies, running and testing the project | ||
.Notes | ||
On Windows, it may be required to enable this script by setting the execution | ||
policy for the user. You can do this by issuing the following PowerShell command: | ||
PS C:\> Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser | ||
For more information on Execution Policies: | ||
https://go.microsoft.com/fwlink/?LinkID=135170 | ||
#> | ||
|
||
param( | ||
[switch]$installMandatory ## install mandatory packages (e.g., CMake, Ninja, ...) | ||
[switch]$clean ## clean build, wipe out all build artifacts | ||
, [switch]$install ## install mandatory packages | ||
) | ||
|
||
$ErrorActionPreference = "Stop" | ||
|
||
# Needed on Jenkins, somehow the env var PATH is not updated automatically | ||
# after tool installations by scoop | ||
Function ReloadEnvVars () { | ||
$Env:Path = [System.Environment]::GetEnvironmentVariable("Path", "User") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "Machine") | ||
} | ||
|
||
Function ScoopInstall ([string[]]$Packages) { | ||
Invoke-CommandLine -CommandLine "scoop install $Packages" | ||
ReloadEnvVars | ||
} | ||
|
||
Function Invoke-CommandLine { | ||
function Invoke-CommandLine { | ||
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingInvokeExpression', '', Justification = 'Usually this statement must be avoided (https://learn.microsoft.com/en-us/powershell/scripting/learn/deep-dives/avoid-using-invoke-expression?view=powershell-7.3), here it is OK as it does not execute unknown code.')] | ||
param ( | ||
[Parameter(Mandatory = $true, Position = 0)] | ||
[string]$CommandLine, | ||
[Parameter(Mandatory = $false, Position = 1)] | ||
[bool]$StopAtError = $true, | ||
[Parameter(Mandatory = $false, Position = 2)] | ||
[bool]$PrintCommand = $true, | ||
[Parameter(Mandatory = $false, Position = 3)] | ||
[bool]$Silent = $false | ||
) | ||
if (-Not $Silent) { | ||
Write-Host "Executing: $CommandLine" | ||
if ($PrintCommand) { | ||
Write-Output "Executing: $CommandLine" | ||
} | ||
$global:LASTEXITCODE = 0 | ||
if ($Silent) { | ||
# Omit information stream (6) and stdout (1) | ||
Invoke-Expression $CommandLine 6>&1 | Out-Null | ||
} | ||
Invoke-Expression $CommandLine | ||
if ($LASTEXITCODE -ne 0) { | ||
else { | ||
Invoke-Expression $CommandLine | ||
} | ||
if ($global:LASTEXITCODE -ne 0) { | ||
if ($StopAtError) { | ||
Write-Error "Command line call `"$CommandLine`" failed with exit code $LASTEXITCODE" | ||
exit 1 | ||
Write-Error "Command line call `"$CommandLine`" failed with exit code $global:LASTEXITCODE" | ||
} | ||
else { | ||
if (-Not $Silent) { | ||
Write-Host "Command line call `"$CommandLine`" failed with exit code $LASTEXITCODE, continuing ..." | ||
} | ||
Write-Output "Command line call `"$CommandLine`" failed with exit code $global:LASTEXITCODE, continuing ..." | ||
} | ||
} | ||
} | ||
|
||
Push-Location $PSScriptRoot | ||
function Invoke-Bootstrap { | ||
# Download bootstrap scripts from external repository | ||
Invoke-RestMethod https://raw.githubusercontent.com/avengineers/bootstrap-installer/v1.13.0/install.ps1 | Invoke-Expression | ||
# Execute bootstrap script | ||
. .\.bootstrap\bootstrap.ps1 | ||
} | ||
|
||
function Remove-Path { | ||
param ( | ||
[Parameter(Mandatory = $true, Position = 0)] | ||
[string]$path | ||
) | ||
if (Test-Path -Path $path -PathType Container) { | ||
Write-Output "Deleting directory '$path' ..." | ||
Remove-Item $path -Force -Recurse | ||
} | ||
elseif (Test-Path -Path $path -PathType Leaf) { | ||
Write-Output "Deleting file '$path' ..." | ||
Remove-Item $path -Force | ||
} | ||
} | ||
|
||
## start of script | ||
# Always set the $InformationPreference variable to "Continue" globally, | ||
# this way it gets printed on execution and continues execution afterwards. | ||
$InformationPreference = "Continue" | ||
|
||
# Stop on first error | ||
$ErrorActionPreference = "Stop" | ||
|
||
Push-Location $PSScriptRoot | ||
Write-Output "Running in ${pwd}" | ||
|
||
if ($installMandatory) { | ||
if (-Not (Get-Command scoop -errorAction SilentlyContinue)) { | ||
# Initial Scoop installation | ||
iwr get.scoop.sh -outfile 'install.ps1' | ||
if ((New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent())).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) { | ||
& .\install.ps1 -RunAsAdmin | ||
} else { | ||
& .\install.ps1 | ||
try { | ||
|
||
if ($install) { | ||
if ($clean) { | ||
Remove-Path ".venv" | ||
} | ||
ReloadEnvVars | ||
} | ||
|
||
# Necessary for 7zip installation, failed on Jenkins for unknown reason. See those issues: | ||
# https://github.com/ScoopInstaller/Scoop/issues/460 | ||
# https://github.com/ScoopInstaller/Scoop/issues/4024 | ||
ScoopInstall('lessmsi') | ||
Invoke-CommandLine -CommandLine "scoop config MSIEXTRACT_USE_LESSMSI $true" | ||
# Default installer tools, e.g., dark is required for python | ||
ScoopInstall('7zip', 'innounp', 'dark') | ||
Invoke-CommandLine -CommandLine "scoop bucket add extras" -StopAtError $false | ||
Invoke-CommandLine -CommandLine "scoop bucket add versions" -StopAtError $false | ||
# bootstrap environment | ||
Invoke-Bootstrap | ||
} | ||
|
||
Invoke-CommandLine -CommandLine "scoop update" | ||
ScoopInstall(Get-Content 'install-mandatory.list') | ||
$PipInstaller = "python -m pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org" | ||
Invoke-CommandLine -CommandLine "$PipInstaller poetry" | ||
ReloadEnvVars | ||
if ($clean) { | ||
Remove-Path "build" | ||
} | ||
|
||
Invoke-CommandLine "poetry run python -m pytest --verbose --capture=tee-sys" | ||
Invoke-CommandLine "poetry build" | ||
Invoke-CommandLine "poetry run make --directory doc html" | ||
} | ||
|
||
Invoke-CommandLine -CommandLine "poetry install" | ||
Invoke-CommandLine -CommandLine "poetry run python -m pytest --verbose --capture=tee-sys" | ||
Invoke-CommandLine -CommandLine "poetry build" | ||
Invoke-CommandLine -CommandLine "poetry run make --directory doc html" | ||
|
||
Pop-Location | ||
finally { | ||
Pop-Location | ||
} | ||
## end of script |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
"buckets": [ | ||
{ | ||
"Name": "spl", | ||
"Source": "https://github.com/avengineers/spl-bucket" | ||
}, | ||
{ | ||
"Name": "extras", | ||
"Source": "https://github.com/ScoopInstaller/Extras" | ||
} | ||
], | ||
"apps": [ | ||
{ | ||
"Source": "spl", | ||
"Name": "mingw-winlibs-llvm-ucrt", | ||
"Version": "13.2.0-16.0.6-11.0.0-ucrt-r1" | ||
}, | ||
{ | ||
"Source": "extras", | ||
"Name": "plantuml" | ||
}, | ||
{ | ||
"Source": "extras", | ||
"Name": "umlet" | ||
} | ||
] | ||
} |