1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

vpm: support full urls in v.mod's dependencies field (#13180)

This commit is contained in:
Delyan Angelov 2022-01-15 14:35:37 +02:00 committed by GitHub
parent 6485b6eeb7
commit 57563599a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -6,6 +6,7 @@ module main
import os import os
import os.cmdline import os.cmdline
import net.http import net.http
import net.urllib
import json import json
import vhelp import vhelp
import v.vmod import v.vmod
@ -664,6 +665,17 @@ fn verbose_println(s string) {
fn get_module_meta_info(name string) ?Mod { fn get_module_meta_info(name string) ?Mod {
mut errors := []string{} mut errors := []string{}
if purl := urllib.parse(name) {
verbose_println('purl: $purl')
mod := Mod{
name: purl.path.trim_left('/').trim_right('/')
url: name
}
verbose_println(mod.str())
return mod
}
for server_url in default_vpm_server_urls { for server_url in default_vpm_server_urls {
modurl := server_url + '/jsmod/$name' modurl := server_url + '/jsmod/$name'
verbose_println('Retrieving module metadata from: $modurl ...') verbose_println('Retrieving module metadata from: $modurl ...')