-
Notifications
You must be signed in to change notification settings - Fork 337
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
Load libraries from central location #2804
Comments
Here is the patch I am using for now, feel free to use this or to implement it a better way: Index: agda/src/full/Agda/Interaction/Library.hs
===================================================================
--- agda.orig/src/full/Agda/Interaction/Library.hs 2017-10-13 21:58:48.432139892 -0400
+++ agda/src/full/Agda/Interaction/Library.hs 2017-10-13 22:39:44.970695744 -0400
@@ -215,13 +215,20 @@
-> LibM [AgdaLibFile] -- ^ Content of library files. (Might have empty @LibName@s.)
getInstalledLibraries overrideLibFile = mkLibM [] $ do
file <- lift $ getLibrariesFile overrideLibFile
- ifNotM (lift $ doesFileExist file) (return []) $ {-else-} do
+ userlibs <- ifNotM (lift $ doesFileExist file) (return []) $ {-else-} do
ls <- lift $ stripCommentLines <$> readFile file
files <- lift $ sequence [ (i, ) <$> expandEnvironmentVariables s | (i, s) <- ls ]
parseLibFiles (Just file) files
+
+ systemlibs <- ifNotM (lift $ doesDirectoryExist systemLibDir) (return []) $ do
+ files <- lift $ filter isLibFile <$> listDirectory systemLibDir
+ parseLibFiles Nothing $ zip [1..] $ map (systemLibDir </>) files
+ return $ userlibs ++ systemlibs
`catchIO` \ e -> do
tell [ OtherError $ unlines ["Failed to read installed libraries.", show e] ]
return []
+ where systemLibDir = "/var/lib/agda"
+ isLibFile fn = takeExtension fn == ".agda-lib" && not ("." `List.isPrefixOf` fn)
-- | Parse the given library files.
-- |
Thanks! What would be suitable locations for Windows and Mac OS? |
Sorry, not my field of expertise. Whoever creates ready-to-use packages of the standard library for these systems might have an opinion (homebrew etc.). |
None of the predefined directories in If such a list is added, then I think that it should be possible to override or ignore it by using command line options. |
I'm not sure I understand exactly what you are doing here. At the moment you "install" a library by adding the path to its With your change it looks like you should copy the Wouldn't it make more sense to load |
Hmm, I don’t remember all my thoughts from back then, but yeah, I think the plan was for the package maintainer to adjust the
That would work as well! |
Debian packages agda and agda-stdlib. Ideally, once you run
you should be able to run
agda -l standard-library Foo.agda
.For this to be working,
agda
needs to be able to look for.agda-lib
files in a well-known system-wide location.I propose (and actually have prepared the
agda-stdlib
package in Debian accordingly) to load all files named*.agda-lib
inOf course other package management systems can benefit from this as well, and for example university pool rooms can setup agda this way so that users don’t have to configure stuff in
~/.agda
The text was updated successfully, but these errors were encountered: