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

Parse a Pom from a plain pom file path #4

Closed
pombredanne opened this issue Mar 9, 2017 · 1 comment · Fixed by #13
Closed

Parse a Pom from a plain pom file path #4

pombredanne opened this issue Mar 9, 2017 · 1 comment · Fixed by #13

Comments

@pombredanne
Copy link
Contributor

The constructor of Pom is restricted because it assumes that I must know "coordinates" ahead of time

def __init__(self, coordinate, client):

And that I have effectively some repo that handles the retrieval. In my usecase for ScanCode as a possible replacement of this https://github.com/nexB/scancode-toolkit/blob/develop/src/packagedcode/maven.py I need to be able to parse a POM from some file path and nothing else. I do not have a "repo" nor do I know the "coordinates" yet: the whole purpose of parsing for me is to discover these....

So I am left with this alternative:

  1. beef up pymaven with extra effort to find a way to keep your initial use case assumptions. But I do not know enough about this.
  2. fork and add my features: along the way I would likely be breaking your assumptions and support for your use case.

I hate 2. but I cannot see a way around this? @wfscheper what do you think?

@wfscheper
Copy link
Contributor

wfscheper commented Jun 7, 2017

Thought I responded to this back when you first opened the ticket, but something must of eaten my comment.

I'm working to add two classmethods, Pom.fromstring() and Pom.parse(). They're modeled on the lxml.etree functions of the same name. The client will be optional and we'll just forgo all of the dynamic loading of external POMs data.

I'm up in the air about whether to still require the maven coordinates. Currently those are used to set the groupId, artifactId and version without needing to parse the POM data first. Not sure how useful that is if you're working without a repository client.

wfscheper added a commit to wfscheper/pymaven that referenced this issue Jun 7, 2017
Adds the classmethods Pom.fromstring and Pom.parse. These are modeled on
the lxml.etree functions of the same name. If a MavenClient is passed
in, then the resulting Pom object will attempt to dynamically load
data from external POM files available via the client.

Sem-Ver: feature
Fixes: sassoftware#4
pombredanne added a commit to aboutcode-org/pymaven that referenced this issue Jun 9, 2017
 * this allow subclasses working without clients to override the
   _get_pom_factory method and return plain artifacts from coordinates
   rather than full Pom objects when there is no client to retrieve an
   artifact remotely.

Link: sassoftware#3
Link: sassoftware#4

Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
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 a pull request may close this issue.

2 participants