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

[WIP] Add type for requirement #10

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

davidanthoff
Copy link

I had this kind of code lying around in a branch over at Query.jl, but makes much more sense to integrate the delta here.

I'll probably add an example to Query.jl that shows how one can query the package database in combination with MetadataTools.

@tkelman
Copy link
Contributor

tkelman commented Apr 21, 2017

I'm actually not sure why this package doesn't use the types from Pkg.Reqs directly. It is actually supported to have version ranges in REQUIRE that are unions of ranges with multiple components, though no currently tagged version in metadata has done so yet.

@davidanthoff davidanthoff changed the title Add type for requirement [WIP] Add type for requirement Apr 21, 2017
@davidanthoff
Copy link
Author

Ah, cool. I changed it to now use the types from Pkg.Reqs. There is one line where I'm not sure what to do, any help would be appreciated.

julia_max_ver = convert(VersionNumber,s[3])
req.name!="julia" && continue
isnull(req.upper_bound) && continue
julia_max_ver = get(req.upper_bound)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tkelman This is incorrect, but I'm not entirely sure what the right thing to do here is...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like the Requirement type has a versions field that's a VersionSet type. VersionSet has an intervals field which is a vector of VersionIntervals. If the vector isn't length 1, the code in this package probably won't handle it correctly. The first element of the array will have a lower and upper field.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I've pushed something that handles the case with one interval and throws an error otherwise. Probably more robust than the old code, that might or might not have thrown an error.

@davidanthoff
Copy link
Author

Once this is merged and tagged I'll merge queryverse/Query.jl#110, that shows how one can use Query with the stuff returned from MetadataTools.

@davidanthoff
Copy link
Author

I think I got things right, but a review of the changes especially to get_upper_limit would be good to make sure it still does what it is meant to do.

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.

2 participants