Skip to content

Commit df47ce1

Browse files
committed
Fix issue #2
1 parent 9534e2d commit df47ce1

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

setup.py

+14-10
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,11 @@
22
# coding=utf-8
33

44
import sys
5-
6-
try:
7-
import pypandoc
8-
except ImportError:
9-
print "The \"pypandoc\" package and the pandoc binary on your system " \
10-
"need to be present to run setuptools."
11-
sys.exit(1)
12-
13-
145
from setuptools import setup
156
from gitver.version import gitver_version, gitver_pypi
167

8+
make_sdist = len({'sdist', 'build'} & set(sys.argv)) > 0
9+
1710
try:
1811
import gitver._version_next as next
1912
vtype = '(NEXT)'
@@ -22,7 +15,18 @@
2215

2316

2417
def readme():
25-
return pypandoc.convert('README.md', 'rst')
18+
if make_sdist:
19+
try:
20+
import pypandoc
21+
return pypandoc.convert('README.md', 'rst')
22+
except ImportError:
23+
print "Warning: the \"pypandoc\" package and/or the pandoc " \
24+
"binary can't be found on your system: if you want to " \
25+
"generate the README.rst for PyPI you'll need to install " \
26+
"them properly, else a fallback description will be used."
27+
28+
# falling back to a simple description
29+
return 'Simple version string management for git'
2630

2731

2832
def requirements():

0 commit comments

Comments
 (0)