Select Git revision
builtinimport.c
-
Damien George authored
The while-loop that calls chop_component will guarantee that level==-1 at the end of the loop. Hence the code following it is unnecessary. The check for p==this_name will catch imports that are beyond the top-level, and also covers the case of new_mod_q==MP_QSTR_ (equivalent to new_mod_l==0) so that check is removed. There is also a new check at the start for level>=0 to guard against __import__ being called with bad level values.
Damien George authoredThe while-loop that calls chop_component will guarantee that level==-1 at the end of the loop. Hence the code following it is unnecessary. The check for p==this_name will catch imports that are beyond the top-level, and also covers the case of new_mod_q==MP_QSTR_ (equivalent to new_mod_l==0) so that check is removed. There is also a new check at the start for level>=0 to guard against __import__ being called with bad level values.
main.go 1.07 KiB
package main
import (
"context"
"flag"
"log"
"net/http"
)
var (
flagBaseURL string
flagListen string
flagGitlabHost string
flagGitlabProject string
)
func main() {
flag.StringVar(&flagBaseURL, "base_url", "https://flow3r.garden/api/", "Base address at which this instance runs (used for calculating proxied data URLs)")
flag.StringVar(&flagListen, "listen", ":8080", "Address on which to listen")
flag.StringVar(&flagGitlabHost, "gitlab_host", "git.flow3r.garden", "GitLab instance host")
flag.StringVar(&flagGitlabProject, "gitlab_project", "flow3r/flow3r-firmware", "Name of the organization/project on GitLab")
flag.Parse()
ctx := context.Background()
s := server{
reqC: make(chan *req),
cache: make(map[string]map[string][]byte),
}
go s.run(ctx)
http.HandleFunc("/api/apps.json", s.handleApps)
http.HandleFunc("/api/releases.json", s.handleReleases)
http.HandleFunc("/api/release/", s.handleReleaseMirror)
http.HandleFunc("/api/apps/zip/", s.handleAppZip)
log.Printf("Listening on %s...", flagListen)
http.ListenAndServe(flagListen, nil)
}