|
1 | | -using Libdl, Base.Sys |
| 1 | +# Copyright (c) 2016: Ng Yee Sian, Miles Lubin, other contributors |
| 2 | +# |
| 3 | +# Use of this source code is governed by an MIT-style license that can be found |
| 4 | +# in the LICENSE.md file or at https://opensource.org/licenses/MIT. |
| 5 | + |
| 6 | +import Libdl |
2 | 7 |
|
3 | 8 | const DEPS_FILE = joinpath(dirname(@__FILE__), "deps.jl") |
4 | 9 |
|
@@ -41,15 +46,24 @@ function try_local_installation() |
41 | 46 | return |
42 | 47 | end |
43 | 48 |
|
| 49 | +const WHEELS = Dict( |
| 50 | + "x86_64-linux-gnu" => "https://files.pythonhosted.org/packages/76/6e/ffe880b013ad244f0fd91940454e4f2bf16fa01e74c469e1b0fb75eda12a/knitro-15.0.0-py3-none-manylinux1_x86_64.whl", |
| 51 | +) |
| 52 | + |
44 | 53 | function try_ci_installation() |
45 | | - local_filename = joinpath(@__DIR__, "libknitro.so") |
46 | | - download(ENV["SECRET_KNITRO_URL"], local_filename) |
47 | | - download(ENV["SECRET_KNITRO_LIBIOMP5"], joinpath(@__DIR__, "libiomp5.so")) |
48 | | - write_depsfile("", local_filename) |
| 54 | + if Sys.islinux() |
| 55 | + cd(@__DIR__) |
| 56 | + mkdir("wheel") |
| 57 | + cd("wheel") |
| 58 | + run(`wget $(WHEELS["x86_64-linux-gnu"])`) |
| 59 | + run(`unzip knitro-15.0.0-py3-none-manylinux1_x86_64.whl`) |
| 60 | + filename = joinpath(@__DIR__, "wheel", "knitro", "lib", "libknitro.so") |
| 61 | + write_depsfile("", filename) |
| 62 | + end |
49 | 63 | return |
50 | 64 | end |
51 | 65 |
|
52 | | -if get(ENV, "SECRET_KNITRO_URL", "") != "" |
| 66 | +if get(ENV, "CI", "false") == "true" |
53 | 67 | try_ci_installation() |
54 | 68 | else |
55 | 69 | try_local_installation() |
|
0 commit comments