Source

imagepaste / src / Version.hs

{-# LANGUAGE TemplateHaskell, CPP #-}
module Version (fullVersion) where

#ifdef CABAL
-- cabal build

import Distribution.VcsRevision.Mercurial
import Language.Haskell.TH.Syntax
import Paths_imagepaste (version)
import Data.Version (showVersion)

main = showVersion version

showHgVersion :: String
showHgVersion = $(do
    v <- qRunIO getRevision
    lift $ case v of
        Nothing            -> "<none>"
        Just (hash, True)  -> hash ++ " (with local modifications)"
        Just (hash, False) -> hash)

-- | Version

fullVersion = (showVersion version) ++ " " ++ showHgVersion

#else
-- Makefile (ghc --make) build

-- Hard-coded for developer builds
fullVersion = "0.2.0.0-alpha 119:86725ab7343e"

#endif
-- CABAL