diff --git a/Project.toml b/Project.toml index 6b66ab671..7e350b9e6 100644 --- a/Project.toml +++ b/Project.toml @@ -7,18 +7,18 @@ AbstractAlgebra = "c3fe647b-3220-5bb0-a1ea-a7954cac585d" FLINT_jll = "e134572f-a0d5-539d-bddf-3cad8db41a82" Libdl = "8f399da3-3557-5675-b5ff-fb832c97cbdb" LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" -Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" RandomExtensions = "fb686558-2515-59ef-acaa-46db3789a887" SHA = "ea8e919c-243c-51af-8825-aaa63cd721ce" +TOML = "fa267f1f-6049-4f14-aa54-33bafae1ed76" [compat] AbstractAlgebra = "0.43.10" FLINT_jll = "^300.100.100" Libdl = "1.6" LinearAlgebra = "1.6" -Pkg = "1.6" Random = "1.6" RandomExtensions = "0.4.2" SHA = "~1.6, ~1.7, 0.7" +TOML = "<0.0.1, 1" julia = "1.6" diff --git a/src/Nemo.jl b/src/Nemo.jl index a33a3d60c..6a41bc137 100644 --- a/src/Nemo.jl +++ b/src/Nemo.jl @@ -14,7 +14,7 @@ import Random: rand! using RandomExtensions: RandomExtensions, make, Make2, Make3 -import Pkg +import TOML import SHA @@ -333,6 +333,19 @@ end const __isthreaded = Ref(false) +function show_banner() + PROJECT_TOML = TOML.parsefile(joinpath(@__DIR__, "..", "Project.toml")) + VERSION_NUMBER = PROJECT_TOML["version"] + if isdir(joinpath(@__DIR__, "..", ".git")) + VERSION_NUMBER *= "-dev" + end + println("") + println("Welcome to Nemo version $VERSION_NUMBER") + println("") + println("Nemo comes with absolutely no warranty whatsoever") +end + + function __init__() # In case libgmp picks up the wrong libgmp later on, we "unset" the jl_* # functions from the julia :libgmp. @@ -346,10 +359,7 @@ function __init__() @ccall libflint.flint_set_abort(@cfunction(flint_abort, Nothing, ())::Ptr{Nothing})::Nothing if AbstractAlgebra.should_show_banner() && get(ENV, "NEMO_PRINT_BANNER", "true") != "false" - println("") - println("Welcome to Nemo version $(version())") - println("") - println("Nemo comes with absolutely no warranty whatsoever") + show_banner() end # Initialize the thread local random state @@ -377,42 +387,10 @@ end ############################################################################### # -# Version information +# Hack helper # ################################################################################ -const deps = Pkg.dependencies() -if !haskey(deps, Base.UUID("2edaba10-b0f1-5616-af89-8c11ac63239a")) - version() = "building" -else - ver = deps[Base.UUID("2edaba10-b0f1-5616-af89-8c11ac63239a")] - if occursin("/dev/", ver.source) - version() = VersionNumber("$(ver.version)-dev") - else - version() = VersionNumber("$(ver.version)") - end -end - -function versioninfo() - print("Nemo version $(version())\n") - nemorepo = dirname(dirname(@__FILE__)) - - print("Nemo: ") - prepo = Base.LibGit2.GitRepo(nemorepo) - Base.LibGit2.with(Base.LibGit2.head(prepo)) do phead - print("commit: ") - print(string(Base.LibGit2.Oid(phead))[1:8]) - print(" date: ") - commit = Base.LibGit2.get(Base.LibGit2.GitCommit, prepo, Base.LibGit2.Oid(phead)) - print(Base.Dates.unix2datetime(Base.LibGit2.author(commit).time)) - print(")\n") - end - - finalize(prepo) - - return nothing -end - macro new_struct(T, args...) return esc(Expr(:new, T, args...)) end