netrc 0.2.0.1 → 0.2.0.2
raw patch · 4 files changed
+37/−28 lines, 4 filesdep ~bytestringdep ~deepseqdep ~parsec
Dependency ranges changed: bytestring, deepseq, parsec, tasty, tasty-quickcheck
Files
- changelog.md +9/−0
- netrc.cabal +16/−11
- src-tests/test-netrc.hs +2/−2
- src/Network/NetRc.hs +10/−15
changelog.md view
@@ -1,3 +1,12 @@+## 0.2.0.2++_Andreas Abel, 2025-09-02_++ - Remove obsolete `deriving Typeable`.+ - Remove old code for GHC 7.+ - Fix warnings.+ - Tested with GHC 8.0 - 9.14 alpha1.+ ## 0.2.0.1 _Andreas Abel, 2024-06-25_
netrc.cabal view
@@ -1,6 +1,6 @@-cabal-version: >=1.10+cabal-version: 1.18 name: netrc-version: 0.2.0.1+version: 0.2.0.2 synopsis: Parser for .netrc files homepage: https://github.com/haskell-hvr/netrc bug-reports: https://github.com/haskell-hvr/netrc/issues@@ -19,9 +19,11 @@ tested-with:- GHC == 9.10.1- GHC == 9.8.2- GHC == 9.6.5+ GHC == 9.14.1+ GHC == 9.12.2+ GHC == 9.10.2+ GHC == 9.8.4+ GHC == 9.6.7 GHC == 9.4.8 GHC == 9.2.8 GHC == 9.0.2@@ -32,8 +34,10 @@ GHC == 8.2.2 GHC == 8.0.2 -extra-source-files:+extra-doc-files: changelog.md++extra-source-files: src-tests/data/*.netrc src-tests/data/*.netrc.out @@ -47,11 +51,12 @@ OverloadedStrings RecordWildCards + -- Lower bounds taken from GHC 8.0 and Stackage LTS 7.0 build-depends: base >= 4.9 && < 5- , deepseq >= 1.3 && < 1.6- , bytestring >= 0.10.4 && < 0.13- , parsec >= 3.1 && < 3.2+ , deepseq >= 1.4.2.0 && < 1.6+ , bytestring >= 0.10.8.0 && < 0.13+ , parsec >= 3.1.11 && < 3.2 hs-source-dirs: src exposed-modules: Network.NetRc@@ -70,9 +75,9 @@ netrc , base , bytestring- , tasty >= 0.10 && < 1.6+ , tasty >= 0.11.0.4 && < 1.6 , tasty-golden == 2.3.*- , tasty-quickcheck >= 0.8.1 && < 1+ , tasty-quickcheck >= 0.8.4 && < 1 source-repository head type: git
src-tests/test-netrc.hs view
@@ -39,13 +39,13 @@ let goTests = testGroup "ref-samples" [ goldenVsString tn (fp++".out") (doGoTest fp) | fp <- sort netrcFiles- , let Just tn = stripPrefix "src-tests/data/" fp+ , let tn = fromMaybe undefined $ stripPrefix "src-tests/data/" fp ] let goTests2 = testGroup "ref-samples2" [ goldenVsString tn (fp++".out2") (doGoTest2 fp) | fp <- sort netrcFiles- , let Just tn = stripPrefix "src-tests/data/" fp+ , let tn = fromMaybe undefined $ stripPrefix "src-tests/data/" fp ] defaultMain $ testGroup "Tests" [goTests, goTests2, qcTests]
src/Network/NetRc.hs view
@@ -55,8 +55,13 @@ import qualified Data.ByteString.Lazy as LB import Data.Data import Data.Either (rights, lefts)-import Data.List (intersperse, foldl')-import Data.Monoid+import Data.List (intersperse)+#if !MIN_VERSION_base(4,20,0)+import Data.List (foldl')+#endif+#if !MIN_VERSION_base(4,11,0)+import Data.Semigroup ((<>))+#endif import GHC.Generics import System.Environment import System.IO.Error@@ -72,7 +77,7 @@ , nrhPassword :: !ByteString -- ^ @password@ property (@""@ if missing) , nrhAccount :: !ByteString -- ^ @account@ property (@""@ if missing) , nrhMacros :: [NetRcMacDef] -- ^ associated @macdef@ entries- } deriving (Eq,Ord,Show,Typeable,Data,Generic)+ } deriving (Eq, Ord, Show, Data, Generic) instance NFData NetRcHost where rnf !_ = () @@ -84,7 +89,7 @@ , nrmBody :: !ByteString -- ^ Raw @macdef@ body -- -- __Invariant__: must not contain null-lines, i.e. consecutive @LF@s- } deriving (Eq,Ord,Show,Typeable,Data,Generic)+ } deriving (Eq, Ord, Show, Data, Generic) instance NFData NetRcMacDef where rnf !_ = () @@ -105,7 +110,7 @@ -- associated with host-entries are -- invisible to some applications -- (e.g. @ftp(1)@).- } deriving (Eq,Ord,Show,Typeable,Data,Generic)+ } deriving (Eq, Ord, Show, Data, Generic) instance NFData NetRc where rnf (NetRc ms ds) = ms `deepseq` ds `deepseq` ()@@ -142,13 +147,8 @@ -- -- This is currently just a convenience wrapper around 'netRcToBuilder' netRcToByteString :: NetRc -> ByteString-#if MIN_VERSION_bytestring(0,10,0) netRcToByteString = LB.toStrict . BB.toLazyByteString . netRcToBuilder-#else-netRcToByteString = B.concat . LB.toChunks . BB.toLazyByteString . netRcToBuilder-#endif - -- | Convenience wrapper for 'netRcParsec' parser -- -- This is basically just@@ -163,7 +163,6 @@ parseNetRc :: P.SourceName -> ByteString -> Either P.ParseError NetRc parseNetRc = P.parse (netRcParsec <* P.eof) - -- | Reads and parses default @$HOME/.netrc@ -- -- Returns 'Nothing' if @$HOME@ variable undefined and/or if @.netrc@ if missing.@@ -184,10 +183,6 @@ Left e | isDoesNotExistError e -> return Nothing | otherwise -> ioError e Right b -> return $! Just $! parseNetRc fn b-#if !(MIN_VERSION_base(4,6,0))- where- lookupEnv k = lookup k <$> getEnvironment-#endif -- | "Text.Parsec.ByteString" 'P.Parser' for @.netrc@ grammar netRcParsec :: P.Parser NetRc