Skip to content

Commit

Permalink
Reorganize setup.py
Browse files Browse the repository at this point in the history
  • Loading branch information
jalan committed Oct 17, 2019
1 parent 600d234 commit 0cc9bc1
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os
import platform
import subprocess
import sys
from os import getenv, path
from setuptools import Extension
from setuptools import setup

Expand All @@ -21,24 +21,27 @@ def poppler_cpp_at_least(version):

include_dirs = None
library_dirs = None

# On some BSDs, poppler is in /usr/local, which is not searched by default
if platform.system() in ["Darwin", "FreeBSD", "OpenBSD"]:
# On some BSDs, poppler is in /usr/local, which is not searched by default
include_dirs = ["/usr/local/include"]
library_dirs = ["/usr/local/lib"]
elif platform.system() in ["Windows"]:
conda_prefix = getenv("CONDA_PREFIX")

# On Windows, only building with conda is supported so far
if platform.system() == "Windows":
conda_prefix = os.getenv("CONDA_PREFIX")
if conda_prefix is not None:
include_dirs = [path.join(conda_prefix, "Library\include")]
library_dirs = [path.join(conda_prefix, "Library\lib")]
include_dirs = [os.path.join(conda_prefix, "Library\include")]
library_dirs = [os.path.join(conda_prefix, "Library\lib")]

macros = [("POPPLER_CPP_AT_LEAST_0_30_0", int(poppler_cpp_at_least("0.30.0")))]
extra_compile_args = ["-Wall"]

# On macOS, some distributions of python build extensions for 10.6 by default,
# but poppler uses C++11 features that require at least 10.9
if platform.system() == "Darwin":
extra_compile_args = ["-Wall", "-mmacosx-version-min=10.9"]
else:
extra_compile_args = ["-Wall"]
extra_compile_args += ["-mmacosx-version-min=10.9"]

macros = [("POPPLER_CPP_AT_LEAST_0_30_0", int(poppler_cpp_at_least("0.30.0")))]

module = Extension(
"pdftotext",
Expand Down

0 comments on commit 0cc9bc1

Please sign in to comment.