Skip to content

Commit 1f5b2a6

Browse files
committed
change the pandoc download logic
1 parent c492a46 commit 1f5b2a6

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

setup.py

+7-9
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,17 @@
77

88
long_description = ""
99

10-
try:
11-
long_description = pypandoc.convert('README.md', 'rst')
12-
except OSError as e:
13-
print("Pypandoc import failed, trying to download pancdoc...")
14-
pypandoc.download_pandoc()
15-
16-
print("Trying to convert again...")
10+
print("Trying to download pandoc...")
11+
pypandoc.download_pandoc()
1712

1813
try:
1914
long_description = pypandoc.convert('README.md', 'rst')
2015
except OSError as e:
21-
print("Readme conversion failed.")
22-
sys.exit(1)
16+
print("Pandoc not found.")
17+
import io
18+
# pandoc is not installed, fallback to using raw contents
19+
with io.open('README.md', encoding="utf-8") as f:
20+
long_description = f.read()
2321

2422
# cv_version.py should be generated by running find_version.py
2523
from cv_version import opencv_version

0 commit comments

Comments
 (0)