chiark / gitweb /
include README.rst in official release source tarball
[fdroidserver.git] / setup.py
index 15544732e01a20f1f29cc71093a4ca5cf09be4b4..4a68053674044a2989855d7c33c9372f9fab1c4d 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -12,15 +12,20 @@ else:
     data_prefix = '.'
 
 # PyPI accepts reST not Markdown
-if shutil.which('pandoc'):
-    print('Using reST README')
-    import subprocess
-    readme = subprocess.check_output(['pandoc', '--from=markdown', '--to=rst', 'README.md'],
-                                     universal_newlines=True)
+if os.path.exists('README.md'):
+    if shutil.which('pandoc'):
+        print('Using reST README')
+        import subprocess
+        subprocess.check_call(['pandoc', '--from=markdown', '--to=rst', 'README.md',
+                               '--output=README.rst'], universal_newlines=True)
+        with open('README.rst') as fp:
+            readme = fp.read()
+    else:
+        print('Using Markdown README')
+        with open('README.md') as fp:
+            readme = fp.read()
 else:
-    print('Using Markdown README')
-    with open('README.md') as fp:
-        readme = fp.read()
+    readme = ''
 
 setup(name='fdroidserver',
       version='0.8',