コード例 #1
0
ファイル: model.py プロジェクト: coryb/setupmeta
 def auto_fill_long_description(self):
     """ Auto-fille descriptions from README file """
     docstring_lead = self.definitions.pop('docstring_lead', None)
     if docstring_lead and not self.value('description'):
         self.auto_fill('description',
                        docstring_lead.value,
                        source=docstring_lead.source)
     for readme in resolved_paths(READMES):
         if self.value('long_description') and self.value('description'):
             return
         value = load_readme(readme)
         if not value:
             continue
         short_desc = self.extract_short_description(value)
         if not short_desc:
             continue
         self.auto_fill('description', short_desc, source="%s:1" % readme)
         self.add_definition('long_description',
                             value,
                             readme,
                             override=short_desc)
         if readme.endswith(".rst"):
             content_type = "text/x-rst"
         elif readme.endswith(".md"):
             content_type = "text/markdown"
         else:
             content_type = None
         if content_type:
             self.add_definition("long_description_content_type",
                                 content_type,
                                 readme,
                                 override=short_desc)
コード例 #2
0
 def auto_fill_long_description(self):
     """ Auto-fille descriptions from README file """
     docstring_lead = self.definitions.pop("docstring_lead", None)
     if docstring_lead and not self.value("description"):
         self.auto_fill("description",
                        docstring_lead.value,
                        source=docstring_lead.source)
     best_content_type = None
     best_readme = None
     best_long = None
     for readme in resolved_paths(READMES):
         value = load_readme(readme)
         if not value:
             continue
         short_desc = self.extract_short_description(value)
         if not best_long or len(best_long) < 512 <= len(value):
             # The best README is the 1st one found
             best_content_type = content_type_from_filename(readme)
             best_readme = readme
             best_long = value
         if short_desc:
             self.auto_fill("description",
                            short_desc,
                            source="%s:1" % readme)
             break
     self.add_definition("long_description", best_long, best_readme)
     self.add_definition("long_description_content_type", best_content_type,
                         best_readme)
コード例 #3
0
 def auto_fill_long_description(self):
     """ Auto-fille descriptions from README file """
     docstring_lead = self.definitions.pop('docstring_lead', None)
     if docstring_lead and not self.value('description'):
         self.auto_fill('description',
                        docstring_lead.value,
                        source=docstring_lead.source)
     for readme in resolved_paths(READMES):
         if self.value('long_description') and self.value('description'):
             return
         value = load_readme(readme)
         if value:
             short_desc = self.extract_short_description(value)
             self.auto_fill('description',
                            short_desc,
                            source="%s:1" % readme)
             self.add_definition('long_description',
                                 value,
                                 readme,
                                 override=short_desc)