diff options
Diffstat (limited to 'setup.py')
-rw-r--r-- | setup.py | 24 |
1 files changed, 13 insertions, 11 deletions
@@ -140,6 +140,12 @@ CLASSIFIERS = ( 'Programming Language :: Python :: Implementation :: PyPy', ) +# Comments in reST begin with two dots. +LONG_DESCRIPTION_INTRO = """\ +.. Do not edit this file. This file is auto-generated for PyPI by setup.py +.. using pandoc, so edits should go in the source files rather than here. +""" + def read(path): """ @@ -178,21 +184,15 @@ def make_temp_path(path): return temp_path -def make_description_file(target_path): +def write_long_description(target_path): """ - Generate the long_description needed for setup.py. + Generate the long_description for setup(). The long description needs to be formatted as reStructuredText: http://docs.python.org/distutils/setupscript.html#additional-meta-data """ - # Comments in reST begin with two dots. - intro = """\ -.. This file is auto-generated by setup.py for PyPI using pandoc, so this -.. file should not be edited. Edits should go in the source files. -""" - readme_path = convert_md_to_rst(README_PATH) history_path = convert_md_to_rst(HISTORY_PATH) @@ -202,7 +202,8 @@ License """ + read(LICENSE_PATH) - sections = [intro, read(readme_path), read(history_path), license] + sections = [LONG_DESCRIPTION_INTRO, read(readme_path), read(history_path), + license] description = '\n'.join(sections) @@ -210,7 +211,7 @@ License def prep(): - make_description_file(DESCRIPTION_PATH) + write_long_description(DESCRIPTION_PATH) def publish(): """ @@ -218,7 +219,7 @@ def publish(): """ temp_path = make_temp_path(DESCRIPTION_PATH) - make_description_file(temp_path) + write_long_description(temp_path) if read(temp_path) != read(DESCRIPTION_PATH): print("""\ @@ -246,6 +247,7 @@ def convert_md_to_rst(path): Returns the new path. """ + # We write the converted files to temp files to simplify debugging. temp_path = make_temp_path(path) print("Converting: %s to %s" % (path, temp_path)) |