-
-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't say unknown crate for abstract crates in
alr get
(#1633)
* Inform about providers in `alr get` * Test for the change
- Loading branch information
Showing
6 changed files
with
82 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
with Alire.Index; | ||
with Alire.Utils.TTY; | ||
|
||
package body Alr.Common is | ||
|
||
-------------------- | ||
-- Show_Providers -- | ||
-------------------- | ||
|
||
function Show_Providers (Dep : Alire.Dependencies.Dependency) return Boolean | ||
is | ||
use Alire; | ||
begin | ||
if Index.All_Crate_Aliases.Contains (Dep.Crate) then | ||
Trace.Always ("Crate " & Utils.TTY.Name (Dep.Crate) | ||
& " is abstract and provided by:"); | ||
for Provider of Index.All_Crate_Aliases.all (Dep.Crate) loop | ||
Trace.Always (" " & Utils.TTY.Name (Provider)); | ||
end loop; | ||
|
||
return True; | ||
else | ||
return False; | ||
end if; | ||
end Show_Providers; | ||
|
||
end Alr.Common; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
with Alire.Dependencies; | ||
|
||
package Alr.Common is | ||
|
||
-- Some reusable bits across commands | ||
|
||
function Show_Providers (Dep : Alire.Dependencies.Dependency) | ||
return Boolean; | ||
|
||
end Alr.Common; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
""" | ||
Test the output of `alr get` for an abstract crate | ||
""" | ||
|
||
from drivers.alr import run_alr | ||
from drivers.asserts import assert_eq | ||
|
||
# gnat does not contain releases but several other crates provide it, so rather | ||
# than saying that the crate doesn't exist, show its providers: | ||
|
||
assert_eq("""Crate gnat is abstract and provided by: | ||
gnat_cross_1 | ||
gnat_cross_2 | ||
gnat_external | ||
gnat_native | ||
""", | ||
run_alr("get", "gnat", "--dirname").out) | ||
|
||
# Check the error for a truly unknown crate: | ||
|
||
assert_eq("""\ | ||
ERROR: Crate [unobtanium] does not exist in the index. | ||
""", | ||
run_alr("get", "unobtanium", "--dirname", complain_on_error=False).out) | ||
|
||
print('SUCCESS') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
driver: python-script | ||
indexes: | ||
toolchain_index: | ||
in_fixtures: true |