mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-02 22:00:19 +08:00
Yaml bug (#207)
* test: azure pipeline * fix: azure pipeline yaml * feat: elementary support * feat: opensuse support * fix: 0_setup.go line 27 * fix: 0_setup.go line 27 * fix: opensuse yaml * fix: opensuse yaml * fix: opensuse yaml * fix: opensuse yaml * fix: opensuse yaml * fix: opensuse yaml * fix: yaml * fix: yaml * fix: yaml * fix: opensuse yaml * fix: opensuse * fix: opensuse * fix: opensuse * fix: opensuse * fix: string trim os osRelease field NAME * fix: 0_setup.go if err typo * test * test * fix: typo in linux.go * test: remove quotes from opensuse case * test: revert * test: "" * test: "" * test: "" * test: "" * fix: replace trim with replace * fix: drop 0_setup.go and run checks by system.go * fix: elementary os yaml name * fix: open suse yaml entry * fix: commented out result.Release = version * fix: commented out result.Release = version * fix: revert Replace to Trim * fix: Linux Mint yaml entry * fix: capitalize distros entries * fix: capitalize distros entries * fix: capitalize distros entries * test * test * fix: open suse yaml entry * fix: yaml entris * test * test * test * test * test * test * branch changing * fix: bug in setup process * debugging * debugging * debugging * debugging * fix: yaml entries & err == nil bug * Update prerequisites.go * fix: bug * fix: 0_setup.go * fix: yaml bug * fix: yaml bug
This commit is contained in:
parent
77939ea414
commit
08fe7b64d6
@ -46,10 +46,12 @@ Make sure you have the xcode command line tools installed. This can be done by r
|
|||||||
|
|
||||||
### Linux
|
### Linux
|
||||||
|
|
||||||
#### Debian 9, Ubuntu 18.04, Zorin 15, Parrot 4.7, Linuxmint 19
|
#### Debian 9, Ubuntu 18.04
|
||||||
|
|
||||||
`sudo apt install libgtk-3-dev libwebkit2gtk-4.0-dev`
|
`sudo apt install libgtk-3-dev libwebkit2gtk-4.0-dev`
|
||||||
|
|
||||||
|
_Also Zorin 15, Parrot 4.7, Linuxmint 19_
|
||||||
|
|
||||||
#### Arch Linux
|
#### Arch Linux
|
||||||
|
|
||||||
`sudo pacman -S webkit2gtk gtk3`
|
`sudo pacman -S webkit2gtk gtk3`
|
||||||
|
@ -93,7 +93,6 @@ func parseOsRelease(osRelease string) *DistroInfo {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Check distro name against list of distros
|
// Check distro name against list of distros
|
||||||
result.Release = version
|
|
||||||
switch osID {
|
switch osID {
|
||||||
case "fedora":
|
case "fedora":
|
||||||
result.Distribution = Fedora
|
result.Distribution = Fedora
|
||||||
@ -119,8 +118,10 @@ func parseOsRelease(osRelease string) *DistroInfo {
|
|||||||
result.Distribution = Unknown
|
result.Distribution = Unknown
|
||||||
}
|
}
|
||||||
|
|
||||||
result.ID = osID
|
|
||||||
result.Name = osNAME
|
result.Name = osNAME
|
||||||
|
result.ID = osID
|
||||||
|
result.Release = version
|
||||||
|
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,8 +21,8 @@ type Distribution struct {
|
|||||||
// GetRelease attempts to return the specific Release information
|
// GetRelease attempts to return the specific Release information
|
||||||
// for the given release name. If there is no specific match, the
|
// for the given release name. If there is no specific match, the
|
||||||
// default release data is returned.
|
// default release data is returned.
|
||||||
func (d *Distribution) GetRelease(name string) *Release {
|
func (d *Distribution) GetRelease(version string) *Release {
|
||||||
result := d.Releases[name]
|
result := d.Releases[version]
|
||||||
if result == nil {
|
if result == nil {
|
||||||
result = d.Releases["default"]
|
result = d.Releases["default"]
|
||||||
}
|
}
|
||||||
@ -72,8 +72,8 @@ func (l *LinuxDB) ImportData(data []byte) error {
|
|||||||
// GetDistro returns the Distribution information for the
|
// GetDistro returns the Distribution information for the
|
||||||
// given distribution name. If the distribution is not supported,
|
// given distribution name. If the distribution is not supported,
|
||||||
// nil is returned.
|
// nil is returned.
|
||||||
func (l *LinuxDB) GetDistro(name string) *Distribution {
|
func (l *LinuxDB) GetDistro(distro string) *Distribution {
|
||||||
return l.Distributions[name]
|
return l.Distributions[distro]
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewLinuxDB creates a new LinuxDB instance from the bundled
|
// NewLinuxDB creates a new LinuxDB instance from the bundled
|
||||||
|
@ -33,7 +33,7 @@ distributions:
|
|||||||
releases:
|
releases:
|
||||||
default:
|
default:
|
||||||
version: default
|
version: default
|
||||||
name: Parrot
|
name: Parrot GNU/Linux
|
||||||
gccversioncommand: *gccdumpversion
|
gccversioncommand: *gccdumpversion
|
||||||
programs: *debiandefaultprograms
|
programs: *debiandefaultprograms
|
||||||
libraries: *debiandefaultlibraries
|
libraries: *debiandefaultlibraries
|
||||||
@ -51,7 +51,7 @@ distributions:
|
|||||||
releases:
|
releases:
|
||||||
default:
|
default:
|
||||||
version: default
|
version: default
|
||||||
name: Linuxmint
|
name: Linux Mint
|
||||||
gccversioncommand: *gccdumpversion
|
gccversioncommand: *gccdumpversion
|
||||||
programs: *debiandefaultprograms
|
programs: *debiandefaultprograms
|
||||||
libraries: *debiandefaultlibraries
|
libraries: *debiandefaultlibraries
|
||||||
@ -79,7 +79,7 @@ distributions:
|
|||||||
releases:
|
releases:
|
||||||
default:
|
default:
|
||||||
version: default
|
version: default
|
||||||
name: CentOS
|
name: CentOS Linux
|
||||||
gccversioncommand: *gccdumpversion
|
gccversioncommand: *gccdumpversion
|
||||||
programs:
|
programs:
|
||||||
- name: gcc
|
- name: gcc
|
||||||
@ -87,7 +87,7 @@ distributions:
|
|||||||
- name: pkg-config
|
- name: pkg-config
|
||||||
help: Please install with `sudo yum install pkgconf-pkg-config` and try again
|
help: Please install with `sudo yum install pkgconf-pkg-config` and try again
|
||||||
- name: npm
|
- name: npm
|
||||||
help: Please install with `sudo yum install nodejs` and try again
|
help: Please install with `sudo yum install epel-release && sudo yum install nodejs` and try again
|
||||||
libraries:
|
libraries:
|
||||||
- name: gtk3-devel
|
- name: gtk3-devel
|
||||||
help: Please install with `sudo yum install gtk3-devel` and try again
|
help: Please install with `sudo yum install gtk3-devel` and try again
|
||||||
@ -119,17 +119,18 @@ distributions:
|
|||||||
version: default
|
version: default
|
||||||
name: Arch Linux
|
name: Arch Linux
|
||||||
gccversioncommand: *gccdumpversion
|
gccversioncommand: *gccdumpversion
|
||||||
prerequisites:
|
programs:
|
||||||
- name: gtk3
|
- name: gcc
|
||||||
help: Please install with `sudo pacman -S gtk3` and try again
|
help: Please install with `sudo pacman -S gcc` and try again
|
||||||
- name: webkit2gtk
|
- name: pkgconf
|
||||||
help: Please install with `sudo pacman -S webkit2gtk` and try again
|
help: Please install with `sudo pacman -S pkgconf` and try again
|
||||||
- name: gcc
|
- name: npm
|
||||||
help: Please install with `sudo pacman -S gcc` and try again
|
help: Please install with `sudo pacman -S npm` and try again
|
||||||
- name: pkgconf
|
libraries:
|
||||||
help: Please install with `sudo pacman -S pkgconf` and try again
|
- name: gtk3
|
||||||
- name: npm
|
help: Please install with `sudo pacman -S gtk3` and try again
|
||||||
help: Please install with `sudo pacman -S npm` and try again
|
- name: webkit2gtk
|
||||||
|
help: Please install with `sudo pacman -S webkit2gtk` and try again
|
||||||
gentoo:
|
gentoo:
|
||||||
id: gentoo
|
id: gentoo
|
||||||
releases:
|
releases:
|
||||||
@ -137,14 +138,16 @@ distributions:
|
|||||||
version: default
|
version: default
|
||||||
name: Gentoo
|
name: Gentoo
|
||||||
gccversioncommand: *gccdumpversion
|
gccversioncommand: *gccdumpversion
|
||||||
prerequisites:
|
programs:
|
||||||
- name: gtk+:3
|
- name: gcc
|
||||||
help: Please install with `sudo emerge gtk+:3` and try again
|
help: Please install using your system's package manager
|
||||||
- name: webkit-gtk
|
- name: pkg-config
|
||||||
help: Please install with `sudo emerge webkit-gtk` and try again
|
help: Please install using your system's package manager
|
||||||
- name: gcc
|
- name: npm
|
||||||
help: Please install using your system's package manager
|
help: Please install using your system's package manager
|
||||||
- name: pkg-config
|
libraries:
|
||||||
help: Please install using your system's package manager
|
- name: gtk+:3
|
||||||
- name: npm
|
help: Please install with `sudo emerge gtk+:3` and try again
|
||||||
help: Please install using your system's package manager
|
- name: webkit-gtk
|
||||||
|
help: Please install with `sudo emerge webkit-gtk` and try again
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"runtime"
|
"runtime"
|
||||||
|
|
||||||
"github.com/wailsapp/wails/cmd"
|
"github.com/wailsapp/wails/cmd"
|
||||||
@ -24,7 +23,7 @@ func init() {
|
|||||||
|
|
||||||
system := cmd.NewSystemHelper()
|
system := cmd.NewSystemHelper()
|
||||||
err = system.Initialise()
|
err = system.Initialise()
|
||||||
if err == nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -33,23 +32,9 @@ Create your first project by running 'wails init'.`
|
|||||||
if runtime.GOOS != "windows" {
|
if runtime.GOOS != "windows" {
|
||||||
successMessage = "🚀 " + successMessage
|
successMessage = "🚀 " + successMessage
|
||||||
}
|
}
|
||||||
// Platform check
|
|
||||||
err = platformCheck()
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check we have a cgo capable environment
|
// Chrck for programs and libraries dependencies
|
||||||
logger.Yellow("Checking for prerequisites...")
|
errors, err := cmd.CheckDependencies(logger)
|
||||||
var requiredProgramErrors bool
|
|
||||||
requiredProgramErrors, err = checkRequiredPrograms()
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// Linux has library deps
|
|
||||||
var libraryErrors bool
|
|
||||||
libraryErrors, err = checkLibraries()
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -60,76 +45,14 @@ Create your first project by running 'wails init'.`
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.White("")
|
|
||||||
|
|
||||||
// Check for errors
|
// Check for errors
|
||||||
var errors = libraryErrors || requiredProgramErrors
|
// CheckDependencies() returns !errors
|
||||||
if !errors {
|
// so to get the right message in this
|
||||||
|
// check we have to do it in reversed
|
||||||
|
if errors {
|
||||||
logger.Yellow(successMessage)
|
logger.Yellow(successMessage)
|
||||||
}
|
}
|
||||||
|
|
||||||
return err
|
return err
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func platformCheck() error {
|
|
||||||
switch runtime.GOOS {
|
|
||||||
case "darwin":
|
|
||||||
logger.Yellow("Detected Platform: OSX")
|
|
||||||
case "windows":
|
|
||||||
logger.Yellow("Detected Platform: Windows")
|
|
||||||
case "linux":
|
|
||||||
logger.Yellow("Detected Platform: Linux")
|
|
||||||
default:
|
|
||||||
return fmt.Errorf("Platform %s is currently not supported", runtime.GOOS)
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func checkLibraries() (errors bool, err error) {
|
|
||||||
if runtime.GOOS == "linux" {
|
|
||||||
// Check library prerequisites
|
|
||||||
requiredLibraries, err := cmd.GetRequiredLibraries()
|
|
||||||
if err != nil {
|
|
||||||
return false, err
|
|
||||||
}
|
|
||||||
distroInfo := cmd.GetLinuxDistroInfo()
|
|
||||||
for _, library := range *requiredLibraries {
|
|
||||||
switch distroInfo.Distribution {
|
|
||||||
case cmd.Ubuntu, cmd.Zorin, cmd.Debian:
|
|
||||||
installed, err := cmd.DpkgInstalled(library.Name)
|
|
||||||
if err != nil {
|
|
||||||
return false, err
|
|
||||||
}
|
|
||||||
if !installed {
|
|
||||||
errors = true
|
|
||||||
logger.Red("Library '%s' not found. %s", library.Name, library.Help)
|
|
||||||
} else {
|
|
||||||
logger.Green("Library '%s' installed.", library.Name)
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
return false, cmd.RequestSupportForDistribution(distroInfo)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func checkRequiredPrograms() (errors bool, err error) {
|
|
||||||
requiredPrograms, err := cmd.GetRequiredPrograms()
|
|
||||||
if err != nil {
|
|
||||||
return true, err
|
|
||||||
}
|
|
||||||
errors = false
|
|
||||||
programHelper := cmd.NewProgramHelper()
|
|
||||||
for _, program := range *requiredPrograms {
|
|
||||||
bin := programHelper.FindProgram(program.Name)
|
|
||||||
if bin == nil {
|
|
||||||
errors = true
|
|
||||||
logger.Red("Program '%s' not found. %s", program.Name, program.Help)
|
|
||||||
} else {
|
|
||||||
logger.Green("Program '%s' found: %s", program.Name, bin.Path)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user