File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change 11import os
22import contextlib
33import pathlib
4+ import shutil
45from setuptools import setup , find_packages
56
6- import pandoc
7+ has_pandoc = True
8+ try :
9+ import pandoc
10+ except ImportError :
11+ has_pandoc = False
712
813import metafunctions
914
@@ -17,10 +22,13 @@ def md_to_rst(dir_):
1722 dir_ = pathlib .Path (dir_ )
1823 rstfiles = []
1924 for mdfile in dir_ .glob ('*.md' ):
20- doc = pandoc .Document ()
21- doc .markdown = mdfile .read_bytes ()
2225 rstfile = mdfile .with_suffix ('.rst' )
23- rstfile .write_bytes (doc .rst )
26+ if has_pandoc :
27+ doc = pandoc .Document ()
28+ doc .markdown = mdfile .read_bytes ()
29+ rstfile .write_bytes (doc .rst )
30+ else :
31+ shutil .copy (mdfile , rstfile )
2432 rstfiles .append (rstfile )
2533
2634 yield rstfiles
You can’t perform that action at this time.
0 commit comments