How to use the pypandoc.download_pandoc function in pypandoc

To help you get started, we’ve selected a few pypandoc examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github fossasia / yaydoc / modules / scripts / md2rst.py View on Github external
def download_pandoc():
    """Download pandoc if not already installed"""
    try:
        # Check whether it is already installed
        pypandoc.get_pandoc_version()
    except OSError:
        # Pandoc not installed. Let's download it silently.
        with open(os.devnull, 'w') as devnull:
            sys.stdout = devnull
            pypandoc.download_pandoc()
            sys.stdout = sys.__stdout__

        # Hack to delete the downloaded file from the folder,
        # otherwise it could get accidently committed to the repo
        # by other scripts in the repo.
        pf = sys.platform
        if pf.startswith('linux'):
            pf = 'linux'
        url = pypandoc.pandoc_download._get_pandoc_urls()[0][pf]
        filename = url.split('/')[-1]
        os.remove(filename)
github burgerbecky / makeprojects / docs / build_rules.py View on Github external
# Get the input and output file names
    source = os.path.join(os.path.dirname(working_directory), 'README.rst')
    dest = os.path.join(temp_dir, 'README.html')

    # Was the file already created and newer than the source?
    if burger.is_source_newer(source, dest):

        # Load pandoc if needed to do the conversion
        if hasattr(pypandoc, 'ensure_pandoc_installed'):
            # pylint: disable=E1101
            pypandoc.ensure_pandoc_installed(quiet=True, delete_installer=True)
        else:
            try:
                pypandoc.get_pandoc_path()
            except OSError:
                pypandoc.download_pandoc()
        pypandoc.convert_file(source, to='html', outputfile=dest)
    return 0
github hpi-xnor / BMXNet-v2 / tools / pip / setup.py View on Github external
package_name = 'mxnet'

variant = os.environ['mxnet_variant'].upper()
if variant != 'CPU':
    package_name = 'mxnet_{0}'.format(variant.lower())

with open('doc/PYPI_README.md') as readme_file:
    long_description = readme_file.read()

with open('doc/{0}_ADDITIONAL.md'.format(variant)) as variant_doc:
    long_description = long_description + variant_doc.read()

# pypi only supports rst, so use pandoc to convert
import pypandoc
if platform.system() == 'Darwin':
    pypandoc.download_pandoc()
long_description = pypandoc.convert_text(long_description, 'rst', 'md')
short_description = 'MXNet is an ultra-scalable deep learning framework.'
libraries = []
if variant == 'CPU':
    libraries.append('openblas')
else:
    if variant.startswith('CU100'):
        libraries.append('CUDA-10.0')
    elif variant.startswith('CU92'):
        libraries.append('CUDA-9.2')
    elif variant.startswith('CU91'):
        libraries.append('CUDA-9.1')
    elif variant.startswith('CU90'):
        libraries.append('CUDA-9.0')
    elif variant.startswith('CU80'):
        libraries.append('CUDA-8.0')
github ddorn / GUI / setup.py View on Github external
from setuptools import setup, find_packages

# To use a consistent encoding
from os import path

here = path.abspath(path.dirname(__file__))

# Get the long description from the README file
# I really prefer Markdown to reStructuredText.  PyPi does not.  This allows me
# to have things how I'd like, but not throw complaints when people are trying
# to install the package and they don't have pypandoc or the README in the
# right place.
try:
    import pypandoc

    pypandoc.download_pandoc()
    print(os.curdir)
    print(here)
    print(os.listdir(os.curdir))
    try:
        long_description = pypandoc.convert('README.md', 'rst')
    except RuntimeError:
        try:
            long_description = pypandoc.convert('readme.md', "rst")
        except RuntimeError:
            long_description = ''
            print('FUCK THE DESCRIPTION')
except (IOError, ImportError):
    long_description = ''

setup(
    name='PygameGUILib',