Commit dc19b5f9 by Zachary Snow

use cabal package version as fallback when repo is missing

parent ecee8b33
...@@ -8,7 +8,9 @@ ...@@ -8,7 +8,9 @@
module Job where module Job where
import GitHash (giDescribe, tGitInfoCwd) import Data.Version (showVersion)
import GitHash (giDescribe, tGitInfoCwdTry)
import qualified Paths_sv2v (version)
import System.IO (stderr, hPutStr) import System.IO (stderr, hPutStr)
import System.Console.CmdArgs import System.Console.CmdArgs
import System.Environment (getArgs, withArgs) import System.Environment (getArgs, withArgs)
...@@ -40,6 +42,12 @@ data Job = Job ...@@ -40,6 +42,12 @@ data Job = Job
, write :: Write , write :: Write
} deriving (Show, Typeable, Data) } deriving (Show, Typeable, Data)
version :: String
version =
case $$tGitInfoCwdTry of
Left _ -> showVersion Paths_sv2v.version
Right info -> giDescribe info
defaultJob :: Job defaultJob :: Job
defaultJob = Job defaultJob = Job
{ files = def &= args &= typ "FILES" { files = def &= args &= typ "FILES"
...@@ -61,7 +69,7 @@ defaultJob = Job ...@@ -61,7 +69,7 @@ defaultJob = Job
++ " create a .v file next to each input") ++ " create a .v file next to each input")
} }
&= program "sv2v" &= program "sv2v"
&= summary ("sv2v " ++ giDescribe $$tGitInfoCwd) &= summary ("sv2v " ++ version)
&= details [ "sv2v converts SystemVerilog to Verilog." &= details [ "sv2v converts SystemVerilog to Verilog."
, "More info: https://github.com/zachjs/sv2v" , "More info: https://github.com/zachjs/sv2v"
, "(C) 2019-2021 Zachary Snow, 2011-2015 Tom Hawkins" ] , "(C) 2019-2021 Zachary Snow, 2011-2015 Tom Hawkins" ]
......
...@@ -104,6 +104,7 @@ executable sv2v ...@@ -104,6 +104,7 @@ executable sv2v
Convert.Wildcard Convert.Wildcard
-- sv2v CLI modules -- sv2v CLI modules
Job Job
Paths_sv2v
ghc-options: ghc-options:
-O3 -O3
-threaded -threaded
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment