Skip to content

Commit

Permalink
Merge pull request #172 from JuliaLang/nl/displaysize
Browse files Browse the repository at this point in the history
Add displaysize(), fix version script
  • Loading branch information
tkelman committed Feb 18, 2016
2 parents efc3488 + 1fac025 commit aa23cb9
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 10 deletions.
13 changes: 5 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,19 +133,16 @@ Currently, the `@compat` macro supports the following syntaxes:

* `super` is now `supertype` [#14338](https://github.com/JuliaLang/julia/pull/14338)


* `qr(A, pivot=b)` is now `qr(A, Val{b})`, likewise for `qrfact` and `qrfact!`


* `readall` and `readbytes` are now `readstring` and `read` [#14660](https://github.com/JuliaLang/julia/pull/14660)

* `get_bigfloat_precision` is now `precision(BigFloat)`, `set_precision` is `setprecision` and `with_bigfloat_precision` is now also `setprecision`
[#13232](https://github.com/JuliaLang/julia/pull/13232)

* `get_rounding` is now `rounding`. `set_rounding` and `with_rounding` are now `setrounding` [#13232](https://github.com/JuliaLang/julia/pull/13232)



* `Base.tty_size` (which was not exported) is now `displaysize` in Julia 0.5.

## New macros

Expand Down Expand Up @@ -180,10 +177,10 @@ Currently, the `@compat` macro supports the following syntaxes:
If you're adding additional compatibility code to this package, the [`bin/version.sh` script is useful for extracting the version number from a git commit SHA. For example, from the git repository of `julia`, run something like this:

```sh
bash $ /path/to/Compat/bin/version.sh e3aa57efbc6542efbcc7feac9b1309d628ac6f12
2418
bash $ /path/to/Compat/bin/version.sh a378b60fe483130d0d30206deb8ba662e93944da
0.5.0-dev+2023
```

This prints a number `XXXX`, and you can then test whether Julia
is at least this version by `VERSION >= v"0.4.0-dev+XXXX"` (assuming
it is a commit from the 0.4 development cycle).
is at least this version by `VERSION >= v"0.Y.0-dev+XXXX"` (assuming
it is a commit from the 0.Y development cycle).
5 changes: 3 additions & 2 deletions bin/version.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/bash
last_tag=$(git describe --tags --abbrev=0)
echo -n "0.4.0-dev+"
git rev-list $1 ^$last_tag | wc -l | sed -e 's/[^[:digit:]]//g'
ver=$(cat VERSION)
nb=$(git rev-list $1 ^$last_tag | wc -l | sed -e 's/[^[:digit:]]//g')
echo "$ver+$nb"
4 changes: 4 additions & 0 deletions src/Compat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -820,7 +820,11 @@ if VERSION < v"0.5.0-dev+2228"
s = open(filename)
EachLine(s, ()->close(s))
end
end

if VERSION < v"0.5.0-dev+2023"
const displaysize = Base.tty_size
export displaysize
end


Expand Down
2 changes: 2 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -818,3 +818,5 @@ for T in (BigFloat, Float64)
end

end

@test typeof(displaysize()) == @compat(Tuple{Int, Int})

0 comments on commit aa23cb9

Please sign in to comment.