Skip to content

Commit

Permalink
Make the email address for authors optional
Browse files Browse the repository at this point in the history
  • Loading branch information
sdispater committed May 2, 2018
1 parent 70c324b commit 5b14bd1
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
- Dependency resolution caches now use sha256 hashes.
- Changed CLI error style.
- Improved debugging of dependency resolution.
- Made the email address for authors optional.

### Fixed

Expand Down
2 changes: 1 addition & 1 deletion poetry/packages/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from .file_dependency import FileDependency
from .vcs_dependency import VCSDependency

AUTHOR_REGEX = re.compile('(?u)^(?P<name>[- .,\w\d\'’"()]+) <(?P<email>.+?)>$')
AUTHOR_REGEX = re.compile('(?u)^(?P<name>[- .,\w\d\'’"()]+)(?: <(?P<email>.+?)>)?$')


class Package(object):
Expand Down
16 changes: 16 additions & 0 deletions tests/packages/test_package.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from poetry.packages import Package


def test_package_authors():
package = Package('foo', '0.1.0')

package.authors.append('Sébastien Eustace <[email protected]>')
assert package.author_name == 'Sébastien Eustace'
assert package.author_email == '[email protected]'

package.authors.insert(0, 'John Doe')
assert package.author_name == 'John Doe'
assert package.author_email is None

0 comments on commit 5b14bd1

Please sign in to comment.