@cryptotaxi247 / kubo / commits / f0badb6ce

vendor lib so windows builds work again

License: MIT Signed-off-by: Jeromy <jeromyj@gmail.com>

Jeromy committed Jul 23, 2015 at 10:55 UTC f0badb6ced21938e6eed36c37a9c590807438fae
15 files changed +331 -1
Godeps/Godeps.json
+4
@@ -230,6 +230,10 @@
230 "ImportPath": "github.com/mtchavez/jenkins",
231 "Rev": "5a816af6ef21ef401bff5e4b7dd255d63400f497"
232 },
233 + {
234 + "ImportPath": "github.com/olekukonko/ts",
235 + "Rev": "ecf753e7c962639ab5a1fb46f7da627d4c0a04b8"
236 + },
237 {
238 "ImportPath": "github.com/prometheus/client_golang/model",
239 "Comment": "0.6.0-15-g00e4c46",
Godeps/_workspace/src/github.com/cheggaaa/pb/pb_win.go
+1 -1
@@ -3,7 +3,7 @@
3 package pb
4
5 import (
6 - "github.com/olekukonko/ts"
6 + "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/olekukonko/ts"
7 )
8
9 func bold(str string) string {
Godeps/_workspace/src/github.com/olekukonko/ts/.travis.yml new
+6
@@ -0,0 +1,6 @@
1 +language: go
2 +
3 +go:
4 + - 1.1
5 + - 1.2
6 + - tip
\ No newline at end of file
Godeps/_workspace/src/github.com/olekukonko/ts/LICENCE new
+19
@@ -0,0 +1,19 @@
1 +Copyright (C) 2014 by Oleku Konko
2 +
3 +Permission is hereby granted, free of charge, to any person obtaining a copy
4 +of this software and associated documentation files (the "Software"), to deal
5 +in the Software without restriction, including without limitation the rights
6 +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 +copies of the Software, and to permit persons to whom the Software is
8 +furnished to do so, subject to the following conditions:
9 +
10 +The above copyright notice and this permission notice shall be included in
11 +all copies or substantial portions of the Software.
12 +
13 +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 +THE SOFTWARE.
\ No newline at end of file
Godeps/_workspace/src/github.com/olekukonko/ts/README.md new
+28
@@ -0,0 +1,28 @@
1 +ts (Terminal Size)
2 +==
3 +
4 +[![Build Status](https://travis-ci.org/olekukonko/ts.png?branch=master)](https://travis-ci.org/olekukonko/ts) [![Total views](https://sourcegraph.com/api/repos/github.com/olekukonko/ts/counters/views.png)](https://sourcegraph.com/github.com/olekukonko/ts)
5 +
6 +Simple go Application to get Terminal Size. So Many Implementations do not support windows but `ts` has full windows support.
7 +Run `go get github.com/olekukonko/ts` to download and install
8 +
9 +#### Example
10 +
11 +```go
12 +package main
13 +
14 +import (
15 + "fmt"
16 + "github.com/olekukonko/ts"
17 +)
18 +
19 +func main() {
20 + size, _ := ts.GetSize()
21 + fmt.Println(size.Col()) // Get Width
22 + fmt.Println(size.Row()) // Get Height
23 + fmt.Println(size.PosX()) // Get X position
24 + fmt.Println(size.PosY()) // Get Y position
25 +}
26 +```
27 +
28 +[See Documentation](http://godoc.org/github.com/olekukonko/ts)
Godeps/_workspace/src/github.com/olekukonko/ts/doc.go new
+36
@@ -0,0 +1,36 @@
1 +// Copyright 2014 Oleku Konko All rights reserved.
2 +// Use of this source code is governed by a MIT
3 +// license that can be found in the LICENSE file.
4 +
5 +// This module is a Terminal API for the Go Programming Language.
6 +// The protocols were written in pure Go and works on windows and unix systems
7 +
8 +/**
9 +
10 +Simple go Application to get Terminal Size. So Many Implementations do not support windows but `ts` has full windows support.
11 +Run `go get github.com/olekukonko/ts` to download and install
12 +
13 +Installation
14 +
15 +Minimum requirements are Go 1.1+ with fill Windows support
16 +
17 +Example
18 +
19 + package main
20 +
21 + import (
22 + "fmt"
23 + "github.com/olekukonko/ts"
24 + )
25 +
26 + func main() {
27 + size, _ := ts.GetSize()
28 + fmt.Println(size.Col()) // Get Width
29 + fmt.Println(size.Row()) // Get Height
30 + fmt.Println(size.PosX()) // Get X position
31 + fmt.Println(size.PosY()) // Get Y position
32 + }
33 +
34 +**/
35 +
36 +package ts
Godeps/_workspace/src/github.com/olekukonko/ts/ts.go new
+36
@@ -0,0 +1,36 @@
1 +// Copyright 2014 Oleku Konko All rights reserved.
2 +// Use of this source code is governed by a MIT
3 +// license that can be found in the LICENSE file.
4 +
5 +// This module is a Terminal API for the Go Programming Language.
6 +// The protocols were written in pure Go and works on windows and unix systems
7 +
8 +package ts
9 +
10 +// Return System Size
11 +type Size struct {
12 + row uint16
13 + col uint16
14 + posX uint16
15 + posY uint16
16 +}
17 +
18 +// Get Terminal Width
19 +func (w Size) Col() int {
20 + return int(w.col)
21 +}
22 +
23 +// Get Terminal Height
24 +func (w Size) Row() int {
25 + return int(w.row)
26 +}
27 +
28 +// Get Position X
29 +func (w Size) PosX() int {
30 + return int(w.posX)
31 +}
32 +
33 +// Get Position Y
34 +func (w Size) PosY() int {
35 + return int(w.posY)
36 +}
Godeps/_workspace/src/github.com/olekukonko/ts/ts_darwin.go new
+14
@@ -0,0 +1,14 @@
1 +// +build darwin
2 +
3 +// Copyright 2014 Oleku Konko All rights reserved.
4 +// Use of this source code is governed by a MIT
5 +// license that can be found in the LICENSE file.
6 +
7 +// This module is a Terminal API for the Go Programming Language.
8 +// The protocols were written in pure Go and works on windows and unix systems
9 +
10 +package ts
11 +
12 +const (
13 + TIOCGWINSZ = 0x40087468
14 +)
Godeps/_workspace/src/github.com/olekukonko/ts/ts_linux.go new
+13
@@ -0,0 +1,13 @@
1 +// +build linux
2 +
3 +// Copyright 2014 Oleku Konko All rights reserved.
4 +// Use of this source code is governed by a MIT
5 +// license that can be found in the LICENSE file.
6 +
7 +// This module is a Terminal API for the Go Programming Language.
8 +// The protocols were written in pure Go and works on windows and unix systems
9 +package ts
10 +
11 +const (
12 + TIOCGWINSZ = 0x5413
13 +)
Godeps/_workspace/src/github.com/olekukonko/ts/ts_other.go new
+14
@@ -0,0 +1,14 @@
1 +// +build !windows,!darwin,!freebsd,!netbsd,!openbsd,!linux
2 +
3 +// Copyright 2014 Oleku Konko All rights reserved.
4 +// Use of this source code is governed by a MIT
5 +// license that can be found in the LICENSE file.
6 +
7 +// This module is a Terminal API for the Go Programming Language.
8 +// The protocols were written in pure Go and works on windows and unix systems
9 +
10 +package ts
11 +
12 +const (
13 + TIOCGWINSZ = 0
14 +)
Godeps/_workspace/src/github.com/olekukonko/ts/ts_test.go new
+32
@@ -0,0 +1,32 @@
1 +// Copyright 2014 Oleku Konko All rights reserved.
2 +// Use of this source code is governed by a MIT
3 +// license that can be found in the LICENSE file.
4 +
5 +// This module is a Terminal API for the Go Programming Language.
6 +// The protocols were written in pure Go and works on windows and unix systems
7 +
8 +package ts
9 +
10 +import (
11 + "fmt"
12 + "testing"
13 +)
14 +
15 +func ExampleGetSize() {
16 + size, _ := GetSize()
17 + fmt.Println(size.Col()) // Get Width
18 + fmt.Println(size.Row()) // Get Height
19 + fmt.Println(size.PosX()) // Get X position
20 + fmt.Println(size.PosY()) // Get Y position
21 +}
22 +
23 +func TestSize(t *testing.T) {
24 + size, err := GetSize()
25 +
26 + if err != nil {
27 + t.Fatal(err)
28 + }
29 + if size.Col() == 0 || size.Row() == 0 {
30 + t.Fatalf("Screen Size Failed")
31 + }
32 +}
Godeps/_workspace/src/github.com/olekukonko/ts/ts_unix.go new
+14
@@ -0,0 +1,14 @@
1 +// +build freebsd netbsd openbsd
2 +
3 +// Copyright 2014 Oleku Konko All rights reserved.
4 +// Use of this source code is governed by a MIT
5 +// license that can be found in the LICENSE file.
6 +
7 +// This module is a Terminal API for the Go Programming Language.
8 +// The protocols were written in pure Go and works on windows and unix systems
9 +
10 +package ts
11 +
12 +const (
13 + TIOCGWINSZ = 0x40087468
14 +)
Godeps/_workspace/src/github.com/olekukonko/ts/ts_windows.go new
+64
@@ -0,0 +1,64 @@
1 +// +build windows
2 +
3 +// Copyright 2014 Oleku Konko All rights reserved.
4 +// Use of this source code is governed by a MIT
5 +// license that can be found in the LICENSE file.
6 +
7 +// This module is a Terminal API for the Go Programming Language.
8 +// The protocols were written in pure Go and works on windows and unix systems
9 +
10 +package ts
11 +
12 +import (
13 + "syscall"
14 + "unsafe"
15 +)
16 +
17 +var (
18 + kernel32 = syscall.NewLazyDLL("kernel32.dll")
19 +
20 + // Retrieves information about the specified console screen buffer.
21 + // See http://msdn.microsoft.com/en-us/library/windows/desktop/ms683171(v=vs.85).aspx
22 + screenBufferInfo = kernel32.NewProc("GetConsoleScreenBufferInfo")
23 +)
24 +
25 +// Contains information about a console screen buffer.
26 +// http://msdn.microsoft.com/en-us/library/windows/desktop/ms682093(v=vs.85).aspx
27 +type CONSOLE_SCREEN_BUFFER_INFO struct {
28 + DwSize COORD
29 + DwCursorPosition COORD
30 + WAttributes uint16
31 + SrWindow SMALL_RECT
32 + DwMaximumWindowSize COORD
33 +}
34 +
35 +// Defines the coordinates of a character cell in a console screen buffer.
36 +// The origin of the coordinate system (0,0) is at the top, left cell of the buffer.
37 +// See http://msdn.microsoft.com/en-us/library/windows/desktop/ms682119(v=vs.85).aspx
38 +type COORD struct {
39 + X, Y uint16
40 +}
41 +
42 +// Defines the coordinates of the upper left and lower right corners of a rectangle.
43 +// See http://msdn.microsoft.com/en-us/library/windows/desktop/ms686311(v=vs.85).aspx
44 +type SMALL_RECT struct {
45 + Left, Top, Right, Bottom uint16
46 +}
47 +
48 +func GetSize() (ws Size, err error) {
49 + var info CONSOLE_SCREEN_BUFFER_INFO
50 + rc, _, err := screenBufferInfo.Call(
51 + uintptr(syscall.Stdout),
52 + uintptr(unsafe.Pointer(&info)))
53 +
54 + if rc == 0 {
55 + return ws, err
56 + }
57 +
58 + ws = Size{info.SrWindow.Bottom,
59 + info.SrWindow.Right,
60 + info.DwCursorPosition.X,
61 + info.DwCursorPosition.Y}
62 +
63 + return ws, nil
64 +}
Godeps/_workspace/src/github.com/olekukonko/ts/ts_x.go new
+46
@@ -0,0 +1,46 @@
1 +// +build !windows
2 +
3 +// Copyright 2014 Oleku Konko All rights reserved.
4 +// Use of this source code is governed by a MIT
5 +// license that can be found in the LICENSE file.
6 +
7 +// This module is a Terminal API for the Go Programming Language.
8 +// The protocols were written in pure Go and works on windows and unix systems
9 +
10 +package ts
11 +
12 +import (
13 + "syscall"
14 + "unsafe"
15 +)
16 +
17 +// Get Windows Size
18 +func GetSize() (ws Size, err error) {
19 + _, _, ec := syscall.Syscall(syscall.SYS_IOCTL,
20 + uintptr(syscall.Stdout),
21 + uintptr(TIOCGWINSZ),
22 + uintptr(unsafe.Pointer(&ws)))
23 +
24 + err = getError(ec)
25 +
26 + if TIOCGWINSZ == 0 && err != nil {
27 + ws = Size{80, 25, 0, 0}
28 + }
29 + return ws, err
30 +}
31 +
32 +func getError(ec interface{}) (err error) {
33 + switch v := ec.(type) {
34 +
35 + case syscall.Errno: // Some implementation return syscall.Errno number
36 + if v != 0 {
37 + err = syscall.Errno(v)
38 + }
39 +
40 + case error: // Some implementation return error
41 + err = ec.(error)
42 + default:
43 + err = nil
44 + }
45 + return
46 +}
util/sadhack/godep.go
+4
@@ -8,3 +8,7 @@ import _ "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/dustin/go-hum
8 import _ "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/whyrusleeping/iptb"
9
10 import _ "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/chriscool/go-sleep"
11 +
12 +// imported by chegga/pb on windows, this is here so running godeps on non-windows doesnt
13 +// drop it from our vendoring
14 +import _ "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/olekukonko/ts"