-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add setup.vsh, to make matching the installed SDL version easier for …
…users Add a script to ease the post installation setup of SDL for end users.
- Loading branch information
Showing
1 changed file
with
29 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import os | ||
|
||
os.chdir(os.dir(os.executable()))! | ||
|
||
res := os.execute('sdl2-config --version') | ||
if res.exit_code != 0 { | ||
println('sdl2-config is missing') | ||
exit(1) | ||
} | ||
system_version := res.output.trim_space() | ||
println('Your version is ${system_version}') | ||
|
||
remotes := os.execute('git branch -r --list') | ||
if remotes.exit_code != 0 { | ||
println('git is missing') | ||
exit(1) | ||
} | ||
supported_versions := remotes.output.split_into_lines().map(it.trim_space()).filter(it.starts_with('origin/2')).map(it.all_after('origin/')) | ||
println('The SDL module officially supports these versions of SDL:\n ${supported_versions}') | ||
|
||
if system_version in supported_versions { | ||
println('Setting up the repository to branch ${system_version} that exactly matches your system SDL version') | ||
os.system('git checkout ${system_version}') | ||
exit(0) | ||
} | ||
|
||
base_version := '${system_version.all_before_last('.')}.0' | ||
println('Setting up the repository to branch ${base_version}, that best matches the system SDL version: ${system_version} ...') | ||
os.system('git checkout ${base_version}') |