How to use the pypandoc.pandoc_download._make_executable 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 databricks / koalas / dev / gendoc.py View on Github external
try:
            os.chdir(tempfolder)
            cmd = ["ar", "x", filename]
            # if only 3.5 is supported, should be `run(..., check=True)`
            subprocess.check_call(cmd)
            files = os.listdir(".")
            archive_name = next(x for x in files if x.startswith('data.tar'))
            cmd = ["tar", "xf", archive_name]
            subprocess.check_call(cmd)
            # pandoc and pandoc-citeproc are in ./usr/bin subfolder
            for exe in ["pandoc", "pandoc-citeproc"]:
                src = os.path.join(tempfolder, "usr", "bin", exe)
                dst = os.path.join(targetfolder, exe)
                print("* Copying %s to %s ..." % (exe, targetfolder))
                shutil.copyfile(src, dst)
                pandoc_download._make_executable(dst)
            src = os.path.join(tempfolder, "usr", "share", "doc", "pandoc", "copyright")
            dst = os.path.join(targetfolder, "copyright.pandoc")
            print("* Copying copyright to %s ..." % (targetfolder))
            shutil.copyfile(src, dst)
        finally:
            os.chdir(cur_wd)
            shutil.rmtree(tempfolder)