Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support filepath >= 1.5.0.0 and os-string #305

Merged
merged 3 commits into from
Nov 29, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ jobs:
autoreconf -i
cabal test all --test-show-details=direct

fedora36:
fedora37:
runs-on: ubuntu-latest
container:
image: fedora:36
image: fedora:37
steps:
- name: Install
run: |
Expand Down
7 changes: 6 additions & 1 deletion System/Posix/Env/PosixString.hsc
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{-# LANGUAGE CApiFFI #-}
{-# LANGUAGE PackageImports #-}

-----------------------------------------------------------------------------
-- |
Expand Down Expand Up @@ -42,7 +43,11 @@ import GHC.IO.Encoding.Failure ( CodingFailureMode(..) )
import System.Posix.Env ( clearEnv )
import System.OsPath.Posix
import System.OsString.Internal.Types
import qualified System.OsPath.Data.ByteString.Short as B
#if MIN_VERSION_filepath(1, 5, 0)
import qualified "os-string" System.OsString.Data.ByteString.Short as B
#else
import qualified "filepath" System.OsPath.Data.ByteString.Short as B
#endif
import Data.ByteString.Short.Internal ( copyToPtr )

import qualified System.Posix.Env.Internal as Internal
Expand Down
7 changes: 6 additions & 1 deletion System/Posix/PosixPath/FilePath.hsc
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE PackageImports #-}

-----------------------------------------------------------------------------
-- |
Expand Down Expand Up @@ -45,7 +46,11 @@ import Data.ByteString.Internal (c_strlen)
import Control.Monad
import Control.Exception
import System.OsPath.Posix as PS
import System.OsPath.Data.ByteString.Short as BSS
#if MIN_VERSION_filepath(1, 5, 0)
import "os-string" System.OsString.Data.ByteString.Short as BSS
#else
import "filepath" System.OsPath.Data.ByteString.Short as BSS
#endif
import Prelude hiding (FilePath)
import System.OsString.Internal.Types (PosixString(..), pattern PS)
import GHC.IO.Exception
Expand Down
7 changes: 6 additions & 1 deletion System/Posix/Process/PosixString.hsc
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{-# LANGUAGE PackageImports #-}
-----------------------------------------------------------------------------
-- |
-- Module : System.Posix.Process.PosixString
Expand Down Expand Up @@ -79,7 +80,11 @@ import Foreign.C hiding (

import System.OsPath.Types
import System.OsString.Internal.Types (PosixString(..))
import qualified System.OsPath.Data.ByteString.Short as BC
#if MIN_VERSION_filepath(1, 5, 0)
import qualified "os-string" System.OsString.Data.ByteString.Short as BC
#else
import qualified "filepath" System.OsPath.Data.ByteString.Short as BC
#endif

import System.Posix.PosixPath.FilePath

Expand Down
7 changes: 6 additions & 1 deletion System/Posix/Temp/PosixString.hsc
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{-# LANGUAGE CApiFFI #-}
{-# LANGUAGE PackageImports #-}
-----------------------------------------------------------------------------
-- |
-- Module : System.Posix.Temp.PosixString
Expand All @@ -20,7 +21,11 @@ module System.Posix.Temp.PosixString (

#include "HsUnix.h"

import qualified System.OsPath.Data.ByteString.Short as BC
#if MIN_VERSION_filepath(1, 5, 0)
import qualified "os-string" System.OsString.Data.ByteString.Short as BC
#else
import qualified "filepath" System.OsPath.Data.ByteString.Short as BC
#endif
import Data.Word

import Foreign.C
Expand Down
7 changes: 6 additions & 1 deletion tests/T13660.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE PackageImports #-}

module Main where

Expand All @@ -15,7 +16,11 @@ import System.Posix.IO (defaultFileFlags, OpenFileFlags(..), OpenMode(..))
import System.Posix.ByteString.FilePath

import qualified Data.ByteString.Char8 as C
import qualified System.OsPath.Data.ByteString.Short as SBS
#if MIN_VERSION_filepath(1, 5, 0)
import qualified "os-string" System.OsString.Data.ByteString.Short as SBS
#else
import qualified "filepath" System.OsPath.Data.ByteString.Short as SBS
#endif
import qualified System.Posix.Env.PosixString as PS
import qualified System.Posix.IO.PosixString as PS
import qualified System.Posix.IO.ByteString as BS
Expand Down
23 changes: 20 additions & 3 deletions unix.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ extra-tmp-files:
include/HsUnixConfig.h
unix.buildinfo

flag os-string
description: Use the new os-string package
default: False
manual: False

source-repository head
type: git
location: https://github.com/haskell/unix.git
Expand All @@ -71,9 +76,13 @@ library
build-depends:
base >= 4.12.0.0 && < 4.20,
bytestring >= 0.9.2 && < 0.13,
filepath >= 1.4.100.0 && < 1.5,
time >= 1.9.1 && < 1.13

if flag(os-string)
build-depends: filepath >= 1.5.0.0, os-string >= 2.0.0
else
build-depends: filepath >= 1.4.100.0 && < 1.5.0.0

exposed-modules:
System.Posix
System.Posix.ByteString
Expand Down Expand Up @@ -172,7 +181,11 @@ test-suite unix-tests
Signals001
type: exitcode-stdio-1.0
default-language: Haskell2010
build-depends: base, bytestring, filepath, tasty, tasty-hunit, tasty-quickcheck, unix
build-depends: base, bytestring, tasty, tasty-hunit, tasty-quickcheck, unix
if flag(os-string)
build-depends: filepath >= 1.5.0.0, os-string >= 2.0.0
else
build-depends: filepath >= 1.4.100.0 && < 1.5.0.0
ghc-options: -Wall -with-rtsopts=-V0

test-suite FdReadBuf001
Expand Down Expand Up @@ -362,5 +375,9 @@ test-suite T13660
main-is: T13660.hs
type: exitcode-stdio-1.0
default-language: Haskell2010
build-depends: base, unix, filepath >= 1.4.100.0 && < 1.5, bytestring
build-depends: base, unix, bytestring
if flag(os-string)
build-depends: filepath >= 1.5.0.0, os-string >= 2.0.0
else
build-depends: filepath >= 1.4.100.0 && < 1.5.0.0
ghc-options: -Wall