Changeset View
Changeset View
Standalone View
Standalone View
swh/indexer/metadata_dictionary.py
Show First 20 Lines • Show All 528 Lines • ▼ Show 20 Lines | def normalize_license(self, licenses): | ||||
return [{'@id': license} for license in licenses] | return [{'@id': license} for license in licenses] | ||||
@register_mapping | @register_mapping | ||||
class GemspecMapping(DictMapping): | class GemspecMapping(DictMapping): | ||||
name = 'gemspec' | name = 'gemspec' | ||||
mapping = CROSSWALK_TABLE['Ruby Gem'] | mapping = CROSSWALK_TABLE['Ruby Gem'] | ||||
_re_spec_new = re.compile(r'.*Gem::Specification.new do \|.*\|.*') | _re_spec_new = re.compile(r'.*Gem::Specification.new +(do|\{) +\|.*\|.*') | ||||
_re_spec_entry = re.compile(r'\s*\w+\.(?P<key>\w+)\s*=\s*(?P<expr>.*)') | _re_spec_entry = re.compile(r'\s*\w+\.(?P<key>\w+)\s*=\s*(?P<expr>.*)') | ||||
@classmethod | @classmethod | ||||
def detect_metadata_files(cls, file_entries): | def detect_metadata_files(cls, file_entries): | ||||
for entry in file_entries: | for entry in file_entries: | ||||
if entry['name'].endswith(b'.gemspec'): | if entry['name'].endswith(b'.gemspec'): | ||||
return [entry['sha1']] | return [entry['sha1']] | ||||
return [] | return [] | ||||
▲ Show 20 Lines • Show All 90 Lines • Show Last 20 Lines |