Allow `MathCATRulesDir` to override the rules directory without code changes
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 72/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- rust
- Domain
- build-system, cli
Research direction
Start by reading the rules-directory setup in src/main.rs and tests/common/mod.rs, then inspect how MathCATRulesDir is currently used. Run the test suite with a custom MathCATRulesDir path. Done means the environment variable can provide the rules directory without patching those files, and the installed mathcat binary uses the configured path.
Written by the indexing model from the issue text.
Description
Originally posted by @theCapypara in #749
No, just adding the Cargo.lock is enough for us in that regard. Just tested your PR, builds fine! Thanks!
I just noticed Orca actually vendors MathCAT itself and provides its own Cargo.lock we can use. While I'll use that for Orca, I'll probably still package MathCAT for NixOS as a standalone package, because why not :).
The only other somewhat annoying thing for that is the way that the path to the rules directory is currently somewhat hardcoded and the
MathCATRulesDirenv variable only being read when a code change is made.For various reasons we need to provide a custom path to MathCAT.
This requires us to do these patches to make it work:
{ postPatch = '' substituteInPlace src/main.rs \ --replace-fail 'set_rules_dir(get_rules_dir())' 'set_rules_dir("".to_string())' substituteInPlace tests/common/mod.rs \ --replace-fail 'set_rules_dir(abs_rules_dir_path())' 'set_rules_dir("".to_string())' ''; preCheck = '' export MathCATRulesDir="$src/Rules" ''; postInstall = '' install -dm755 "$out/rules" cp -a ./Rules "$out/rules" wrapProgram $out/bin/mathcat --set MathCATRulesDir "$out/rules" ''; }
- The "postPatch" section here replaces
set_rules_dir(get_rules_dir())withset_rules_dir("".to_string())(and does the same for the tests)- In "preCheck" we make sure the tests see the rules
- In "postInstall" we install the rules and make sure the final mathcat binary actually sees them
Ideally for us, the "postPatch" section would not be needed.
Originally posted by @theCapypara in #749
- Dominant language
- Rust
- Stars
- 114
- Forks
- 85
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 76
Getting set up
We have not checked this project's setup files yet. Start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from daisy/MathCAT
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
Maintainers usually reply within 1 day
-
bug rules
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
discussion
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Maintainers usually reply within 1 day
-
discussion translation
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
daisy/MathCAT#675 · 1 comment ·
Maintainers usually reply within 1 day
-
feature request for vector from O to APossibly taken @moritz-gross claimed this 10 days ago. Openenhancement good first issue rules rust
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
daisy/MathCAT#621 · 1 comment · 1 assignee ·
Maintainers usually reply within 1 day
Similar issues
-
type/bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
stackabletech/kafka-operator#1033 · 1 comment ·
Maintainers usually reply within 1 day
-
bug good first issue needs testing
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 3 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
farion1231/cc-switch#7744 · 1 comment ·
Maintainers usually reply within 1 day
-
datafusion
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
apache/iceberg-rust#3297 ·
Maintainers usually reply within 1 day