add File.project_path property
Provide a quick way to get a short but unique name to a file.
This commit is contained in:
parent
8c41c9516a
commit
2e4c6cb74a
|
@ -25,6 +25,10 @@ class File(Base):
|
|||
backref='file',
|
||||
cascade="all, delete, delete-orphan")
|
||||
|
||||
@property
|
||||
def project_path(self):
|
||||
return '%s/%s' % (self.project.name, self.name)
|
||||
|
||||
|
||||
class Line(Base):
|
||||
__tablename__ = 'line'
|
||||
|
|
|
@ -13,13 +13,14 @@ class RequirementsHandler(base.FileHandler):
|
|||
INTERESTING_PATTERNS = ['*requirements*.txt']
|
||||
|
||||
def process_file(self, session, file_obj):
|
||||
LOG.info('loading requirements from %s', file_obj.path)
|
||||
LOG.info('loading requirements from %s', file_obj.project_path)
|
||||
parent_project = file_obj.project
|
||||
for line in file_obj.lines:
|
||||
text = line.content.strip()
|
||||
if not text or text.startswith('#'):
|
||||
continue
|
||||
try:
|
||||
# FIXME(dhellmann): Use pbr's requirements parser.
|
||||
dist_name = pkg_resources.Requirement.parse(text).project_name
|
||||
except ValueError:
|
||||
LOG.warn('could not parse dist name from %r',
|
||||
|
|
Loading…
Reference in New Issue