If I understand your question, you need to determine whether or not a 
package (call it "Package") is available to be used via *using* or *import.*
You can know if a package is present before trying to load the package.  

This will evaluate true when the package "Package" is present, and false 
when the package is not present, before trying to load it:
``
 isdir(joinpath(Pkg.dir(),"Package")
```
On Tuesday, December 8, 2015 at 11:02:17 AM UTC-5, Jeffrey Sarnoff wrote:

if isdir(joinpath(Pkg.dir(),"Package"))
  ...
else
  ...
end


On Monday, December 7, 2015 at 10:50:56 AM UTC-5, Seth wrote:
>
> Is there a way to specify a conditional dependency (that is, use package 
> Foo if it's available and define functions that use things from Foo; 
> otherwise, don't define the functions or throw an error message) on 
> packages that contain macros? isdefined(Main, :Package) won't work since 
> the macros from Package are evaluated prior to this conditional, and it 
> will throw an error.
>
> I was using Requires.jl to do this, but one issue I ran into is that an 
> error in the code within the @require block is not propagated as an error; 
> it's presented as a warning, which means that things like unit tests will 
> pass even if the code is incorrect.
>

Reply via email to