Skip to content
This repository has been archived by the owner on Jan 12, 2021. It is now read-only.

Getting author name from from and project #108

Merged
merged 5 commits into from May 21, 2019

Conversation

nandahkrishna
Copy link
Contributor

Fix for issue #107 - getting the author name in generate license from from and project config files.

Please do review this and suggest changes as there may be errors. Thanks!

@nandahkrishna
Copy link
Contributor Author

nandahkrishna commented May 20, 2019

Ah well, guess there's some problem as the test fails. I'll check it.
Edit: There seems to be no key named 'from' in self.config which throws the error in test. I'm not exactly able to get a solution to this, though.

@orsinium
Copy link
Member

Yeah, that's right. 'from' is missed if there is no project config. Do # get author from from only if 'from' in self.config :)

@orsinium
Copy link
Member

orsinium commented May 20, 2019

You can do less operations if chain ways to get author:

author = self.config.get('owner')
if not author and 'from' in self.config:
  ...
if not author:
  authors = PackageRoot(self.config['project']).metainfo.authors
  if authors:
    author = authors[0]
if not author:
  author = getuser().title()

...

@nandahkrishna
Copy link
Contributor Author

Yes, I'll get this done. Thanks!

@nandahkrishna
Copy link
Contributor Author

nandahkrishna commented May 20, 2019

The changes have been made with this commit.
Just one clarification though - if the project configuration file has > 1 author, we select only the first as author = authors[0]; however in getting the author from from, we have author = root.authors. Would this pose a problem or inconsistency?

Edit: Test fails because self.config['project'] is str and not Path, I'll change it.

@orsinium
Copy link
Member

In "from" case we also have to get the first author. I'm not sure about licensing rules, but usually owner is only one person.

Everything looks really good. Fix this case and check what Travis says, and I'll merge it :)

@nandahkrishna
Copy link
Contributor Author

nandahkrishna commented May 20, 2019

Travis is showing an error in the test again, now with respect to the metainfo. It shows an IndexError when the metainfo is being accessed. I tried to search for a place where metainfo is obtained by this, but I could not find any (probably missed my eye).

Screenshot:
Err

@orsinium
Copy link
Member

Oh, my bad. I'll patch it

nandahkrishna and others added 2 commits May 21, 2019 01:57
We use package metainfo here to get authors from it
@orsinium orsinium merged commit 0ff39be into dephell:master May 21, 2019
@orsinium
Copy link
Member

Done. Thank you for your contribution :)

@nandahkrishna nandahkrishna deleted the fix-issue-107 branch May 21, 2019 17:28
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants