File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -17,15 +17,14 @@ function envinfo(io::IO = STDOUT; verbosity::Int = 1)
1717end
1818
1919function pkg_resources_version (name)
20- pkg_resources = try
21- pyimport (" pkg_resources" )
20+ try
21+ return pyimport (" pkg_resources" )[ :get_distribution ](name)[ :version ]
2222 catch err
23- if ! ( err isa PyCall. PyError)
24- rethrow ()
23+ if err isa PyCall. PyError || err isa KeyError
24+ return
2525 end
26- return
26+ rethrow ()
2727 end
28- return pkg_resources[:get_distribution ](name)[:version ]
2928end
3029
3130function _pyversion (name)
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ include("preamble.jl")
77 @test IPython. pyversion (" julia" ) isa String
88 @test IPython. pyversion (" IPython" ) isa String
99 @test IPython. pyversion (" IPython" ) == IPython. _pyversion (" IPython" )
10+ @test IPython. pkg_resources_version (" __NON_EXISTING__" ) isa Void
1011
1112 println (" vvv DRY RUN vvv" )
1213 @test_nothrow IPython. install_dependency (" ipython" ; dry_run= true )
You can’t perform that action at this time.
0 commit comments