Skip to content

Commit

Permalink
Make README work on PyPI.
Browse files Browse the repository at this point in the history
  • Loading branch information
quantum5 committed Dec 2, 2017
1 parent 5e9f721 commit deec6f5
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,4 @@ dmoj/cptbox/_cptbox.cpp
java_sandbox/objs/

env*/
README.rst
20 changes: 18 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# encoding: utf-8
from __future__ import print_function

import os
Expand All @@ -8,8 +9,8 @@
sys.exit(0)

import traceback
import subprocess
from distutils.errors import DistutilsPlatformError

from distutils.msvccompiler import MSVCCompiler

from setuptools import setup, Extension, find_packages
Expand Down Expand Up @@ -97,9 +98,23 @@ def unavailable(self, e):
extensions += [Extension('dmoj.cptbox._cptbox', sources=cptbox_sources,
language='c++', libraries=libs, define_macros=macros)]

rst_path = os.path.join(os.path.dirname(__file__), 'README.rst')

if 'sdist' in sys.argv:
readme = subprocess.check_output("pandoc -f markdown_github README.md -t html | sed -e 's/❌/X/g' | "
'pandoc -f html -t rst --columns=300', shell=True)
with open(rst_path, 'w') as f:
f.write(readme)
else:
try:
with open(rst_path) as f:
readme = f.read()
except IOError:
readme = None

setup(
name='dmoj',
version='1.0.0',
version='1.0.4',
packages=find_packages(),
package_data={
'dmoj.cptbox': ['syscalls/aliases.list', 'syscalls/*.tbl'],
Expand All @@ -124,6 +139,7 @@ def unavailable(self, e):
author_email='[email protected]',
url='https://github.com/DMOJ/judge',
description='The judge component of the DMOJ: Modern Online Judge platform',
long_description=readme,
keywords='online-judge',
classifiers=[
'Development Status :: 4 - Beta',
Expand Down

0 comments on commit deec6f5

Please sign in to comment.