summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIsaac Jurado <diptongo@gmail.com>2021-05-19 09:50:53 +0200
committerGitHub <noreply@github.com>2021-05-19 09:50:53 +0200
commitc9cf865d2e5f4ea4952d0ea6d4e0e2e2120649b7 (patch)
tree75f4d3d91c4bfde81ac5916cde1d5fb1135a2c8f
parent450487092251816b4252a0e8694bf50abb1d4046 (diff)
downloadpython-lxml-c9cf865d2e5f4ea4952d0ea6d4e0e2e2120649b7.tar.gz
Allow passing STATIC_* setup variables from the environment. (GH-314)
For very customized static builds of lxml, the only way to succeed is by patching the setup.py file. This change makes it a little more convenient to make static builds directly from the pip command line.
-rw-r--r--setup.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/setup.py b/setup.py
index 845c0d9c..cba54809 100644
--- a/setup.py
+++ b/setup.py
@@ -25,10 +25,13 @@ import setupinfo
# override these and pass --static for a static build. See
# doc/build.txt for more information. If you do not pass --static
# changing this will have no effect.
-STATIC_INCLUDE_DIRS = []
-STATIC_LIBRARY_DIRS = []
-STATIC_CFLAGS = []
-STATIC_BINARIES = []
+def static_env_list(name, separator=None):
+ return [x.strip() for x in os.environ.get(name, "").split(separator) if x.strip()]
+
+STATIC_INCLUDE_DIRS = static_env_list("LXML_STATIC_INCLUDE_DIRS", separator=os.pathsep)
+STATIC_LIBRARY_DIRS = static_env_list("LXML_STATIC_LIBRARY_DIRS", separator=os.pathsep)
+STATIC_CFLAGS = static_env_list("LXML_STATIC_CFLAGS")
+STATIC_BINARIES = static_env_list("LXML_STATIC_BINARIES", separator=os.pathsep)
# create lxml-version.h file
versioninfo.create_version_h()