forked from alire-project/alire
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: ability to pin a crate that 'provides' a dependency (alire-proje…
…ct#1771) * Fix: consider 'provides' during pinning * Test * Fix unwanted edition in alire-roots.adb
- Loading branch information
Showing
4 changed files
with
58 additions
and
1 deletion.
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,40 @@ | ||
""" | ||
Verify that we can link-pin a crate that has "provides" in a variety of ways. | ||
""" | ||
|
||
import os | ||
from drivers.alr import run_alr, init_local_crate, alr_manifest | ||
from drivers.asserts import assert_eq, assert_match, match_solution | ||
|
||
# Create the target crate | ||
init_local_crate(name="mylib") | ||
# Update its manifest | ||
with open(alr_manifest(), "a") as f: | ||
f.write('provides=["coollib=1.0.0"]') | ||
os.chdir("..") | ||
|
||
tests = [ | ||
["with", "--use=../mylib"], | ||
["with", "coollib", "--use=../mylib"], | ||
] | ||
|
||
matches = [ | ||
"mylib=0.1.0-dev (pinned) (origin: ../mylib)", | ||
"coollib=0.1.0-dev (mylib) (pinned) (origin: ../mylib)" | ||
] | ||
|
||
for target, test, id in zip(matches, tests, range(len(tests))): | ||
# Create a new dependent crate | ||
init_local_crate(f"myapp{id}") | ||
run_alr(*test) | ||
match_solution(target, escape=True) | ||
os.chdir("..") | ||
|
||
# For the final test we need an extra step to force-add the dependency before | ||
# pinning. | ||
init_local_crate("myapp_final") | ||
run_alr("--force", "with", "coollib") # Force because not in index | ||
run_alr("pin", "coollib", "--use=../mylib") | ||
match_solution(matches[-1], escape=True) | ||
|
||
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 | ||
build_mode: both | ||
indexes: | ||
compiler_only_index: {} |