Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow dependency names that start with a number (+ parsing regex cleanup) #358

Conversation

primeos-work
Copy link
Member

This supports dependencies where the package name starts with a digit and tries to simplify the regex a bit by dropping unnecessary syntax.

It was possible to declare and build packages where the package name
starts with a digit but it wasn't possible to declare them as
dependencies of another package.
This fixes science-computing#356 and I'm also adding a test for it to avoid regressions.

Now we could package `0ad`, `389-ds`, `6tunnel`, `7z`, `9pfs`, etc. \o/

Signed-off-by: Michael Weiss <michael.weiss@eviden.com>
Let's avoid copy-pasted code :)
Using assertion macros in helper functions isn't ideal but the error
messages should contain enough context to figure out what went wrong.

Signed-off-by: Michael Weiss <michael.weiss@eviden.com>
To avoid potentially unintended regressions when changing the regex.

Signed-off-by: Michael Weiss <michael.weiss@eviden.com>
The parentheses aren't required here.
They can still help with readability but in this case it might be better
without them (the square brackets should be sufficient for a quick
orientation) so I'll drop them.

Signed-off-by: Michael Weiss <michael.weiss@eviden.com>
"Any named character class may appear inside a bracketed [...] character
class. For example, [\p{Greek}[:digit:]]" [0]

[0]: https://docs.rs/regex/1.10.3/regex/index.html#character-classes

Signed-off-by: Michael Weiss <michael.weiss@eviden.com>
The escaping shouldn't be required for "." and "*" inside a bracketed
character class (`[...]`) and we can avoid it for "-" if we place it at
the beginning or the end of the bracketed character class. The escaping
was also a bit confusing as "\" had to be escaped with another backslash
as it's a Rust string (raw strings would be better in this case).

Signed-off-by: Michael Weiss <michael.weiss@eviden.com>
The last three `dep_parse_expect_err()` examples match the regex but
aren't supported by the version parsing yet (`a *` would also match the
regex with an `[:alnum:]` at the end).

Signed-off-by: Michael Weiss <michael.weiss@eviden.com>
@primeos-work primeos-work force-pushed the dependency-parsing-regex-fix-and-cleanup branch from 03f950f to b11c677 Compare March 6, 2024 10:00
@primeos-work primeos-work linked an issue Mar 6, 2024 that may be closed by this pull request
@christophprokop
Copy link
Contributor

Great!
Tested and has expected behaviour now :)
Thank you! <3

@christophprokop christophprokop added this pull request to the merge queue Mar 6, 2024
Merged via the queue into science-computing:master with commit c0c0537 Mar 6, 2024
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

error on dependency names startint with numerals
2 participants