Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,6 @@ tcl

# Ignore Jupyter Notebook related temp files
.ipynb_checkpoints/

# Env Files
.env
7 changes: 2 additions & 5 deletions minecode/debutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#



def parse_email(text):
"""
Return a tuple of (name, email) extracted from a `text` string.
Expand All @@ -17,12 +16,10 @@ def parse_email(text):
if not text:
return None, None
name, _, email = text.partition('<')
email = email.strip('>')
name = name.strip()
email = email.strip()
if not email:
return name, email
email.strip('>')
return name, email
return name or None, email or None


def comma_separated(text):
Expand Down
5 changes: 3 additions & 2 deletions minecode/mappers/debian.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@
from minecode import map_router
from minecode.mappers import Mapper
from minecode.utils import form_vcs_url
# from minecode import debutils

from minecode import debutils

logger = logging.getLogger(__name__)
handler = logging.StreamHandler()
logger.addHandler(handler)
logger.setLevel(logging.INFO)


# FIXME: We are not returning download URLs. Returned information is incorrect


Expand Down Expand Up @@ -346,6 +346,7 @@ def parse_packages(metadata, purl=None):
package.set_purl(purl)
yield package


#################################################################################
# FIXME: this cannot work since we do not fetch these yet AND what are the zip jar and gz in this???
#################################################################################
Expand Down
13 changes: 10 additions & 3 deletions minecode/tests/test_debian.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,22 +102,29 @@ def test_parse_deb822_dsc(self):
result = debcon.get_paragraph_data_from_file(dsc_file)
expected_loc = self.get_test_loc('debian/debutils/3dldf_2.0.3+dfsg-2.dsc-expected')
self.check_expected_deb822(result, expected_loc, regen=False)

#################################################################

@expectedFailure
def test_parse_email(self):
content = 'Debian TeX Maintainers <debian-tex-maint@lists.debian.org>'
name, email = debutils.parse_email(content)
self.assertEquals('Debian TeX Maintainers', name)
self.assertEquals('debian-tex-maint@lists.debian.org', email)

@expectedFailure
def test_parse_email_2(self):
content = 'Debian TeX Maintainers '
# Space left Purposefully
content = ' Debian TeX Maintainers '
name, email = debutils.parse_email(content)
self.assertEquals('Debian TeX Maintainers', name)
self.assertEquals(None, email)

def test_parse_email_3(self):
# Space left Purposefully
content = '< debian-tex-maint@lists.debian.org >'
name, email = debutils.parse_email(content)
self.assertEquals(None, name)
self.assertEquals("debian-tex-maint@lists.debian.org", email)

def test_comma_separated(self):
tags = 'implemented-in::perl, role::program, use::converting, works-with::pim'
result = list(debutils.comma_separated(tags))
Expand Down