Skip to content

Commit

Permalink
add msvc/python/vs-buildtools
Browse files Browse the repository at this point in the history
  • Loading branch information
Sunrisepeak committed Dec 17, 2024
1 parent 94c945e commit 269f536
Show file tree
Hide file tree
Showing 5 changed files with 136 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pkgs/c/cpp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function installed()
return toolchain.load("msvc"):check()
elseif pkginfo.version == "gnu" then
local output = os.iorun("gcc --version")
return string.find(output, "gcc", 1, true) ~= nil
return string.find(output:trim(), "gcc", 1, true) ~= nil
else
return true
end
Expand Down
48 changes: 48 additions & 0 deletions pkgs/m/msvc.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package = {
name = "msvc",
description = "Microsoft Visual Studio C++ Compiler",
maintainers = "Microsoft",

type = "auto-config",
status = "stable",
maintainers = "Microsoft",
categories = { "toolchain", "c++", "c", "compiler" },
keywords = { "msvc", "c++", "c" },

xpm = {
deps = { "vs-buildtools@2022" },
windows = {
["latest"] = { ref = "2022" },
["2022"] = { } -- v143
},
}
}

-- https://learn.microsoft.com/en-us/visualstudio/install/workload-component-id-vs-build-tools?view=vs-2022
local msvc_component = "Microsoft.VisualStudio.Component.VC.Tools.x86.x64"

function installed()
return toolchain.load("msvc"):check()
end

function install()
os.exec(
"vs_BuildTools.exe" ..
-- " --installPath " .. vs_install_path ..
" --add " .. msvc_component ..
" --includeRecommended" ..
-- " --quiet " ..
" --passive " ..
-- " --norestart " ..
" --wait " -- ..
)
end

function uninstall()
os.exec(
"vs_BuildTools.exe" ..
" --remove " .. msvc_component ..
" --passive " ..
" --wait "
)
end
53 changes: 53 additions & 0 deletions pkgs/p/python.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package = {
homepage = "https://www.python.org",
name = "python",
description = "The Python programming language",
maintainers = "Python Software Foundation",
licenses = "PSF License | GPL compatible",
repo = "https://github.com/python/cpython",
docs = "https://docs.python.org/3",

-- xim pkg info
archs = {"x86_64"},
status = "stable", -- dev, stable, deprecated
categories = {"python", "plang"},

xpm = {
windows = {
["latest"] = { ref = "3.12.6"},
["3.12.6"] = {
url = "https://gitee.com/sunrisepeak/xlings-pkg/releases/download/python12/python-3.12.6-amd64.exe",
sha256 = "5914748e6580e70bedeb7c537a0832b3071de9e09a2e4e7e3d28060616045e0a",
},
},
},
}

import("common")
import("xim.base.runtime")

local pkginfo = runtime.get_pkginfo()

function installed()
if is_host("windows") then
return os.iorun("python --version")
else
return os.iorun("python3 --version")
end
end

function install()
common.xlings_run_bat_script(
pkginfo.install_file .. [[ /passive InstallAllUsers=1 PrependPath=1 Include_test=1 ]],
true
)
return true
end

function uninstall()
common.xlings_run_bat_script(
pkginfo.install_file .. [[ /uninstall /passive ]],
true
)
return true
end
34 changes: 34 additions & 0 deletions pkgs/v/vs-buildtools.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package = {
name = "VS BuildTools",
description = "Visual Studio Code",

status = "stable",
maintainers = "Microsoft",
categories = { "build-tools" },
keywords = { "msvc" },

xpm = {
windows = {
["latest"] = { ref = "2022" },
["2022"] = {
url = "https://download.visualstudio.microsoft.com/download/pr/f2819554-a618-400d-bced-774bb5379965/ab3cff3d3a8c48804f47eb521cf138480f5ed4fe86476dd449a420777d7f2ead/vs_BuildTools.exe",
sha256 = "ab3cff3d3a8c48804f47eb521cf138480f5ed4fe86476dd449a420777d7f2ead"
}
},
}
}

import("xim.base.runtime")

local pkginfo = runtime.get_pkginfo()

function installed()
return os.isfile(pkginfo.install_file)
end

function install() return true end

function uninstall()
os.tryrm(pkginfo.install_file)
return true
end
4 changes: 0 additions & 4 deletions pmwrapper.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ pmwrapper = {
["java"] = { ref = "openjdk8" },
["java8"] = { ref = "openjdk8" },
["jdk8"] = { ref = "openjdk8" },
["msvc"] = { ref = "vs-build-tools" },
["openjdk"] = { ref = "openjdk8" },
["openjdk8"] = {
windows = {"winget", "AdoptOpenJDK.OpenJDK.8"},
Expand All @@ -37,9 +36,6 @@ pmwrapper = {
windows = {"winget", "Microsoft.VisualStudioCode"},
archlinux = {"pacman", "code"},
},
["vs-build-tools"] = {
windows = {"winget", "Microsoft.VisualStudio.2022.BuildTools"},
},
["wsl"] = {
windows = {"winget", "Microsoft.WSL"},
},
Expand Down

0 comments on commit 269f536

Please sign in to comment.