Skip to content

Updates and fixes to pkg-config #280

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Apr 25, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Sources/Build/misc.swift
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ extension SystemPackageProvider {
}

var isAvailable: Bool {
guard let platform = Platform.currentPlatform() else { return false }
guard let platform = Platform.currentPlatform else { return false }
switch self {
case .Brew(_):
if case .Darwin = platform {
Expand Down
4 changes: 3 additions & 1 deletion Sources/Utility/Platform.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ public enum Platform {
case Debian
}

public static func currentPlatform() -> Platform? {
// Lazily return current platform.
public static var currentPlatform = Platform.findCurrentPlatform()
private static func findCurrentPlatform() -> Platform? {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should be able to use something like:

public static var currentPlatform = {
}()

which is a standard trick I believe.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried that I think got some error...I'll retry.

guard let uname = try? popen(["uname"]).chomp().lowercased() else { return nil }
switch uname {
case "darwin":
Expand Down