diff options
author | Chris Jerdonek <chris.jerdonek@gmail.com> | 2012-09-22 20:08:17 -0700 |
---|---|---|
committer | Chris Jerdonek <chris.jerdonek@gmail.com> | 2012-09-22 20:08:17 -0700 |
commit | 85b1cdc94d1d78723d7ded8c128b4b521e56df90 (patch) | |
tree | 943af9a80c73240cb0ac69481b525793ca75459a /setup.py | |
parent | 4360bf23d6bd35856ae8d0201dc7891fafc928f4 (diff) | |
download | pystache-85b1cdc94d1d78723d7ded8c128b4b521e56df90.tar.gz |
Move convert_md_to_rst() function.
Diffstat (limited to 'setup.py')
-rw-r--r-- | setup.py | 52 |
1 files changed, 26 insertions, 26 deletions
@@ -184,6 +184,32 @@ def make_temp_path(path): return temp_path +def convert_md_to_rst(path): + """ + Convert the given file from markdown to reStructuredText. + + 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)) + + if os.path.exists(temp_path): + os.remove(temp_path) + + # Pandoc uses the UTF-8 character encoding for both input and output. + command = "pandoc --write=rst --output=%s %s" % (temp_path, path) + os.system(command) + + if not os.path.exists(temp_path): + s = ("Error running: %s\n" + " Did you install pandoc per the %s docstring?" % (command, __file__)) + sys.exit(s) + + return temp_path + + def write_long_description(target_path): """ Generate the long_description for setup(). @@ -240,32 +266,6 @@ Run the following command and commit the changes-- os.system('python setup.py sdist upload') -def convert_md_to_rst(path): - """ - Convert the given file from markdown to reStructuredText. - - 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)) - - if os.path.exists(temp_path): - os.remove(temp_path) - - # Pandoc uses the UTF-8 character encoding for both input and output. - command = "pandoc --write=rst --output=%s %s" % (temp_path, path) - os.system(command) - - if not os.path.exists(temp_path): - s = ("Error running: %s\n" - " Did you install pandoc per the %s docstring?" % (command, __file__)) - sys.exit(s) - - return temp_path - - # We use the package simplejson for older Python versions since Python # does not contain the module json before 2.6: # |